163 if (derivedParticle && baseParticle) {
164 if (XsdSchemaHelper::isParticleEmptiable(derivedParticle) && !XsdSchemaHelper::isParticleEmptiable(baseParticle)) {
165 errorMsg = QtXmlPatterns::tr(
"Empty particle cannot be derived from non-empty particle.");
179 if (element->name(namePool) != derivedElement->name(namePool)) {
180 errorMsg = QtXmlPatterns::tr(
"Derived particle is missing element %1.").
arg(
formatKeyword(element->displayName(namePool)));
185 if (element->valueConstraint() && element->valueConstraint()->variety() == XsdElement::ValueConstraint::Fixed) {
186 if (!derivedElement->valueConstraint()) {
187 errorMsg = QtXmlPatterns::tr(
"Derived element %1 is missing value constraint as defined in base particle.").
arg(
formatKeyword(derivedElement->displayName(namePool)));
191 if (derivedElement->valueConstraint()->variety() != XsdElement::ValueConstraint::Fixed) {
192 errorMsg = QtXmlPatterns::tr(
"Derived element %1 has weaker value constraint than base particle.").
arg(
formatKeyword(derivedElement->displayName(namePool)));
198 if (!checker.valuesAreEqual(element->valueConstraint()->value(), derivedElement->valueConstraint()->value(), derivedElement->type())) {
199 errorMsg = QtXmlPatterns::tr(
"Fixed value constraint of element %1 differs from value constraint in base particle.").
arg(
formatKeyword(derivedElement->displayName(namePool)));
205 if (!element->isNillable() && derivedElement->isNillable()) {
206 errorMsg = QtXmlPatterns::tr(
"Derived element %1 cannot be nillable as base element is not nillable.").
arg(
formatKeyword(derivedElement->displayName(namePool)));
211 const XsdElement::BlockingConstraints baseConstraints = element->disallowedSubstitutions();
212 const XsdElement::BlockingConstraints derivedConstraints = derivedElement->disallowedSubstitutions();
213 if (((baseConstraints & XsdElement::RestrictionConstraint) && !(derivedConstraints & XsdElement::RestrictionConstraint)) ||
214 ((baseConstraints & XsdElement::ExtensionConstraint) && !(derivedConstraints & XsdElement::ExtensionConstraint)) ||
215 ((baseConstraints & XsdElement::SubstitutionConstraint) && !(derivedConstraints & XsdElement::SubstitutionConstraint))) {
216 errorMsg = QtXmlPatterns::tr(
"Block constraints of derived element %1 must not be more weaker than in the base element.").
arg(
formatKeyword(derivedElement->displayName(namePool)));
221 if (element->type()->name(namePool) == derivedElement->type()->name(namePool))
225 if (derivedElement->type()->isSimpleType()) {
226 if (!XsdSchemaHelper::isSimpleDerivationOk(derivedElement->type(), element->type(), SchemaType::DerivationConstraints())) {
227 errorMsg = QtXmlPatterns::tr(
"Simple type of derived element %1 cannot be validly derived from base element.").
arg(
formatKeyword(derivedElement->displayName(namePool)));
230 }
else if (derivedElement->type()->isComplexType()) {
231 if (!XsdSchemaHelper::isComplexDerivationOk(derivedElement->type(), element->type(), SchemaType::DerivationConstraints())) {
232 errorMsg = QtXmlPatterns::tr(
"Complex type of derived element %1 cannot be validly derived from base element.").
arg(
formatKeyword(derivedElement->displayName(namePool)));
239 if (element->type()->isComplexType() && derivedElement->type()->isComplexType()) {
240 if (element->type()->isDefinedBySchema() && derivedElement->type()->isDefinedBySchema()) {
243 if ((baseType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly ||
244 baseType->contentType()->variety() == XsdComplexType::ContentType::Mixed) &&
245 (derivedType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly ||
246 derivedType->contentType()->variety() == XsdComplexType::ContentType::Mixed)) {
248 return XsdParticleChecker::subsumes(baseType->contentType()->particle(), derivedType->contentType()->particle(), context, errorMsg);
256 errorMsg = QtXmlPatterns::tr(
"Element %1 is missing in derived particle.").
arg(
formatKeyword(element->displayName(namePool)));
270 name.
setNamespaceURI(namePool->allocateNamespace(XsdWildcard::absentNamespace()));
273 if (!XsdSchemaHelper::wildcardAllowsExpandedName(name, wildcard, namePool)) {
274 errorMsg = QtXmlPatterns::tr(
"Element %1 does not match namespace constraint of wildcard in base particle.").
arg(
formatKeyword(derivedElement->displayName(namePool)));
284 if (!XsdSchemaHelper::isWildcardSubset(derivedWildcard, wildcard)) {
285 errorMsg = QtXmlPatterns::tr(
"Wildcard in derived particle is not a valid subset of wildcard in base particle.");
289 if (!XsdSchemaHelper::checkWildcardProcessContents(wildcard, derivedWildcard)) {
290 errorMsg = QtXmlPatterns::tr(
"processContent of wildcard in derived particle is weaker than wildcard in base particle.");
static QString formatKeyword(const VariableDeclaration::Ptr &var, const NamePool::Ptr &np)
Formats var appropriately for display.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
virtual NamePool::Ptr namePool() const
The QUrl class provides a convenient interface for working with URLs.
virtual bool isWildcard() const
const T value(const Key &key) const
Returns the value associated with the key.
virtual bool isElement() const
The QSourceLocation class identifies a location in a resource by URI, line, and column.
NamespaceCode namespaceURI() const
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
The QXmlName class represents the name of an XML node, in an efficient, namespace-aware way...
The class that provides methods for checking a string against a type.
void setNamespaceURI(const NamespaceCode c)