72 for (
int i = 0; i < particles.
count(); ++i) {
97 for (
int i = 0; i < particles.
count(); ++i) {
133 if (!constraint->namespaces().contains(nameSpace))
140 if (constraint->namespaces().contains(nameSpace))
165 QSetIterator<T>
it(sub);
166 while (it.hasNext()) {
189 if (containsSet<QString>(otherConstraint->namespaces(), constraint->namespaces()))
195 if (constraint->namespaces().intersect(otherConstraint->namespaces()).
isEmpty())
201 if (containsSet<QString>(constraint->namespaces(), otherConstraint->namespaces()))
218 if ((constraint->variety() == otherConstraint->variety()) &&
219 (constraint->namespaces() == otherConstraint->namespaces())) {
222 return unionWildcard;
228 return unionWildcard;
234 unionWildcard->
namespaceConstraint()->setNamespaces(constraint->namespaces() + otherConstraint->namespaces());
235 return unionWildcard;
240 if (constraint->namespaces() != otherConstraint->namespaces()) {
243 return unionWildcard;
249 bool matches5 =
false;
253 negatedSet = constraint->namespaces();
254 sSet = otherConstraint->namespaces();
259 negatedSet = otherConstraint->namespaces();
260 sSet = constraint->namespaces();
267 return unionWildcard;
272 return unionWildcard;
280 return unionWildcard;
285 bool matches6 =
false;
289 negatedSet = constraint->namespaces();
290 sSet = otherConstraint->namespaces();
295 negatedSet = otherConstraint->namespaces();
296 sSet = constraint->namespaces();
303 return unionWildcard;
308 return unionWildcard;
325 if ((constraint->variety() == otherConstraint->variety()) &&
326 (constraint->namespaces() == otherConstraint->namespaces())) {
327 intersectionWildcard->namespaceConstraint()->setVariety(constraint->variety());
328 intersectionWildcard->namespaceConstraint()->setNamespaces(constraint->namespaces());
329 return intersectionWildcard;
335 intersectionWildcard->namespaceConstraint()->setVariety(otherConstraint->variety());
336 intersectionWildcard->namespaceConstraint()->setNamespaces(otherConstraint->namespaces());
337 return intersectionWildcard;
343 intersectionWildcard->namespaceConstraint()->setVariety(constraint->variety());
344 intersectionWildcard->namespaceConstraint()->setNamespaces(constraint->namespaces());
345 return intersectionWildcard;
353 set.
subtract(constraint->namespaces());
357 intersectionWildcard->namespaceConstraint()->setNamespaces(
set);
359 return intersectionWildcard;
367 set.
subtract(otherConstraint->namespaces());
371 intersectionWildcard->namespaceConstraint()->setNamespaces(
set);
373 return intersectionWildcard;
381 set.
intersect(otherConstraint->namespaces());
384 intersectionWildcard->namespaceConstraint()->setNamespaces(
set);
386 return intersectionWildcard;
396 return otherWildcard;
406 SchemaType::DerivationConstraints result = 0;
422 SchemaType::DerivationConstraints
keywords = constraints;
447 if (derivedType == baseType)
474 for (
int i = 0; i < memberTypes.
count(); ++i) {
494 if (derivedType != baseType) {
502 if (derivedType == baseType)
537 "We can only compare atomic values.");
570 if (visitedElements.
contains(member))
573 visitedElements.
insert(member);
582 for (
int i = 0; i < affiliations.
count(); ++i) {
597 if (memberType == headType)
615 if ((member->
name(namePool) == head->
name(namePool)) && (member->
type() == head->
type()))
632 NamedSchemaComponent::BlockingConstraints blockSet;
636 NamedSchemaComponent::BlockingConstraints checkSet(blockSet);
662 derivedAttributeGroup->
wildcard(), attributeGroup->
wildcard(), context, errorMsg);
671 for (
int i = 0; i < baseAttributeUses.
count(); ++i)
672 baseAttributeUsesLookup.
insert(baseAttributeUses.
at(i)->attribute()->name(namePool), baseAttributeUses.
at(i));
675 for (
int i = 0; i < derivedAttributeUses.
count(); ++i)
676 derivedAttributeUsesLookup.
insert(derivedAttributeUses.
at(i)->attribute()->name(namePool), derivedAttributeUses.
at(i));
679 for (
int i = 0; i < derivedAttributeUses.
count(); ++i) {
686 if (baseAttributeUsesLookup.contains(derivedAttributeUse->attribute()->name(namePool))) {
687 const XsdAttributeUse::Ptr baseAttributeUse(baseAttributeUsesLookup.value(derivedAttributeUse->attribute()->name(namePool)));
690 if (baseAttributeUse->isRequired() ==
true && derivedAttributeUse->isRequired() ==
false) {
691 errorMsg = QtXmlPatterns::tr(
"Base attribute %1 is required but derived attribute is not.").
arg(
formatAttribute(baseAttributeUse->attribute()->displayName(namePool)));
696 if (!
isSimpleDerivationOk(derivedAttributeUse->attribute()->type(), baseAttributeUse->attribute()->type(), SchemaType::DerivationConstraints())) {
697 errorMsg = QtXmlPatterns::tr(
"Type of derived attribute %1 cannot be validly derived from type of base attribute.").
arg(
formatAttribute(derivedAttributeUse->attribute()->displayName(namePool)));
703 if (derivedAttributeUse->valueConstraint())
704 derivedConstraint = derivedAttributeUse->valueConstraint();
705 else if (derivedAttributeUse->attribute()->valueConstraint())
709 if (baseAttributeUse->valueConstraint())
710 baseConstraint = baseAttributeUse->valueConstraint();
711 else if (baseAttributeUse->attribute()->valueConstraint())
718 if (derivedConstraint && baseConstraint) {
725 errorMsg = QtXmlPatterns::tr(
"Value constraint of derived attribute %1 does not match value constraint of base attribute.").
arg(
formatAttribute(derivedAttributeUse->attribute()->displayName(namePool)));
730 errorMsg = QtXmlPatterns::tr(
"Derived attribute %1 does not exist in the base definition.").
arg(
formatAttribute(derivedAttributeUse->attribute()->displayName(namePool)));
734 QXmlName name = derivedAttributeUse->attribute()->name(namePool);
741 errorMsg = QtXmlPatterns::tr(
"Derived attribute %1 does not match the wildcard in the base definition.").
arg(
formatAttribute(derivedAttributeUse->attribute()->displayName(namePool)));
748 for (
int i = 0; i < baseAttributeUses.
count(); ++i) {
751 if (baseAttributeUse->isRequired()) {
752 if (derivedAttributeUsesLookup.
contains(baseAttributeUse->attribute()->name(namePool))) {
753 if (!derivedAttributeUsesLookup.
value(baseAttributeUse->attribute()->name(namePool))->isRequired()) {
754 errorMsg = QtXmlPatterns::tr(
"Base attribute %1 is required but derived attribute is not.").
arg(
formatAttribute(baseAttributeUse->attribute()->displayName(namePool)));
758 errorMsg = QtXmlPatterns::tr(
"Base attribute %1 is required but missing in derived definition.").
arg(
formatAttribute(baseAttributeUse->attribute()->displayName(namePool)));
765 if (derivedWildcard) {
767 errorMsg = QtXmlPatterns::tr(
"Derived definition contains an %1 element that does not exists in the base definition").
arg(
formatElement(
"anyAttribute."));
772 errorMsg = QtXmlPatterns::tr(
"Derived wildcard is not a subset of the base wildcard.");
777 errorMsg = QtXmlPatterns::tr(
"%1 of derived wildcard is not a valid restriction of %2 of base wildcard").
arg(
formatKeyword(
"processContents")).
arg(
formatKeyword(
"processContents."));
794 for (
int i = 0; i < derivedAttributeUses.
count(); ++i)
795 lookupHash.
insert(derivedAttributeUses.
at(i)->attribute()->name(namePool), derivedAttributeUses.
at(i)->attribute());
797 for (
int i = 0; i < attributeUses.
count(); ++i) {
798 const QXmlName attributeName = attributeUses.
at(i)->attribute()->name(namePool);
799 if (!lookupHash.contains(attributeName)) {
800 errorMsg = QtXmlPatterns::tr(
"Attribute %1 from base type is missing in derived type.").
arg(
formatKeyword(namePool->displayName(attributeName)));
804 if (lookupHash.value(attributeName)->type() != attributeUses.
at(i)->attribute()->type()) {
805 errorMsg = QtXmlPatterns::tr(
"Type of derived attribute %1 differs from type of base attribute.").
arg(
formatKeyword(namePool->displayName(attributeName)));
812 if (!derivedWildcard) {
813 errorMsg = QtXmlPatterns::tr(
"Base definition contains an %1 element that is missing in the derived definition").
arg(
formatElement(
"anyAttribute."));
static AtomicValue::Ptr fromLexical(const QString &lexicalValue, const SchemaType::Ptr &type, const ReportContext::Ptr &context, const SourceLocationReflection *const sourceLocationReflection)
Returns an AtomicValue of type type from the lexical space lexicalValue, and raise an error through c...
virtual TypeCategory category() const =0
static QString absentNamespace()
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Any namespace is allowed.
#define QT_END_NAMESPACE
This macro expands to.
static bool wildcardAllowsNamespaceName(const QString &nameSpace, const XsdWildcard::NamespaceConstraint::Ptr &constraint)
The model group is a choice.
virtual bool isSimpleType() const
static XsdWildcard::Ptr wildcardIntersection(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &otherWildcard)
QString formatKeyword(const QString &keyword)
virtual bool hasError() const
#define it(className, varName)
ProcessContents processContents() const
The attribute use has a fixed value set.
XsdTerm::Ptr term() const
bool remove(const T &value)
XsdWildcard::Ptr wildcard() const
The attribute is not allowed to be there.
static bool foundSubstitutionGroupTransitive(const XsdElement::Ptr &head, const XsdElement::Ptr &member, QSet< XsdElement::Ptr > &visitedElements)
XsdAttributeUse::List attributeUses() const
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
XsdElement::List substitutionGroupAffiliations() const
Represents a XSD wildcard object.
int count(const T &t) const
Returns the number of occurrences of value in the list.
virtual NamePool::Ptr namePool() const
The QUrl class provides a convenient interface for working with URLs.
The QString class provides a Unicode character string.
static bool constructAndCompare(const DerivedString< TypeString >::Ptr &operand1, const AtomicComparator::Operator op, const DerivedString< TypeString >::Ptr &operand2, const SchemaType::Ptr &type, const ReportContext::Ptr &context, const SourceLocationReflection *const sourceLocationReflection)
The QHash class is a template class that provides a hash-table-based dictionary.
The attribute use has a default value set.
virtual bool isWildcard() const
static ValueConstraint::Ptr fromAttributeValueConstraint(const XsdAttribute::ValueConstraint::Ptr &constraint)
static bool containsSet(const QSet< T > &super, const QSet< T > &sub)
bool contains(const Key &key) const
Returns true if the hash contains an item with the key; otherwise returns false.
const T value(const Key &key) const
Returns the value associated with the key.
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
SchemaType::Ptr type() const
static void foundSubstitutionGroupTypeInheritance(const SchemaType::Ptr &headType, const SchemaType::Ptr &memberType, QSet< SchemaType::DerivationMethod > &derivationSet, NamedSchemaComponent::BlockingConstraints &blockSet)
static const SchemaType::Ptr xsAnyType
virtual bool isElement() const
No constraints at all: the item must simply be well-formed XML.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QSet< T > & intersect(const QSet< T > &other)
virtual DerivationConstraints derivationConstraints() const =0
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
static bool checkWildcardProcessContents(const XsdWildcard::Ptr &baseWildcard, const XsdWildcard::Ptr &derivedWildcard)
static bool isEmpty(const char *str)
There must be a top-level declaration for the item available, or the item must have an xsi:type...
unsigned int minimumOccurs() const
XsdParticle::List particles() const
static QString formatElement(const QString &element)
Formats element name.
Namespaces in the namespaces set are not allowed.
bool contains(const T &value) const
virtual bool isComplexType() const
const T & at(int i) const
Returns the item at index position i in the list.
static bool isValidAttributeUsesExtension(const XsdAttributeUse::List &derivedAttributeUses, const XsdAttributeUse::List &attributeUses, const XsdWildcard::Ptr &derivedWildcard, const XsdWildcard::Ptr &wildcard, const XsdSchemaContext::Ptr &context, QString &errorMsg)
The namespace for the internal API of QtXmlPatterns.
bool isEmpty() const
Returns true if the hash contains no items; otherwise returns false.
const_iterator insert(const T &value)
The QSourceLocation class identifies a location in a resource by URI, line, and column.
virtual QString stringValue() const =0
static bool isValidAttributeGroupRestriction(const XsdAttributeGroup::Ptr &derivedAttributeGroup, const XsdAttributeGroup::Ptr &attributeGroup, const XsdSchemaContext::Ptr &context, QString &errorMsg)
static bool isComplexDerivationOk(const SchemaType::Ptr &derivedType, const SchemaType::Ptr &baseType, const SchemaType::DerivationConstraints &constraints)
QSet< T > & subtract(const QSet< T > &other)
virtual QXmlName name(const NamePool::Ptr &namePool) const
static bool isSimpleDerivationOk(const SchemaType::Ptr &derivedType, const SchemaType::Ptr &baseType, const SchemaType::DerivationConstraints &constraints)
T & first()
Returns a reference to the first item in the list.
NamespaceCode namespaceURI() const
static bool isWildcardSubset(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &otherWildcard)
bool valuesAreEqual(const QString &value, const QString &otherValue, const AnySimpleType::Ptr &type) const
NamespaceConstraint::Ptr namespaceConstraint() const
#define Q_ASSERT_X(cond, where, what)
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...
QExplicitlySharedDataPointer< XsdWildcard > Ptr
static const AtomicType::Ptr xsQName
QExplicitlySharedDataPointer< XsdSimpleType > Ptr
XsdFacet::Hash facets() const
static const char *const keywords[MAX_KEYWORD]
static unsigned int effectiveTotalRangeMinimum(const XsdParticle::Ptr &particle)
static const SchemaType::Ptr xsAnySimpleType
const QString & stringForNamespace(const QXmlName::NamespaceCode code) const
static XsdWildcard::Ptr wildcardUnion(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &otherWildcard)
virtual DerivationMethod derivationMethod() const =0
virtual bool isModelGroup() const
AnySimpleType::List memberTypes() const
BlockingConstraints disallowedSubstitutions() const
static bool isParticleEmptiable(const XsdParticle::Ptr &particle)
static bool substitutionGroupOkTransitive(const XsdElement::Ptr &head, const XsdElement::Ptr &member, const NamePool::Ptr &namePool)
ModelCompositor compositor() const
Namespaces in the namespaces set are allowed.
QList< T > values() const
If the item has a uniquely determined declaration available, it must be valid with respect to that de...
static bool isValidlySubstitutable(const SchemaType::Ptr &type, const SchemaType::Ptr &otherType, const SchemaType::DerivationConstraints &constraints)
static QString formatAttribute(const QString &attribute)
Formats attribute name.
BlockingConstraints prohibitedSubstitutions() const
static bool wildcardAllowsExpandedName(const QXmlName &name, const XsdWildcard::Ptr &wildcard, const NamePool::Ptr &namePool)
virtual bool isDefinedBySchema() const
static SchemaType::DerivationConstraints convertBlockingConstraints(const NamedSchemaComponent::BlockingConstraints &constraints)
The class that provides methods for checking a string against a type.
virtual SchemaType::Ptr wxsSuperType() const =0
void setNamespaceURI(const NamespaceCode c)
virtual QXmlName name(const NamePool::Ptr &np) const =0
Returns the name of the type.
static bool compare(const AtomicValue::Ptr &operand1, const AtomicComparator::Operator op, const AtomicValue::Ptr &operand2, const SchemaType::Ptr &type, const ReportContext::Ptr &context, const SourceLocationReflection *const sourceLocationReflection)
Returns the result of evaluating operator op applied to the atomic values operand1 and operand2...
Base class for all instances that represents something at a certain location.
static bool isValidAttributeUsesRestriction(const XsdAttributeUse::List &derivedAttributeUses, const XsdAttributeUse::List &attributeUses, const XsdWildcard::Ptr &derivedWildcard, const XsdWildcard::Ptr &wildcard, const XsdSchemaContext::Ptr &context, QString &errorMsg)