Qt 4.8
Classes | Public Types | Public Functions | Private Functions | Properties | List of all members
QPatternist::XsdSchemaResolver Class Reference

Encapsulates the resolving of type/element references in a schema after parsing has finished. More...

#include <qxsdschemaresolver_p.h>

Inheritance diagram for QPatternist::XsdSchemaResolver:
QSharedData

Classes

class  AlternativeType
 
class  AlternativeTypeElement
 
class  AttributeType
 
class  ComplexBaseType
 
class  ComplexContentType
 
class  ElementType
 
class  KeyReference
 
class  RedefinedAttributeGroups
 
class  RedefinedGroups
 
class  SimpleListType
 
class  SimpleRestrictionBase
 
class  SimpleUnionType
 
class  SubstitutionGroupAffiliation
 

Public Types

typedef QExplicitlySharedDataPointer< XsdSchemaResolverPtr
 

Public Functions

void addAllGroupCheck (const XsdReference::Ptr &reference)
 
void addAlternativeType (const XsdAlternative::Ptr &alternative, const QXmlName &typeName, const QSourceLocation &location)
 
void addAlternativeType (const XsdAlternative::Ptr &alternative, const XsdElement::Ptr &element)
 
void addAttributeType (const XsdAttribute::Ptr &attribute, const QXmlName &typeName, const QSourceLocation &location)
 
void addComplexBaseType (const XsdComplexType::Ptr &complexType, const QXmlName &baseName, const QSourceLocation &location, const XsdFacet::Hash &facets=XsdFacet::Hash())
 
void addComplexContentType (const XsdComplexType::Ptr &complexType, const XsdParticle::Ptr &content, bool mixed)
 
void addComponentLocationHash (const QHash< NamedSchemaComponent::Ptr, QSourceLocation > &hash)
 
void addElementType (const XsdElement::Ptr &element, const QXmlName &typeName, const QSourceLocation &location)
 
void addEnumerationFacetValue (const AtomicValue::Ptr &facetValue, const NamespaceSupport &namespaceSupport)
 
void addKeyReference (const XsdElement::Ptr &element, const XsdIdentityConstraint::Ptr &keyRef, const QXmlName &name, const QSourceLocation &location)
 
void addRedefinedAttributeGroups (const XsdAttributeGroup::Ptr &redefinedGroup, const XsdAttributeGroup::Ptr &group)
 
void addRedefinedGroups (const XsdModelGroup::Ptr &redefinedGroup, const XsdModelGroup::Ptr &group)
 
void addSimpleListType (const XsdSimpleType::Ptr &simpleType, const QXmlName &typeName, const QSourceLocation &location)
 
void addSimpleRestrictionBase (const XsdSimpleType::Ptr &simpleType, const QXmlName &baseName, const QSourceLocation &location)
 
void addSimpleUnionTypes (const XsdSimpleType::Ptr &simpleType, const QList< QXmlName > &typeNames, const QSourceLocation &location)
 
void addSubstitutionGroupAffiliation (const XsdElement::Ptr &element, const QList< QXmlName > &elementName, const QSourceLocation &location)
 
void addSubstitutionGroupType (const XsdElement::Ptr &element)
 
QXmlName baseTypeNameOfType (const SchemaType::Ptr &type) const
 
void copyDataTo (const XsdSchemaResolver::Ptr &other) const
 
void removeComplexBaseType (const XsdComplexType::Ptr &type)
 
void removeSimpleRestrictionBase (const XsdSimpleType::Ptr &type)
 
void resolve ()
 
void setDefaultOpenContent (const XsdComplexType::OpenContent::Ptr &openContent, bool appliesToEmpty)
 
QXmlName typeNameOfAttribute (const XsdAttribute::Ptr &attribute) const
 
 XsdSchemaResolver (const QExplicitlySharedDataPointer< XsdSchemaContext > &context, const XsdSchemaParserContext *parserContext)
 
 ~XsdSchemaResolver ()
 
- Public Functions inherited from QSharedData
 QSharedData ()
 Constructs a QSharedData object with a reference count of 0. More...
 
 QSharedData (const QSharedData &)
 Constructs a QSharedData object with reference count 0. More...
 

Private Functions

void checkRedefinedAttributeGroups ()
 
void checkRedefinedGroups ()
 
XsdFacet::Hash complexTypeFacets (const XsdComplexType::Ptr &complexType) const
 
AnySimpleType::Ptr findPrimitiveType (const AnySimpleType::Ptr &type, QSet< AnySimpleType::Ptr > &visitedTypes)
 
void resolveAlternativeTypes ()
 
void resolveAttributeInheritance ()
 
void resolveAttributeInheritance (const XsdComplexType::Ptr &complexType, QSet< XsdComplexType::Ptr > &visitedTypes)
 
void resolveAttributeTermReferences ()
 
XsdAttributeUse::List resolveAttributeTermReferences (const XsdAttributeUse::List &attributeUses, XsdWildcard::Ptr &wildcard, QSet< QXmlName > visitedAttributeGroups)
 
void resolveAttributeTypes ()
 
void resolveComplexBaseTypes ()
 
void resolveComplexContentComplexTypes ()
 
void resolveComplexContentComplexTypes (const XsdComplexType::Ptr &complexType, QSet< XsdComplexType::Ptr > &visitedTypes)
 
void resolveElementTypes ()
 
void resolveEnumerationFacetValues ()
 
void resolveKeyReferences ()
 
void resolveSimpleContentComplexTypes ()
 
void resolveSimpleContentComplexTypes (const XsdComplexType::Ptr &complexType, QSet< XsdComplexType::Ptr > &visitedTypes)
 
void resolveSimpleListType ()
 
void resolveSimpleRestrictionBaseTypes ()
 
void resolveSimpleRestrictions ()
 
void resolveSimpleRestrictions (const XsdSimpleType::Ptr &simpleType, QSet< XsdSimpleType::Ptr > &visitedTypes)
 
void resolveSimpleUnionTypes ()
 
void resolveSubstitutionGroupAffiliations ()
 
void resolveSubstitutionGroups ()
 
void resolveTermReference (const XsdParticle::Ptr &particle, QSet< QXmlName > visitedGroups)
 
void resolveTermReferences ()
 
QSourceLocation sourceLocation (const NamedSchemaComponent::Ptr component) const
 

Properties

QSet< XsdReference::Ptrm_allGroups
 
QVector< AlternativeTypeElementm_alternativeTypeElements
 
QVector< AlternativeTypem_alternativeTypes
 
QVector< AttributeTypem_attributeTypes
 
QExplicitlySharedDataPointer< XsdSchemaCheckerm_checker
 
QVector< ComplexBaseTypem_complexBaseTypes
 
QVector< ComplexContentTypem_complexContentTypes
 
QHash< NamedSchemaComponent::Ptr, QSourceLocationm_componentLocationHash
 
QExplicitlySharedDataPointer< XsdSchemaContextm_context
 
XsdComplexType::OpenContent::Ptr m_defaultOpenContent
 
bool m_defaultOpenContentAppliesToEmpty
 
QVector< ElementTypem_elementTypes
 
QHash< AtomicValue::Ptr, NamespaceSupportm_enumerationFacetValues
 
QVector< KeyReferencem_keyReferences
 
NamePool::Ptr m_namePool
 
SchemaType::List m_predefinedSchemaTypes
 
QVector< RedefinedAttributeGroupsm_redefinedAttributeGroups
 
QVector< RedefinedGroupsm_redefinedGroups
 
XsdSchema::Ptr m_schema
 
QVector< SimpleListTypem_simpleListTypes
 
QVector< SimpleRestrictionBasem_simpleRestrictionBases
 
QVector< SimpleUnionTypem_simpleUnionTypes
 
QVector< SubstitutionGroupAffiliationm_substitutionGroupAffiliations
 
QVector< XsdElement::Ptrm_substitutionGroupTypes
 

Additional Inherited Members

- Public Variables inherited from QSharedData
QAtomicInt ref
 

Detailed Description

Encapsulates the resolving of type/element references in a schema after parsing has finished.

This class collects task for resolving types or element references. After the parsing has finished, one can start the resolve process by calling resolve().

Author
Tobias Koenig tobia.nosp@m.s.ko.nosp@m.enig@.nosp@m.noki.nosp@m.a.com

Definition at line 89 of file qxsdschemaresolver_p.h.

Typedefs

◆ Ptr

Definition at line 92 of file qxsdschemaresolver_p.h.

Constructors and Destructors

◆ XsdSchemaResolver()

XsdSchemaResolver::XsdSchemaResolver ( const QExplicitlySharedDataPointer< XsdSchemaContext > &  context,
const XsdSchemaParserContext parserContext 
)

Creates a new schema resolver.

Parameters
contextThe schema context used for error reporting etc..
parserContextThe schema parser context where all objects to resolve belong to.

Definition at line 59 of file qxsdschemaresolver.cpp.

60  : m_context(context)
61  , m_checker(parserContext->checker())
62  , m_namePool(parserContext->namePool())
63  , m_schema(parserContext->schema())
64 {
65  m_keyReferences.reserve(20);
66  m_simpleRestrictionBases.reserve(20);
67  m_simpleListTypes.reserve(20);
68  m_simpleUnionTypes.reserve(20);
69  m_elementTypes.reserve(20);
70  m_complexBaseTypes.reserve(20);
71  m_attributeTypes.reserve(20);
72  m_alternativeTypes.reserve(20);
73  m_alternativeTypeElements.reserve(20);
75 
77 }
QVector< ElementType > m_elementTypes
QVector< SimpleListType > m_simpleListTypes
QVector< AlternativeType > m_alternativeTypes
QVector< SimpleRestrictionBase > m_simpleRestrictionBases
QVector< ComplexBaseType > m_complexBaseTypes
QVector< SimpleUnionType > m_simpleUnionTypes
QExplicitlySharedDataPointer< XsdSchemaContext > m_context
SchemaTypeFactory::Ptr schemaTypeFactory() const
QVector< KeyReference > m_keyReferences
QList< T > values() const
Returns a list containing all the values in the hash, in an arbitrary order.
Definition: qhash.h:693
virtual SchemaType::Hash types() const =0
QExplicitlySharedDataPointer< XsdSchemaChecker > m_checker
QVector< AlternativeTypeElement > m_alternativeTypeElements
QVector< AttributeType > m_attributeTypes
QVector< SubstitutionGroupAffiliation > m_substitutionGroupAffiliations

◆ ~XsdSchemaResolver()

XsdSchemaResolver::~XsdSchemaResolver ( )

Destroys the schema resolver.

Definition at line 79 of file qxsdschemaresolver.cpp.

80 {
81 }

Functions

◆ addAllGroupCheck()

void XsdSchemaResolver::addAllGroupCheck ( const XsdReference::Ptr reference)

◆ addAlternativeType() [1/2]

void XsdSchemaResolver::addAlternativeType ( const XsdAlternative::Ptr alternative,
const QXmlName typeName,
const QSourceLocation location 
)

Adds a resolve task for the type of an alternative.

The resolver will set the type of the alternative to the type named by typeName.

Definition at line 233 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::parseAlternative(), QPatternist::XsdSchemaParser::parseGlobalElement(), and QPatternist::XsdSchemaParser::parseLocalElement().

234 {
235  AlternativeType item;
236  item.alternative = alternative;
237  item.typeName = typeName;
238  item.location = location;
239 
240  m_alternativeTypes.append(item);
241 }
QVector< AlternativeType > m_alternativeTypes
const char * typeName
Definition: qmetatype.cpp:239
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63

◆ addAlternativeType() [2/2]

void XsdSchemaResolver::addAlternativeType ( const XsdAlternative::Ptr alternative,
const XsdElement::Ptr element 
)

Adds a resolve task for the type of an alternative.

The resolver will set the type of the alternative to the type of the element after the type of the element has been resolved.

Definition at line 243 of file qxsdschemaresolver.cpp.

244 {
245  AlternativeTypeElement item;
246  item.alternative = alternative;
247  item.element = element;
248 
249  m_alternativeTypeElements.append(item);
250 }
QVector< AlternativeTypeElement > m_alternativeTypeElements

◆ addAttributeType()

void XsdSchemaResolver::addAttributeType ( const XsdAttribute::Ptr attribute,
const QXmlName typeName,
const QSourceLocation location 
)

Adds a resolve task for the type of an attribute.

The resolver will set the type of the attribute to the type named by typeName.

Definition at line 223 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::parseGlobalAttribute(), and QPatternist::XsdSchemaParser::parseLocalAttribute().

224 {
225  AttributeType item;
226  item.attribute = attribute;
227  item.typeName = typeName;
228  item.location = location;
229 
230  m_attributeTypes.append(item);
231 }
const char * typeName
Definition: qmetatype.cpp:239
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
QVector< AttributeType > m_attributeTypes

◆ addComplexBaseType()

void XsdSchemaResolver::addComplexBaseType ( const XsdComplexType::Ptr complexType,
const QXmlName baseName,
const QSourceLocation location,
const XsdFacet::Hash facets = XsdFacet::Hash() 
)

Adds a resolve task for the base type of a complex type.

The resolver will set the base type of complexType to the type named by baseName.

Definition at line 193 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::parseComplexContentExtension(), QPatternist::XsdSchemaParser::parseComplexContentRestriction(), QPatternist::XsdSchemaParser::parseSimpleContentExtension(), and QPatternist::XsdSchemaParser::parseSimpleContentRestriction().

194 {
195  ComplexBaseType item;
196  item.complexType = complexType;
197  item.baseName = baseName;
198  item.location = location;
199  item.facets = facets;
200 
201  m_complexBaseTypes.append(item);
202 }
QVector< ComplexBaseType > m_complexBaseTypes
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63

◆ addComplexContentType()

void XsdSchemaResolver::addComplexContentType ( const XsdComplexType::Ptr complexType,
const XsdParticle::Ptr content,
bool  mixed 
)

Adds a resolve task for the content type of a complex type.

The resolver will set the content type properties for complexType based on the given explicit content and effective mixed value.

Definition at line 214 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::resolveComplexContentType().

215 {
216  ComplexContentType item;
217  item.complexType = complexType;
218  item.explicitContent = content;
219  item.effectiveMixed = mixed;
220  m_complexContentTypes.append(item);
221 }
QVector< ComplexContentType > m_complexContentTypes

◆ addComponentLocationHash()

void XsdSchemaResolver::addComponentLocationHash ( const QHash< NamedSchemaComponent::Ptr, QSourceLocation > &  hash)

Adds the component location hash, so the resolver is able to report meaning full error messages.

Definition at line 267 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::parse().

268 {
270 }
QHash< NamedSchemaComponent::Ptr, QSourceLocation > m_componentLocationHash
QHash< Key, T > & unite(const QHash< Key, T > &other)
Inserts all the items in the other hash into this hash.
Definition: qhash.h:556

◆ addElementType()

void XsdSchemaResolver::addElementType ( const XsdElement::Ptr element,
const QXmlName typeName,
const QSourceLocation location 
)

Adds a resolve task for the type of an element.

The resolver will set the type of the element to the type named by typeName.

Definition at line 183 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::parseGlobalElement(), and QPatternist::XsdSchemaParser::parseLocalElement().

184 {
185  ElementType item;
186  item.element = element;
187  item.typeName = typeName;
188  item.location = location;
189 
190  m_elementTypes.append(item);
191 }
QVector< ElementType > m_elementTypes
const char * typeName
Definition: qmetatype.cpp:239
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63

◆ addEnumerationFacetValue()

void XsdSchemaResolver::addEnumerationFacetValue ( const AtomicValue::Ptr facetValue,
const NamespaceSupport namespaceSupport 
)

Add a resolve task for enumeration facet values.

In case the enumeration is of type QName or NOTATION, we have to resolve the QName later, so we store the namespace bindings together with the facet value here and resolve it as soon as we have all type information available.

Definition at line 272 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::parseEnumerationFacet().

273 {
274  m_enumerationFacetValues.insert(facetValue, namespaceSupport);
275 }
QHash< AtomicValue::Ptr, NamespaceSupport > m_enumerationFacetValues

◆ addKeyReference()

void XsdSchemaResolver::addKeyReference ( const XsdElement::Ptr element,
const XsdIdentityConstraint::Ptr keyRef,
const QXmlName name,
const QSourceLocation location 
)

Adds a resolve task for key references.

The resolver will try to set the referencedKey property of keyRef to the key or unique object of element that has the given name.

Definition at line 132 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::parseKeyRef().

133 {
134  KeyReference item;
135  item.element = element;
136  item.keyRef = keyRef;
137  item.reference = reference;
138  item.location = location;
139 
140  m_keyReferences.append(item);
141 }
QVector< KeyReference > m_keyReferences
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63

◆ addRedefinedAttributeGroups()

void XsdSchemaResolver::addRedefinedAttributeGroups ( const XsdAttributeGroup::Ptr redefinedGroup,
const XsdAttributeGroup::Ptr group 
)

Add a check job for redefined attribute groups.

When an attribute group is redefined, we have to check whether the redefined group is a valid restriction of the group it redefines. As we need all type information for that, we keep them here for later checking.

Definition at line 286 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::parseRedefine().

287 {
288  RedefinedAttributeGroups item;
289  item.redefinedGroup = redefinedGroup;
290  item.group = group;
291 
292  m_redefinedAttributeGroups.append(item);
293 }
QVector< RedefinedAttributeGroups > m_redefinedAttributeGroups

◆ addRedefinedGroups()

void XsdSchemaResolver::addRedefinedGroups ( const XsdModelGroup::Ptr redefinedGroup,
const XsdModelGroup::Ptr group 
)

Add a check job for redefined groups.

When an element group is redefined, we have to check whether the redefined group is a valid restriction of the group it redefines. As we need all type information for that, we keep them here for later checking.

Definition at line 277 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::parseRedefine().

278 {
279  RedefinedGroups item;
280  item.redefinedGroup = redefinedGroup;
281  item.group = group;
282 
283  m_redefinedGroups.append(item);
284 }
QVector< RedefinedGroups > m_redefinedGroups

◆ addSimpleListType()

void XsdSchemaResolver::addSimpleListType ( const XsdSimpleType::Ptr simpleType,
const QXmlName typeName,
const QSourceLocation location 
)

Adds a resolve task for the list type of a simple type.

The resolver will set the itemType property of simpleType to the type named by typeName.

Definition at line 163 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::parseList().

164 {
165  SimpleListType item;
166  item.simpleType = simpleType;
167  item.typeName = typeName;
168  item.location = location;
169 
170  m_simpleListTypes.append(item);
171 }
QVector< SimpleListType > m_simpleListTypes
const char * typeName
Definition: qmetatype.cpp:239
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63

◆ addSimpleRestrictionBase()

void XsdSchemaResolver::addSimpleRestrictionBase ( const XsdSimpleType::Ptr simpleType,
const QXmlName baseName,
const QSourceLocation location 
)

Adds a resolve task for the base type of restriction of a simple type.

The resolver will set the base type of simpleType to the type named by baseName.

Definition at line 143 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::parseSimpleRestriction().

144 {
145  SimpleRestrictionBase item;
146  item.simpleType = simpleType;
147  item.baseName = baseName;
148  item.location = location;
149 
150  m_simpleRestrictionBases.append(item);
151 }
QVector< SimpleRestrictionBase > m_simpleRestrictionBases
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63

◆ addSimpleUnionTypes()

void XsdSchemaResolver::addSimpleUnionTypes ( const XsdSimpleType::Ptr simpleType,
const QList< QXmlName > &  typeNames,
const QSourceLocation location 
)

Adds a resolve task for the member types of a simple type.

The resolver will set the memberTypes property of simpleType to the types named by typeNames.

Definition at line 173 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::parseUnion().

174 {
175  SimpleUnionType item;
176  item.simpleType = simpleType;
177  item.typeNames = typeNames;
178  item.location = location;
179 
180  m_simpleUnionTypes.append(item);
181 }
QVector< SimpleUnionType > m_simpleUnionTypes
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63

◆ addSubstitutionGroupAffiliation()

void XsdSchemaResolver::addSubstitutionGroupAffiliation ( const XsdElement::Ptr element,
const QList< QXmlName > &  elementName,
const QSourceLocation location 
)

Adds a resolve task for the substituion group affiliations of an element.

The resolver will set the substitution group affiliations of the element to the top-level element named by elementNames.

Definition at line 252 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::parseGlobalElement().

253 {
254  SubstitutionGroupAffiliation item;
255  item.element = element;
256  item.elementNames = elementNames;
257  item.location = location;
258 
259  m_substitutionGroupAffiliations.append(item);
260 }
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
QVector< SubstitutionGroupAffiliation > m_substitutionGroupAffiliations

◆ addSubstitutionGroupType()

void XsdSchemaResolver::addSubstitutionGroupType ( const XsdElement::Ptr element)

Adds a resolve task for an element that has no type specified, only a substitution group affiliation.

The resolver will set the type of the substitution group affiliation as type for the element.

Definition at line 262 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::parseGlobalElement().

263 {
264  m_substitutionGroupTypes.append(element);
265 }
QVector< XsdElement::Ptr > m_substitutionGroupTypes

◆ baseTypeNameOfType()

QXmlName XsdSchemaResolver::baseTypeNameOfType ( const SchemaType::Ptr type) const

Returns the to resolve base type name for the given type.

Note
That functionality is only used by the redefine algorithm in the XsdSchemaParser.

Definition at line 316 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::parseRedefine().

317 {
318  for (int i = 0; i < m_simpleRestrictionBases.count(); ++i) {
319  if (m_simpleRestrictionBases.at(i).simpleType == type)
320  return m_simpleRestrictionBases.at(i).baseName;
321  }
322 
323  for (int i = 0; i < m_complexBaseTypes.count(); ++i) {
324  if (m_complexBaseTypes.at(i).complexType == type)
325  return m_complexBaseTypes.at(i).baseName;
326  }
327 
328  return QXmlName();
329 }
int type
Definition: qmetatype.cpp:239
QVector< SimpleRestrictionBase > m_simpleRestrictionBases
QVector< ComplexBaseType > m_complexBaseTypes
The QXmlName class represents the name of an XML node, in an efficient, namespace-aware way...
Definition: qxmlname.h:58

◆ checkRedefinedAttributeGroups()

void XsdSchemaResolver::checkRedefinedAttributeGroups ( )
private

Checks the redefined attribute groups.

Definition at line 1685 of file qxsdschemaresolver.cpp.

Referenced by resolve().

1686 {
1687  for (int i = 0; i < m_redefinedAttributeGroups.count(); ++i) {
1688  const RedefinedAttributeGroups item = m_redefinedAttributeGroups.at(i);
1689 
1690  QString errorMsg;
1691  if (!XsdSchemaHelper::isValidAttributeGroupRestriction(item.redefinedGroup, item.group, m_context, errorMsg)) {
1692  m_context->error(QtXmlPatterns::tr("%1 element %2 is not a valid restriction of the %3 element it redefines: %4.")
1693  .arg(formatElement("attributeGroup"))
1694  .arg(formatData(item.redefinedGroup->displayName(m_namePool)))
1695  .arg(formatElement("attributeGroup"))
1696  .arg(errorMsg),
1697  XsdSchemaContext::XSDError, sourceLocation(item.redefinedGroup));
1698  return;
1699  }
1700  }
1701 }
The QString class provides a Unicode character string.
Definition: qstring.h:83
QVector< RedefinedAttributeGroups > m_redefinedAttributeGroups
QExplicitlySharedDataPointer< XsdSchemaContext > m_context
void error(const QString &message, const ReportContext::ErrorCode errorCode, const QSourceLocation &sourceLocation)
static QString formatElement(const QString &element)
Formats element name.
QSourceLocation sourceLocation(const NamedSchemaComponent::Ptr component) const
static bool isValidAttributeGroupRestriction(const XsdAttributeGroup::Ptr &derivedAttributeGroup, const XsdAttributeGroup::Ptr &attributeGroup, const XsdSchemaContext::Ptr &context, QString &errorMsg)
static QString formatData(const QString &data)

◆ checkRedefinedGroups()

void XsdSchemaResolver::checkRedefinedGroups ( )
private

Checks the redefined groups.

Definition at line 1660 of file qxsdschemaresolver.cpp.

Referenced by resolve().

1661 {
1662  for (int i = 0; i < m_redefinedGroups.count(); ++i) {
1663  const RedefinedGroups item = m_redefinedGroups.at(i);
1664 
1665  // create dummy particles...
1666  const XsdParticle::Ptr redefinedParticle(new XsdParticle());
1667  redefinedParticle->setTerm(item.redefinedGroup);
1668  const XsdParticle::Ptr particle(new XsdParticle());
1669  particle->setTerm(item.group);
1670 
1671  // so that we can pass them to XsdParticleChecker::subsumes()
1672  QString errorMsg;
1673  if (!XsdParticleChecker::subsumes(particle, redefinedParticle, m_context, errorMsg)) {
1674  m_context->error(QtXmlPatterns::tr("%1 element %2 is not a valid restriction of the %3 element it redefines: %4.")
1675  .arg(formatElement("group"))
1676  .arg(formatData(item.redefinedGroup->displayName(m_namePool)))
1677  .arg(formatElement("group"))
1678  .arg(errorMsg),
1679  XsdSchemaContext::XSDError, sourceLocation(item.redefinedGroup));
1680  return;
1681  }
1682  }
1683 }
static bool subsumes(const XsdParticle::Ptr &particle, const XsdParticle::Ptr &derivedParticle, const XsdSchemaContext::Ptr &context, QString &errorMsg)
The QString class provides a Unicode character string.
Definition: qstring.h:83
QExplicitlySharedDataPointer< XsdSchemaContext > m_context
void error(const QString &message, const ReportContext::ErrorCode errorCode, const QSourceLocation &sourceLocation)
static QString formatElement(const QString &element)
Formats element name.
Represents a XSD particle object.
QSourceLocation sourceLocation(const NamedSchemaComponent::Ptr component) const
static QString formatData(const QString &data)
QVector< RedefinedGroups > m_redefinedGroups

◆ complexTypeFacets()

XsdFacet::Hash XsdSchemaResolver::complexTypeFacets ( const XsdComplexType::Ptr complexType) const
private

Returns the facets that are marked for the given complex type with a simple type restriction.

Definition at line 1650 of file qxsdschemaresolver.cpp.

Referenced by resolveSimpleContentComplexTypes().

1651 {
1652  for (int i = 0; i < m_complexBaseTypes.count(); ++i) {
1653  if (m_complexBaseTypes.at(i).complexType == complexType)
1654  return m_complexBaseTypes.at(i).facets;
1655  }
1656 
1657  return XsdFacet::Hash();
1658 }
QVector< ComplexBaseType > m_complexBaseTypes
QHash< XsdFacet::Type, XsdFacet::Ptr > Hash
Definition: qxsdfacet_p.h:118

◆ copyDataTo()

void XsdSchemaResolver::copyDataTo ( const XsdSchemaResolver::Ptr other) const

Copies the data to resolve to an other resolver.

Note
That functionality is only used by the redefine algorithm in the XsdSchemaParser.

Definition at line 300 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::parseRedefine().

301 {
306  other->m_elementTypes << m_elementTypes;
314 }
QVector< ElementType > m_elementTypes
QVector< SimpleListType > m_simpleListTypes
QVector< AlternativeType > m_alternativeTypes
QVector< SimpleRestrictionBase > m_simpleRestrictionBases
QVector< ComplexBaseType > m_complexBaseTypes
QVector< SimpleUnionType > m_simpleUnionTypes
QVector< KeyReference > m_keyReferences
QVector< ComplexContentType > m_complexContentTypes
QVector< AlternativeTypeElement > m_alternativeTypeElements
QVector< XsdElement::Ptr > m_substitutionGroupTypes
QVector< AttributeType > m_attributeTypes
QVector< SubstitutionGroupAffiliation > m_substitutionGroupAffiliations

◆ findPrimitiveType()

AnySimpleType::Ptr XsdSchemaResolver::findPrimitiveType ( const AnySimpleType::Ptr type,
QSet< AnySimpleType::Ptr > &  visitedTypes 
)
private

Finds the primitive type for the given simple type.

The type is found by walking up the inheritance tree, until one of the builtin primitive type definitions is reached.

Definition at line 1703 of file qxsdschemaresolver.cpp.

Referenced by resolveSimpleContentComplexTypes(), and resolveSimpleRestrictions().

1704 {
1705  if (visitedTypes.contains(type)) {
1706  // found invalid circular reference...
1707  return AnySimpleType::Ptr();
1708  } else {
1709  visitedTypes.insert(type);
1710  }
1711 
1712  const QXmlName typeName = type->name(m_namePool);
1713  if (typeName == BuiltinTypes::xsString->name(m_namePool) ||
1714  typeName == BuiltinTypes::xsBoolean->name(m_namePool) ||
1715  typeName == BuiltinTypes::xsFloat->name(m_namePool) ||
1716  typeName == BuiltinTypes::xsDouble->name(m_namePool) ||
1717  typeName == BuiltinTypes::xsDecimal->name(m_namePool) ||
1718  typeName == BuiltinTypes::xsDuration->name(m_namePool) ||
1719  typeName == BuiltinTypes::xsDateTime->name(m_namePool) ||
1720  typeName == BuiltinTypes::xsTime->name(m_namePool) ||
1721  typeName == BuiltinTypes::xsDate->name(m_namePool) ||
1722  typeName == BuiltinTypes::xsGYearMonth->name(m_namePool) ||
1723  typeName == BuiltinTypes::xsGYear->name(m_namePool) ||
1724  typeName == BuiltinTypes::xsGMonthDay->name(m_namePool) ||
1725  typeName == BuiltinTypes::xsGDay->name(m_namePool) ||
1726  typeName == BuiltinTypes::xsGMonth->name(m_namePool) ||
1727  typeName == BuiltinTypes::xsHexBinary->name(m_namePool) ||
1729  typeName == BuiltinTypes::xsAnyURI->name(m_namePool) ||
1730  typeName == BuiltinTypes::xsQName->name(m_namePool) ||
1731  typeName == BuiltinTypes::xsNOTATION->name(m_namePool) ||
1733  return type;
1734  else {
1735  if (type->wxsSuperType())
1736  return findPrimitiveType(type->wxsSuperType(), visitedTypes);
1737  else {
1738  return AnySimpleType::Ptr();
1739  }
1740  }
1741 }
static const AtomicType::Ptr xsBase64Binary
int type
Definition: qmetatype.cpp:239
virtual SchemaType::Ptr wxsSuperType() const
static const AtomicType::Ptr xsDuration
static const AtomicType::Ptr xsGYearMonth
static const AtomicType::Ptr xsGMonthDay
virtual QXmlName name(const NamePool::Ptr &np) const
Returns the name of the type.
static const AtomicType::Ptr xsString
static const AtomicType::Ptr xsGDay
const char * typeName
Definition: qmetatype.cpp:239
static const AtomicType::Ptr xsDateTime
bool contains(const T &value) const
Definition: qset.h:91
const char * name
const_iterator insert(const T &value)
Definition: qset.h:179
static const AtomicType::Ptr xsDouble
static const AtomicType::Ptr xsGYear
The QXmlName class represents the name of an XML node, in an efficient, namespace-aware way...
Definition: qxmlname.h:58
static const AtomicType::Ptr xsQName
static const SchemaType::Ptr xsAnySimpleType
static const AtomicType::Ptr xsFloat
AnySimpleType::Ptr findPrimitiveType(const AnySimpleType::Ptr &type, QSet< AnySimpleType::Ptr > &visitedTypes)
QExplicitlySharedDataPointer< AnySimpleType > Ptr
static const AtomicType::Ptr xsTime
static const AtomicType::Ptr xsDecimal
static const AtomicType::Ptr xsBoolean
static const AtomicType::Ptr xsDate
static const AtomicType::Ptr xsNOTATION
static const AtomicType::Ptr xsGMonth
static const AtomicType::Ptr xsHexBinary
static const AtomicType::Ptr xsAnyURI

◆ removeComplexBaseType()

void XsdSchemaResolver::removeComplexBaseType ( const XsdComplexType::Ptr type)

Removes the resolve task for the base type of the complex type.

Definition at line 204 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::parseRedefine().

205 {
206  for (int i = 0; i < m_complexBaseTypes.count(); ++i) {
207  if (m_complexBaseTypes.at(i).complexType == type) {
208  m_complexBaseTypes.remove(i);
209  break;
210  }
211  }
212 }
int type
Definition: qmetatype.cpp:239
QVector< ComplexBaseType > m_complexBaseTypes

◆ removeSimpleRestrictionBase()

void XsdSchemaResolver::removeSimpleRestrictionBase ( const XsdSimpleType::Ptr type)

Removes the resolve task for the base type of restriction of the simple type.

Definition at line 153 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::parseRedefine().

154 {
155  for (int i = 0; i < m_simpleRestrictionBases.count(); ++i) {
156  if (m_simpleRestrictionBases.at(i).simpleType == type) {
157  m_simpleRestrictionBases.remove(i);
158  break;
159  }
160  }
161 }
int type
Definition: qmetatype.cpp:239
QVector< SimpleRestrictionBase > m_simpleRestrictionBases

◆ resolve()

void XsdSchemaResolver::resolve ( )

Starts the resolve process.

Definition at line 83 of file qxsdschemaresolver.cpp.

84 {
86 
87  // resolve the base types for all types
90 
91  // do the basic checks which depend on having a base type available
93 
94  // resolve further types that only map a type name to a type object
100 
101  // resolve objects that do not need information about inheritance
104 
105  // resolve objects that do need information about inheritance
108 
109  // resolve objects which replace place holders
112 
113  // resolve additional objects that do need information about inheritance
117 
119 
122 
123  // check the constraining facets before we resolve them
125 
126  // add it again, as we may have added new components in the meantime
128 
129  m_checker->check();
130 }
void addComponentLocationHash(const QHash< NamedSchemaComponent::Ptr, QSourceLocation > &hash)
QHash< NamedSchemaComponent::Ptr, QSourceLocation > m_componentLocationHash
QExplicitlySharedDataPointer< XsdSchemaChecker > m_checker

◆ resolveAlternativeTypes()

void XsdSchemaResolver::resolveAlternativeTypes ( )
private

Resolves alternative types.

Definition at line 975 of file qxsdschemaresolver.cpp.

Referenced by resolve().

976 {
977  for (int i = 0; i < m_alternativeTypes.count(); ++i) {
978  const AlternativeType item = m_alternativeTypes.at(i);
979 
980  SchemaType::Ptr type = m_schema->type(item.typeName);
981  if (!type) {
982  // maybe it's a basic type...
983  type = m_context->schemaTypeFactory()->createSchemaType(item.typeName);
984  if (!type) {
985  m_context->error(QtXmlPatterns::tr("Type %1 of %2 element cannot be resolved.")
986  .arg(formatType(m_namePool, item.typeName))
987  .arg(formatElement("alternative")),
988  XsdSchemaContext::XSDError, item.location);
989  return;
990  }
991  }
992 
993  item.alternative->setType(type);
994  }
995 
996  for (int i = 0; i < m_alternativeTypeElements.count(); ++i) {
997  const AlternativeTypeElement item = m_alternativeTypeElements.at(i);
998  item.alternative->setType(item.element->type());
999  }
1000 }
int type
Definition: qmetatype.cpp:239
QVector< AlternativeType > m_alternativeTypes
QString formatType(const NamePool::Ptr &np, const T &type)
Formats ItemType and SequenceType.
QExplicitlySharedDataPointer< XsdSchemaContext > m_context
void error(const QString &message, const ReportContext::ErrorCode errorCode, const QSourceLocation &sourceLocation)
SchemaTypeFactory::Ptr schemaTypeFactory() const
static QString formatElement(const QString &element)
Formats element name.
SchemaType::Ptr type(const QXmlName &name) const
Definition: qxsdschema.cpp:124
virtual SchemaType::Ptr createSchemaType(const QXmlName name) const =0
QVector< AlternativeTypeElement > m_alternativeTypeElements

◆ resolveAttributeInheritance() [1/2]

void XsdSchemaResolver::resolveAttributeInheritance ( )
private

Resolves the attribute inheritance of complex types.

Note
This method must be called after all base types have been resolved.

Definition at line 1394 of file qxsdschemaresolver.cpp.

Referenced by resolve(), and resolveAttributeInheritance().

1395 {
1396  // collect the global and anonymous complex types
1398  types << m_schema->anonymousTypes();
1399 
1400  QSet<XsdComplexType::Ptr> visitedTypes;
1401  for (int i = 0; i < types.count(); ++i) {
1402  if (!(types.at(i)->isComplexType()) || !types.at(i)->isDefinedBySchema())
1403  continue;
1404 
1405  const XsdComplexType::Ptr complexType = types.at(i);
1406 
1407  resolveAttributeInheritance(complexType, visitedTypes);
1408  }
1409 }
SchemaType::List anonymousTypes() const
Definition: qxsdschema.cpp:181
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
virtual bool isComplexType() const
Definition: qschematype.cpp:70
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static const struct @32 types[]
virtual bool isDefinedBySchema() const
Definition: qschematype.cpp:75
SchemaType::List types() const
Definition: qxsdschema.cpp:131

◆ resolveAttributeInheritance() [2/2]

void XsdSchemaResolver::resolveAttributeInheritance ( const XsdComplexType::Ptr complexType,
QSet< XsdComplexType::Ptr > &  visitedTypes 
)
private

Resolves the attribute inheritance of the given complex types.

Parameters
complexTypeThe complex type to resolve.
visitedTypesA set of already resolved types, used for termination of recursion.
Note
This method must be called after all base types have been resolved.

Definition at line 1440 of file qxsdschemaresolver.cpp.

1441 {
1442  if (visitedTypes.contains(complexType))
1443  return;
1444  else
1445  visitedTypes.insert(complexType);
1446 
1447  const SchemaType::Ptr baseType = complexType->wxsSuperType();
1448  Q_ASSERT(baseType);
1449 
1450  if (!(baseType->isComplexType()) || !baseType->isDefinedBySchema())
1451  return;
1452 
1453  const XsdComplexType::Ptr complexBaseType = baseType;
1454 
1455  resolveAttributeInheritance(complexBaseType, visitedTypes);
1456 
1457  // @see http://www.w3.org/TR/xmlschema11-1/#dcl.ctd.attuses
1458 
1459  // 1 and 2 (the attribute groups have been resolved here already)
1460  const XsdAttributeUse::List uses = complexBaseType->attributeUses();
1461 
1462  if (complexType->derivationMethod() == XsdComplexType::DerivationRestriction) { // 3.2
1463  const XsdAttributeUse::List currentUses = complexType->attributeUses();
1464 
1465  // 3.2.1 and 3.2.2 As we also keep the prohibited attributes as objects, the algorithm below
1466  // handles both the same way
1467 
1468  // add only these attribute uses of the base type that match one of the following criteria:
1469  // 1: there is no attribute use with the same name in type
1470  // 2: there is no attribute with the same name marked as prohibited in type
1471  for (int j = 0; j < uses.count(); ++j) {
1472  const XsdAttributeUse::Ptr use = uses.at(j);
1473  bool found = false;
1474  for (int k = 0; k < currentUses.count(); ++k) {
1475  if (use->attribute()->name(m_namePool) == currentUses.at(k)->attribute()->name(m_namePool)) {
1476  found = true;
1477 
1478  // check if prohibited usage is violated
1479  if ((use->useType() == XsdAttributeUse::ProhibitedUse) && (currentUses.at(k)->useType() != XsdAttributeUse::ProhibitedUse)) {
1480  m_context->error(QtXmlPatterns::tr("%1 attribute in %2 must have %3 use like in base type %4.")
1481  .arg(formatAttribute(use->attribute()->displayName(m_namePool)))
1482  .arg(formatType(m_namePool, complexType))
1483  .arg(formatData("prohibited"))
1484  .arg(formatType(m_namePool, complexBaseType)),
1486  return;
1487  }
1488 
1489  break;
1490  }
1491  }
1492 
1493  if (!found && uses.at(j)->useType() != XsdAttributeUse::ProhibitedUse) {
1494  complexType->addAttributeUse(uses.at(j));
1495  }
1496  }
1497  } else if (complexType->derivationMethod() == XsdComplexType::DerivationExtension) { // 3.1
1499 
1500  // fill hash with attribute uses of current type for faster lookup
1501  {
1502  const XsdAttributeUse::List attributeUses = complexType->attributeUses();
1503 
1504  for (int i = 0; i < attributeUses.count(); ++i) {
1505  availableUses.insert(attributeUses.at(i)->attribute()->name(m_namePool), attributeUses.at(i));
1506  }
1507  }
1508 
1509  // just add the attribute uses of the base type
1510  for (int i = 0; i < uses.count(); ++i) {
1511  const XsdAttributeUse::Ptr currentAttributeUse = uses.at(i);
1512 
1513  // if the base type defines the attribute as prohibited but we override it in current type, then don't copy the prohibited attribute use
1514  if ((currentAttributeUse->useType() == XsdAttributeUse::ProhibitedUse) && availableUses.contains(currentAttributeUse->attribute()->name(m_namePool)))
1515  continue;
1516 
1517  complexType->addAttributeUse(uses.at(i));
1518  }
1519  }
1520 
1521  // handle attribute wildcards: @see http://www.w3.org/TR/xmlschema11-1/#dcl.ctd.anyatt
1522 
1523  // 1
1524  const XsdWildcard::Ptr completeWildcard(complexType->attributeWildcard());
1525 
1527  if (complexType->wxsSuperType()->isComplexType() && complexType->wxsSuperType()->isDefinedBySchema()) {
1528  const XsdComplexType::Ptr complexBaseType(complexType->wxsSuperType());
1529  if (complexType->attributeWildcard()) {
1530  if (complexBaseType->attributeWildcard()) {
1531  if (!isValidWildcardRestriction(complexType->attributeWildcard(), complexBaseType->attributeWildcard())) {
1532  m_context->error(QtXmlPatterns::tr("Attribute wildcard of %1 is not a valid restriction of attribute wildcard of base type %2.")
1533  .arg(formatType(m_namePool, complexType))
1534  .arg(formatType(m_namePool, complexBaseType)),
1536  return;
1537  }
1538  } else {
1539  m_context->error(QtXmlPatterns::tr("%1 has attribute wildcard but its base type %2 has not.")
1540  .arg(formatType(m_namePool, complexType))
1541  .arg(formatType(m_namePool, complexBaseType)),
1543  return;
1544  }
1545  }
1546  }
1547  complexType->setAttributeWildcard(completeWildcard); // 2.1
1548  } else if (complexType->derivationMethod() == XsdComplexType::DerivationExtension) {
1549  XsdWildcard::Ptr baseWildcard; // 2.2.1
1550  if (complexType->wxsSuperType()->isComplexType() && complexType->wxsSuperType()->isDefinedBySchema())
1551  baseWildcard = XsdComplexType::Ptr(complexType->wxsSuperType())->attributeWildcard(); // 2.2.1.1
1552  else
1553  baseWildcard = XsdWildcard::Ptr(); // 2.2.1.2
1554 
1555  if (!baseWildcard) {
1556  complexType->setAttributeWildcard(completeWildcard); // 2.2.2.1
1557  } else if (!completeWildcard) {
1558  complexType->setAttributeWildcard(baseWildcard); // 2.2.2.2
1559  } else {
1560  XsdWildcard::Ptr unionWildcard = XsdSchemaHelper::wildcardUnion(completeWildcard, baseWildcard);
1561  if (unionWildcard) {
1562  unionWildcard->setProcessContents(completeWildcard->processContents());
1563  complexType->setAttributeWildcard(unionWildcard); // 2.2.2.3
1564  } else {
1565  m_context->error(QtXmlPatterns::tr("Union of attribute wildcard of type %1 and attribute wildcard of its base type %2 is not expressible.")
1566  .arg(formatType(m_namePool, complexType))
1567  .arg(formatType(m_namePool, complexBaseType)),
1569  return;
1570  }
1571  }
1572  }
1573 }
QString formatType(const NamePool::Ptr &np, const T &type)
Formats ItemType and SequenceType.
The attribute is not allowed to be there.
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
The QHash class is a template class that provides a hash-table-based dictionary.
Definition: qdatastream.h:66
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
bool contains(const Key &key) const
Returns true if the hash contains an item with the key; otherwise returns false.
Definition: qhash.h:872
QExplicitlySharedDataPointer< XsdSchemaContext > m_context
XsdAttributeUse::List attributeUses() const
XsdWildcard::Ptr attributeWildcard() const
void setProcessContents(ProcessContents contents)
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
virtual SchemaType::Ptr wxsSuperType() const
void error(const QString &message, const ReportContext::ErrorCode errorCode, const QSourceLocation &sourceLocation)
bool contains(const T &value) const
Definition: qset.h:91
virtual bool isComplexType() const
Definition: qschematype.cpp:70
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
const_iterator insert(const T &value)
Definition: qset.h:179
QSourceLocation sourceLocation(const NamedSchemaComponent::Ptr component) const
void addAttributeUse(const XsdAttributeUse::Ptr &use)
static QString formatData(const QString &data)
virtual DerivationMethod derivationMethod() const
QExplicitlySharedDataPointer< XsdWildcard > Ptr
void setAttributeWildcard(const XsdWildcard::Ptr &wildcard)
static XsdWildcard::Ptr wildcardUnion(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &otherWildcard)
static QString formatAttribute(const QString &attribute)
Formats attribute name.
virtual bool isDefinedBySchema() const
Definition: qschematype.cpp:75
bool isValidWildcardRestriction(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &baseWildcard)

◆ resolveAttributeTermReferences() [1/2]

void XsdSchemaResolver::resolveAttributeTermReferences ( )
private

Resolves all XsdAttributeReferences in the schema by their corresponding XsdAttributeUse objects.

Definition at line 1254 of file qxsdschemaresolver.cpp.

Referenced by resolve(), and resolveAttributeTermReferences().

1255 {
1256  // first all global attribute groups
1257  const XsdAttributeGroup::List attributeGroups = m_schema->attributeGroups();
1258  for (int i = 0; i < attributeGroups.count(); ++i) {
1259  XsdWildcard::Ptr wildcard = attributeGroups.at(i)->wildcard();
1260  const XsdAttributeUse::List uses = resolveAttributeTermReferences(attributeGroups.at(i)->attributeUses(), wildcard, QSet<QXmlName>());
1261  attributeGroups.at(i)->setAttributeUses(uses);
1262  attributeGroups.at(i)->setWildcard(wildcard);
1263  }
1264 
1265  // then the global complex types
1266  const SchemaType::List types = m_schema->types();
1267  for (int i = 0; i < types.count(); ++i) {
1268  if (!(types.at(i)->isComplexType()) || !types.at(i)->isDefinedBySchema())
1269  continue;
1270 
1271  const XsdComplexType::Ptr complexType = types.at(i);
1272  const XsdAttributeUse::List attributeUses = complexType->attributeUses();
1273 
1274  XsdWildcard::Ptr wildcard = complexType->attributeWildcard();
1275  const XsdAttributeUse::List uses = resolveAttributeTermReferences(attributeUses, wildcard, QSet<QXmlName>());
1276  complexType->setAttributeUses(uses);
1277  complexType->setAttributeWildcard(wildcard);
1278  }
1279 
1280  // and afterwards all anonymous complex types
1281  const SchemaType::List anonymousTypes = m_schema->anonymousTypes();
1282  for (int i = 0; i < anonymousTypes.count(); ++i) {
1283  if (!(anonymousTypes.at(i)->isComplexType()) || !anonymousTypes.at(i)->isDefinedBySchema())
1284  continue;
1285 
1286  const XsdComplexType::Ptr complexType = anonymousTypes.at(i);
1287  const XsdAttributeUse::List attributeUses = complexType->attributeUses();
1288 
1289  XsdWildcard::Ptr wildcard = complexType->attributeWildcard();
1290  const XsdAttributeUse::List uses = resolveAttributeTermReferences(attributeUses, wildcard, QSet<QXmlName>());
1291  complexType->setAttributeUses(uses);
1292  complexType->setAttributeWildcard(wildcard);
1293  }
1294 }
void setAttributeUses(const XsdAttributeUse::List &uses)
SchemaType::List anonymousTypes() const
Definition: qxsdschema.cpp:181
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
XsdAttributeUse::List attributeUses() const
XsdWildcard::Ptr attributeWildcard() const
virtual bool isComplexType() const
Definition: qschematype.cpp:70
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static const struct @32 types[]
void setAttributeWildcard(const XsdWildcard::Ptr &wildcard)
XsdAttributeGroup::List attributeGroups() const
Definition: qxsdschema.cpp:202
virtual bool isDefinedBySchema() const
Definition: qschematype.cpp:75
SchemaType::List types() const
Definition: qxsdschema.cpp:131
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ resolveAttributeTermReferences() [2/2]

XsdAttributeUse::List XsdSchemaResolver::resolveAttributeTermReferences ( const XsdAttributeUse::List attributeUses,
XsdWildcard::Ptr wildcard,
QSet< QXmlName visitedAttributeGroups 
)
private

Resolves all XsdAttributeReferences in the list of attributeUses by their corresponding XsdAttributeUse objects.

Definition at line 1296 of file qxsdschemaresolver.cpp.

1297 {
1298  XsdAttributeUse::List resolvedAttributeUses;
1299 
1300  for (int i = 0; i < attributeUses.count(); ++i) {
1301  const XsdAttributeUse::Ptr attributeUse = attributeUses.at(i);
1302  if (attributeUse->isAttributeUse()) {
1303  // it is a real attribute use, so no need to resolve it
1304  resolvedAttributeUses.append(attributeUse);
1305  } else if (attributeUse->isReference()) {
1306  // it is just a reference, so resolve it to the real attribute use
1307 
1308  const XsdAttributeReference::Ptr reference = attributeUse;
1309  if (reference->type() == XsdAttributeReference::AttributeUse) {
1310 
1311  // lookup the real attribute
1312  const XsdAttribute::Ptr attribute = m_schema->attribute(reference->referenceName());
1313  if (!attribute) {
1314  m_context->error(QtXmlPatterns::tr("Reference %1 of %2 element cannot be resolved.")
1315  .arg(formatKeyword(m_namePool, reference->referenceName()))
1316  .arg(formatElement("attribute")),
1317  XsdSchemaContext::XSDError, reference->sourceLocation());
1318  return XsdAttributeUse::List();
1319  }
1320 
1321  // if both, reference and definition have a fixed or default value set, then they must be equal
1322  if (attribute->valueConstraint() && attributeUse->valueConstraint()) {
1323  if (attribute->valueConstraint()->value() != attributeUse->valueConstraint()->value()) {
1324  m_context->error(QtXmlPatterns::tr("%1 or %2 attribute of reference %3 does not match with the attribute declaration %4.")
1325  .arg(formatAttribute("fixed"))
1326  .arg(formatAttribute("default"))
1327  .arg(formatKeyword(m_namePool, reference->referenceName()))
1328  .arg(formatKeyword(attribute->displayName(m_namePool))),
1329  XsdSchemaContext::XSDError, reference->sourceLocation());
1330  return XsdAttributeUse::List();
1331  }
1332  }
1333 
1334  attributeUse->setAttribute(attribute);
1335  if (!attributeUse->valueConstraint() && attribute->valueConstraint())
1336  attributeUse->setValueConstraint(XsdAttributeUse::ValueConstraint::fromAttributeValueConstraint(attribute->valueConstraint()));
1337 
1338  resolvedAttributeUses.append(attributeUse);
1339  } else if (reference->type() == XsdAttributeReference::AttributeGroup) {
1340  const XsdAttributeGroup::Ptr attributeGroup = m_schema->attributeGroup(reference->referenceName());
1341  if (!attributeGroup) {
1342  m_context->error(QtXmlPatterns::tr("Reference %1 of %2 element cannot be resolved.")
1343  .arg(formatKeyword(m_namePool, reference->referenceName()))
1344  .arg(formatElement("attributeGroup")),
1345  XsdSchemaContext::XSDError, reference->sourceLocation());
1346  return XsdAttributeUse::List();
1347  }
1348  if (visitedAttributeGroups.contains(attributeGroup->name(m_namePool))) {
1349  m_context->error(QtXmlPatterns::tr("Attribute group %1 has circular reference.").arg(formatKeyword(m_namePool, reference->referenceName())),
1350  XsdSchemaContext::XSDError, reference->sourceLocation());
1351  return XsdAttributeUse::List();
1352  } else {
1353  visitedAttributeGroups.insert(attributeGroup->name(m_namePool));
1354  }
1355 
1356  // resolve attribute wildcards as defined in http://www.w3.org/TR/xmlschema11-1/#declare-attributeGroup-wildcard
1357  XsdWildcard::Ptr childWildcard;
1358  resolvedAttributeUses << resolveAttributeTermReferences(attributeGroup->attributeUses(), childWildcard, visitedAttributeGroups);
1359  if (!childWildcard) {
1360  if (attributeGroup->wildcard()) {
1361  if (wildcard) {
1362  const XsdWildcard::ProcessContents contents = wildcard->processContents();
1363  wildcard = XsdSchemaHelper::wildcardIntersection(wildcard, attributeGroup->wildcard());
1364  wildcard->setProcessContents(contents);
1365  } else {
1366  wildcard = attributeGroup->wildcard();
1367  }
1368  }
1369  } else {
1370  XsdWildcard::Ptr newWildcard;
1371  if (attributeGroup->wildcard()) {
1372  const XsdWildcard::ProcessContents contents = attributeGroup->wildcard()->processContents();
1373  newWildcard = XsdSchemaHelper::wildcardIntersection(attributeGroup->wildcard(), childWildcard);
1374  newWildcard->setProcessContents(contents);
1375  } else {
1376  newWildcard = childWildcard;
1377  }
1378 
1379  if (wildcard) {
1380  const XsdWildcard::ProcessContents contents = wildcard->processContents();
1381  wildcard = XsdSchemaHelper::wildcardIntersection(wildcard, newWildcard);
1382  wildcard->setProcessContents(contents);
1383  } else {
1384  wildcard = newWildcard;
1385  }
1386  }
1387  }
1388  }
1389  }
1390 
1391  return resolvedAttributeUses;
1392 }
XsdAttributeGroup::Ptr attributeGroup(const QXmlName name) const
Definition: qxsdschema.cpp:195
static XsdWildcard::Ptr wildcardIntersection(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &otherWildcard)
QString formatKeyword(const QString &keyword)
ProcessContents processContents() const
XsdWildcard::Ptr wildcard() const
ValueConstraint::Ptr valueConstraint() const
The QExplicitlySharedDataPointer class represents a pointer to an explicitly shared object...
Definition: qshareddata.h:136
XsdAttributeUse::List attributeUses() const
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
The reference points to an attribute group.
static ValueConstraint::Ptr fromAttributeValueConstraint(const XsdAttribute::ValueConstraint::Ptr &constraint)
QExplicitlySharedDataPointer< XsdSchemaContext > m_context
void setProcessContents(ProcessContents contents)
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
void error(const QString &message, const ReportContext::ErrorCode errorCode, const QSourceLocation &sourceLocation)
static QString formatElement(const QString &element)
Formats element name.
bool contains(const T &value) const
Definition: qset.h:91
QList< XsdAttributeUse::Ptr > List
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
virtual QString displayName(const NamePool::Ptr &namePool) const
const_iterator insert(const T &value)
Definition: qset.h:179
virtual QXmlName name(const NamePool::Ptr &namePool) const
The reference points to an attribute use.
XsdAttribute::Ptr attribute(const QXmlName &name) const
Definition: qxsdschema.cpp:103
static QString formatAttribute(const QString &attribute)
Formats attribute name.

◆ resolveAttributeTypes()

void XsdSchemaResolver::resolveAttributeTypes ( )
private

Resolves attribute types.

Definition at line 945 of file qxsdschemaresolver.cpp.

Referenced by resolve().

946 {
947  for (int i = 0; i < m_attributeTypes.count(); ++i) {
948  const AttributeType item = m_attributeTypes.at(i);
949 
950  SchemaType::Ptr type = m_schema->type(item.typeName);
951  if (!type) {
952  // maybe it's a basic type...
953  type = m_context->schemaTypeFactory()->createSchemaType(item.typeName);
954  if (!type) {
955  m_context->error(QtXmlPatterns::tr("Type %1 of %2 element cannot be resolved.")
956  .arg(formatType(m_namePool, item.typeName))
957  .arg(formatElement("attribute")),
958  XsdSchemaContext::XSDError, item.location);
959  return;
960  }
961  }
962 
963  if (!type->isSimpleType() && type->category() != SchemaType::None) {
964  m_context->error(QtXmlPatterns::tr("Type of %1 element must be a simple type, %2 is not.")
965  .arg(formatElement("attribute"))
966  .arg(formatType(m_namePool, item.typeName)),
967  XsdSchemaContext::XSDError, item.location);
968  return;
969  }
970 
971  item.attribute->setType(type);
972  }
973 }
virtual TypeCategory category() const =0
int type
Definition: qmetatype.cpp:239
virtual bool isSimpleType() const
Definition: qschematype.cpp:56
QString formatType(const NamePool::Ptr &np, const T &type)
Formats ItemType and SequenceType.
QExplicitlySharedDataPointer< XsdSchemaContext > m_context
void error(const QString &message, const ReportContext::ErrorCode errorCode, const QSourceLocation &sourceLocation)
SchemaTypeFactory::Ptr schemaTypeFactory() const
static QString formatElement(const QString &element)
Formats element name.
SchemaType::Ptr type(const QXmlName &name) const
Definition: qxsdschema.cpp:124
virtual SchemaType::Ptr createSchemaType(const QXmlName name) const =0
QVector< AttributeType > m_attributeTypes

◆ resolveComplexBaseTypes()

void XsdSchemaResolver::resolveComplexBaseTypes ( )
private

Resolves base type of complex types.

Definition at line 552 of file qxsdschemaresolver.cpp.

Referenced by resolve().

553 {
554  for (int i = 0; i < m_complexBaseTypes.count(); ++i) {
555  const ComplexBaseType item = m_complexBaseTypes.at(i);
556 
557  SchemaType::Ptr type = m_schema->type(item.baseName);
558  if (!type) {
559  // maybe it's a basic type...
560  type = m_context->schemaTypeFactory()->createSchemaType(item.baseName);
561  if (!type) {
562  m_context->error(QtXmlPatterns::tr("Base type %1 of complex type cannot be resolved.").arg(formatType(m_namePool, item.baseName)), XsdSchemaContext::XSDError, item.location);
563  return;
564  }
565  }
566 
567  if (item.complexType->contentType()->variety() == XsdComplexType::ContentType::Simple) {
568  if (type->isComplexType() && type->isDefinedBySchema()) {
569  const XsdComplexType::Ptr baseType = type;
570  if (baseType->contentType()->variety() != XsdComplexType::ContentType::Simple) {
571  m_context->error(QtXmlPatterns::tr("%1 cannot have complex base type that has a %2.")
572  .arg(formatElement("simpleContent"))
573  .arg(formatElement("complexContent")),
574  XsdSchemaContext::XSDError, item.location);
575  return;
576  }
577  }
578  }
579 
580  item.complexType->setWxsSuperType(type);
581  }
582 }
int type
Definition: qmetatype.cpp:239
QString formatType(const NamePool::Ptr &np, const T &type)
Formats ItemType and SequenceType.
QVector< ComplexBaseType > m_complexBaseTypes
QExplicitlySharedDataPointer< XsdSchemaContext > m_context
ContentType::Ptr contentType() const
void error(const QString &message, const ReportContext::ErrorCode errorCode, const QSourceLocation &sourceLocation)
SchemaTypeFactory::Ptr schemaTypeFactory() const
static QString formatElement(const QString &element)
Formats element name.
virtual bool isComplexType() const
Definition: qschematype.cpp:70
SchemaType::Ptr type(const QXmlName &name) const
Definition: qxsdschema.cpp:124
The complex type has only simple type content (e.g. text, number etc.)
virtual SchemaType::Ptr createSchemaType(const QXmlName name) const =0
virtual bool isDefinedBySchema() const
Definition: qschematype.cpp:75

◆ resolveComplexContentComplexTypes() [1/2]

void XsdSchemaResolver::resolveComplexContentComplexTypes ( )
private

Resolves the complex content model of a complex type depending on its base type.

Definition at line 688 of file qxsdschemaresolver.cpp.

Referenced by resolve(), and resolveComplexContentComplexTypes().

689 {
690  XsdComplexType::List complexTypes;
691 
692  // first collect the global complex types
694  for (int i = 0; i < types.count(); ++i) {
695  if (types.at(i)->isComplexType() && types.at(i)->isDefinedBySchema())
696  complexTypes.append(types.at(i));
697  }
698 
699  // then collect all anonymous simple types
700  const SchemaType::List anonymousTypes = m_schema->anonymousTypes();
701  for (int i = 0; i < anonymousTypes.count(); ++i) {
702  if (anonymousTypes.at(i)->isComplexType() && anonymousTypes.at(i)->isDefinedBySchema())
703  complexTypes.append(anonymousTypes.at(i));
704  }
705 
706  QSet<XsdComplexType::Ptr> visitedTypes;
707  for (int i = 0; i < complexTypes.count(); ++i) {
708  if (XsdComplexType::Ptr(complexTypes.at(i))->contentType()->variety() != XsdComplexType::ContentType::Simple)
709  resolveComplexContentComplexTypes(complexTypes.at(i), visitedTypes);
710  }
711 }
SchemaType::List anonymousTypes() const
Definition: qxsdschema.cpp:181
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
virtual bool isComplexType() const
Definition: qschematype.cpp:70
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The complex type has only simple type content (e.g. text, number etc.)
static const struct @32 types[]
QList< SchemaType::Ptr > List
Definition: qschematype_p.h:84
virtual bool isDefinedBySchema() const
Definition: qschematype.cpp:75
SchemaType::List types() const
Definition: qxsdschema.cpp:131

◆ resolveComplexContentComplexTypes() [2/2]

void XsdSchemaResolver::resolveComplexContentComplexTypes ( const XsdComplexType::Ptr complexType,
QSet< XsdComplexType::Ptr > &  visitedTypes 
)
private

Resolves the complex content model of a complex type depending on its base type.

Parameters
complexTypeThe complex type to resolve.
visitedTypesA set of already resolved types, used for termination of recursion.

Definition at line 713 of file qxsdschemaresolver.cpp.

714 {
715  if (visitedTypes.contains(complexType))
716  return;
717  else
718  visitedTypes.insert(complexType);
719 
720  ComplexContentType item;
721  bool foundCorrespondingItem = false;
722  for (int i = 0; i < m_complexContentTypes.count(); ++i) {
723  if (m_complexContentTypes.at(i).complexType == complexType) {
724  item = m_complexContentTypes.at(i);
725  foundCorrespondingItem = true;
726  break;
727  }
728  }
729 
730  if (!foundCorrespondingItem)
731  return;
732 
733  const SchemaType::Ptr baseType = complexType->wxsSuperType();
734 
735  // at this point simple types have been resolved already, so we care about
736  // complex types here only
737  if (baseType->isComplexType() && baseType->isDefinedBySchema())
739 
740 
741  // @see http://www.w3.org/TR/xmlschema11-1/#dcl.ctd.ctcc.common
742 
743  // 3
744  XsdParticle::Ptr effectiveContent;
745  if (!item.explicitContent) { // 3.1
746  if (item.effectiveMixed == true) { // 3.1.1
747  const XsdParticle::Ptr particle(new XsdParticle());
748  particle->setMinimumOccurs(1);
749  particle->setMaximumOccurs(1);
750  particle->setMaximumOccursUnbounded(false);
751 
752  const XsdModelGroup::Ptr sequence(new XsdModelGroup());
753  sequence->setCompositor(XsdModelGroup::SequenceCompositor);
754  particle->setTerm(sequence);
755 
756  effectiveContent = particle;
757  } else { // 3.1.2
758  effectiveContent = XsdParticle::Ptr();
759  }
760  } else { // 3.2
761  effectiveContent = item.explicitContent;
762  }
763 
764  // 4
766  if (item.complexType->derivationMethod() == XsdComplexType::DerivationRestriction) { // 4.1
767  if (!effectiveContent) { // 4.1.1
768  explicitContentType->setVariety(XsdComplexType::ContentType::Empty);
769  } else { // 4.1.2
770  if (item.effectiveMixed == true)
771  explicitContentType->setVariety(XsdComplexType::ContentType::Mixed);
772  else
773  explicitContentType->setVariety(XsdComplexType::ContentType::ElementOnly);
774 
775  explicitContentType->setParticle(effectiveContent);
776  }
777  } else if (item.complexType->derivationMethod() == XsdComplexType::DerivationExtension) { // 4.2
778  const SchemaType::Ptr baseType = item.complexType->wxsSuperType();
779  if (baseType->isSimpleType() || (baseType->isComplexType() && baseType->isDefinedBySchema() && (XsdComplexType::Ptr(baseType)->contentType()->variety() == XsdComplexType::ContentType::Empty ||
780  XsdComplexType::Ptr(baseType)->contentType()->variety() == XsdComplexType::ContentType::Simple))) { // 4.2.1
781  if (!effectiveContent) {
782  explicitContentType->setVariety(XsdComplexType::ContentType::Empty);
783  } else {
784  if (item.effectiveMixed == true)
785  explicitContentType->setVariety(XsdComplexType::ContentType::Mixed);
786  else
787  explicitContentType->setVariety(XsdComplexType::ContentType::ElementOnly);
788 
789  explicitContentType->setParticle(effectiveContent);
790  }
791  } else if (baseType->isComplexType() && baseType->isDefinedBySchema() && (XsdComplexType::Ptr(baseType)->contentType()->variety() == XsdComplexType::ContentType::ElementOnly ||
792  XsdComplexType::Ptr(baseType)->contentType()->variety() == XsdComplexType::ContentType::Mixed) && !effectiveContent) { // 4.2.2
793  const XsdComplexType::Ptr complexBaseType(baseType);
794 
795  explicitContentType = complexBaseType->contentType();
796  } else { // 4.2.3
797  explicitContentType->setVariety(item.effectiveMixed ? XsdComplexType::ContentType::Mixed : XsdComplexType::ContentType::ElementOnly);
798 
799  XsdParticle::Ptr baseParticle;
800  if (baseType == BuiltinTypes::xsAnyType) {
801  // we need a workaround here, since the xsAnyType is no real (aka XsdComplexType) complex type...
802 
803  baseParticle = XsdParticle::Ptr(new XsdParticle());
804  baseParticle->setMinimumOccurs(1);
805  baseParticle->setMaximumOccurs(1);
806  baseParticle->setMaximumOccursUnbounded(false);
807 
808  const XsdModelGroup::Ptr group(new XsdModelGroup());
809  group->setCompositor(XsdModelGroup::SequenceCompositor);
810 
811  const XsdParticle::Ptr particle(new XsdParticle());
812  particle->setMinimumOccurs(0);
813  particle->setMaximumOccursUnbounded(true);
814 
815  const XsdWildcard::Ptr wildcard(new XsdWildcard());
816  wildcard->namespaceConstraint()->setVariety(XsdWildcard::NamespaceConstraint::Any);
817  wildcard->setProcessContents(XsdWildcard::Lax);
818 
819  particle->setTerm(wildcard);
820  XsdParticle::List particles;
821  particles.append(particle);
822  group->setParticles(particles);
823  baseParticle->setTerm(group);
824  } else {
825  const XsdComplexType::Ptr complexBaseType(baseType);
826  baseParticle = complexBaseType->contentType()->particle();
827  }
828  if (baseParticle && baseParticle->term()->isModelGroup() && (XsdModelGroup::Ptr(baseParticle->term())->compositor() == XsdModelGroup::AllCompositor) &&
829  (!item.explicitContent)) { // 4.2.3.1
830 
831  explicitContentType->setParticle(baseParticle);
832  } else if (baseParticle && baseParticle->term()->isModelGroup() && (XsdModelGroup::Ptr(baseParticle->term())->compositor() == XsdModelGroup::AllCompositor) &&
833  (effectiveContent->term()->isModelGroup() && (XsdModelGroup::Ptr(effectiveContent->term())->compositor() == XsdModelGroup::AllCompositor))) { // 4.2.3.2
834  const XsdParticle::Ptr particle(new XsdParticle());
835  particle->setMinimumOccurs(effectiveContent->minimumOccurs());
836  particle->setMaximumOccurs(1);
837  particle->setMaximumOccursUnbounded(false);
838 
839  const XsdModelGroup::Ptr group(new XsdModelGroup());
840  group->setCompositor(XsdModelGroup::AllCompositor);
841  XsdParticle::List particles = XsdModelGroup::Ptr(baseParticle->term())->particles();
842  particles << XsdModelGroup::Ptr(effectiveContent->term())->particles();
843  group->setParticles(particles);
844  particle->setTerm(group);
845 
846  explicitContentType->setParticle(particle);
847  } else { // 4.2.3.3
848  const XsdParticle::Ptr particle(new XsdParticle());
849  particle->setMinimumOccurs(1);
850  particle->setMaximumOccurs(1);
851  particle->setMaximumOccursUnbounded(false);
852 
853  const XsdModelGroup::Ptr group(new XsdModelGroup());
854  group->setCompositor(XsdModelGroup::SequenceCompositor);
855 
856  if (effectiveContent && effectiveContent->term()->isModelGroup() && XsdModelGroup::Ptr(effectiveContent->term())->compositor() == XsdModelGroup::AllCompositor) {
857  m_context->error(QtXmlPatterns::tr("Content model of complex type %1 contains %2 element, so it cannot be derived by extension from a non-empty type.")
858  .arg(formatType(m_namePool, complexType)).arg(formatKeyword("all")), XsdSchemaContext::XSDError, sourceLocation(complexType));
859  return;
860  }
861 
862  if (baseParticle && baseParticle->term()->isModelGroup() && XsdModelGroup::Ptr(baseParticle->term())->compositor() == XsdModelGroup::AllCompositor) {
863  m_context->error(QtXmlPatterns::tr("Complex type %1 cannot be derived by extension from %2 as the latter contains %3 element in its content model.")
864  .arg(formatType(m_namePool, complexType))
865  .arg(formatType(m_namePool, baseType))
866  .arg(formatKeyword("all")), XsdSchemaContext::XSDError, sourceLocation(complexType));
867  return;
868  }
869 
870  XsdParticle::List particles;
871  if (baseParticle)
872  particles << baseParticle;
873  if (effectiveContent)
874  particles << effectiveContent;
875  group->setParticles(particles);
876  particle->setTerm(group);
877 
878  explicitContentType->setParticle(particle);
879  }
880 
881  if (baseType->isDefinedBySchema()) { // xs:anyType has no open content
882  const XsdComplexType::Ptr complexBaseType(baseType);
883  explicitContentType->setOpenContent(complexBaseType->contentType()->openContent());
884  }
885  }
886  }
887 
888  // 5
889  XsdComplexType::OpenContent::Ptr wildcardElement;
890  if (item.complexType->contentType()->openContent()) { // 5.1
891  wildcardElement = item.complexType->contentType()->openContent();
892  } else {
893  if (m_defaultOpenContent) { // 5.2
894  if ((explicitContentType->variety() != XsdComplexType::ContentType::Empty) || // 5.2.1
895  (explicitContentType->variety() == XsdComplexType::ContentType::Empty && m_defaultOpenContentAppliesToEmpty)) { // 5.2.2
896  wildcardElement = m_defaultOpenContent;
897  }
898  }
899  }
900 
901  // 6
902  if (!wildcardElement) { // 6.1
903  item.complexType->setContentType(explicitContentType);
904  } else {
905  if (wildcardElement->mode() == XsdComplexType::OpenContent::None) { // 6.2
907  contentType->setVariety(explicitContentType->variety());
908  contentType->setParticle(explicitContentType->particle());
909 
910  item.complexType->setContentType(contentType);
911  } else { // 6.3
913 
914  if (explicitContentType->variety() == XsdComplexType::ContentType::Empty)
915  contentType->setVariety(XsdComplexType::ContentType::ElementOnly);
916  else
917  contentType->setVariety(explicitContentType->variety());
918 
919  if (explicitContentType->variety() == XsdComplexType::ContentType::Empty) {
920  const XsdParticle::Ptr particle(new XsdParticle());
921  particle->setMinimumOccurs(1);
922  particle->setMaximumOccurs(1);
923  const XsdModelGroup::Ptr sequence(new XsdModelGroup());
924  sequence->setCompositor(XsdModelGroup::SequenceCompositor);
925  particle->setTerm(sequence);
926  contentType->setParticle(particle);
927  } else {
928  contentType->setParticle(explicitContentType->particle());
929  }
930 
932  if (wildcardElement)
933  openContent->setMode(wildcardElement->mode());
934  else
935  openContent->setMode(XsdComplexType::OpenContent::Interleave);
936 
937  if (wildcardElement)
938  openContent->setWildcard(wildcardElement->wildcard());
939 
940  item.complexType->setContentType(contentType);
941  }
942  }
943 }
Describes the content type of a complex type.
The complex type has further elements or attributes and text as content.
Represents a XSD model group object.
virtual bool isSimpleType() const
Definition: qschematype.cpp:56
QString formatKeyword(const QString &keyword)
QString formatType(const NamePool::Ptr &np, const T &type)
Formats ItemType and SequenceType.
XsdTerm::Ptr term() const
The model group contains elements only.
XsdComplexType::OpenContent::Ptr m_defaultOpenContent
Represents a XSD wildcard object.
void setMinimumOccurs(unsigned int occurrence)
QExplicitlySharedDataPointer< XsdSchemaContext > m_context
ContentType::Ptr contentType() const
void setMaximumOccurs(unsigned int occurrence)
virtual SchemaType::Ptr wxsSuperType() const
static const SchemaType::Ptr xsAnyType
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
void error(const QString &message, const ReportContext::ErrorCode errorCode, const QSourceLocation &sourceLocation)
unsigned int minimumOccurs() const
bool contains(const T &value) const
Definition: qset.h:91
virtual bool isComplexType() const
Definition: qschematype.cpp:70
Represents a XSD particle object.
const_iterator insert(const T &value)
Definition: qset.h:179
QSourceLocation sourceLocation(const NamedSchemaComponent::Ptr component) const
QExplicitlySharedDataPointer< XsdModelGroup > Ptr
QExplicitlySharedDataPointer< XsdParticle > Ptr
void setTerm(const XsdTerm::Ptr &term)
The complex type has only simple type content (e.g. text, number etc.)
virtual bool isModelGroup() const
Definition: qxsdterm.cpp:53
QExplicitlySharedDataPointer< XsdComplexType > Ptr
If the item has a uniquely determined declaration available, it must be valid with respect to that de...
QVector< ComplexContentType > m_complexContentTypes
virtual bool isDefinedBySchema() const
Definition: qschematype.cpp:75
The complex type has further elements or attributes but no text as content.
virtual SchemaType::Ptr wxsSuperType() const =0
The complex type has no further content.
Describes the open content object of a complex type.
void setMaximumOccursUnbounded(bool unbounded)

◆ resolveElementTypes()

void XsdSchemaResolver::resolveElementTypes ( )
private

Resolves element types.

Definition at line 530 of file qxsdschemaresolver.cpp.

Referenced by resolve().

531 {
532  for (int i = 0; i < m_elementTypes.count(); ++i) {
533  const ElementType item = m_elementTypes.at(i);
534 
535  SchemaType::Ptr type = m_schema->type(item.typeName);
536  if (!type) {
537  // maybe it's a basic type...
538  type = m_context->schemaTypeFactory()->createSchemaType(item.typeName);
539  if (!type) {
540  m_context->error(QtXmlPatterns::tr("Type %1 of %2 element cannot be resolved.")
541  .arg(formatType(m_namePool, item.typeName))
542  .arg(formatElement("element")),
543  XsdSchemaContext::XSDError, item.location);
544  return;
545  }
546  }
547 
548  item.element->setType(type);
549  }
550 }
QVector< ElementType > m_elementTypes
int type
Definition: qmetatype.cpp:239
QString formatType(const NamePool::Ptr &np, const T &type)
Formats ItemType and SequenceType.
QExplicitlySharedDataPointer< XsdSchemaContext > m_context
void error(const QString &message, const ReportContext::ErrorCode errorCode, const QSourceLocation &sourceLocation)
SchemaTypeFactory::Ptr schemaTypeFactory() const
static QString formatElement(const QString &element)
Formats element name.
SchemaType::Ptr type(const QXmlName &name) const
Definition: qxsdschema.cpp:124
virtual SchemaType::Ptr createSchemaType(const QXmlName name) const =0

◆ resolveEnumerationFacetValues()

void XsdSchemaResolver::resolveEnumerationFacetValues ( )
private

Resolves the enumeration facet values for QName and NOTATION based facets.

Definition at line 1575 of file qxsdschemaresolver.cpp.

Referenced by resolve().

1576 {
1577  XsdSimpleType::List simpleTypes;
1578 
1579  // first collect the global simple types
1580  const SchemaType::List types = m_schema->types();
1581  for (int i = 0; i < types.count(); ++i) {
1582  if (types.at(i)->isSimpleType())
1583  simpleTypes.append(types.at(i));
1584  }
1585 
1586  // then collect all anonymous simple types
1587  const SchemaType::List anonymousTypes = m_schema->anonymousTypes();
1588  for (int i = 0; i < anonymousTypes.count(); ++i) {
1589  if (anonymousTypes.at(i)->isSimpleType())
1590  simpleTypes.append(anonymousTypes.at(i));
1591  }
1592  // process all simple types
1593  for (int i = 0; i < simpleTypes.count(); ++i) {
1594  const XsdSimpleType::Ptr simpleType = simpleTypes.at(i);
1595 
1596  // we resolve the enumeration values only for xs:QName and xs:NOTATION based types
1597  if (BuiltinTypes::xsQName->wxsTypeMatches(simpleType) ||
1599  const XsdFacet::Hash facets = simpleType->facets();
1600  if (facets.contains(XsdFacet::Enumeration)) {
1601  AtomicValue::List newValues;
1602 
1603  const XsdFacet::Ptr facet = facets.value(XsdFacet::Enumeration);
1604  const AtomicValue::List values = facet->multiValue();
1605  for (int j = 0; j < values.count(); ++j) {
1606  const AtomicValue::Ptr value = values.at(j);
1607 
1608  Q_ASSERT(m_enumerationFacetValues.contains(value));
1609  const NamespaceSupport support( m_enumerationFacetValues.value(value) );
1610 
1611  const QString qualifiedName = value->as<DerivedString<TypeString> >()->stringValue();
1612  if (!XPathHelper::isQName(qualifiedName)) {
1613  m_context->error(QtXmlPatterns::tr("Enumeration facet contains invalid content: {%1} is not a value of type %2.")
1614  .arg(formatData(qualifiedName))
1617  return;
1618  }
1619 
1620  QXmlName qNameValue;
1621  bool result = support.processName(qualifiedName, NamespaceSupport::ElementName, qNameValue);
1622  if (!result) {
1623  m_context->error(QtXmlPatterns::tr("Namespace prefix of qualified name %1 is not defined.").arg(formatData(qualifiedName)),
1625  return;
1626  }
1627 
1628  newValues.append(QNameValue::fromValue(m_namePool, qNameValue));
1629  }
1630  facet->setMultiValue(newValues);
1631  }
1632  }
1633  }
1634 }
QHash< AtomicValue::Ptr, NamespaceSupport > m_enumerationFacetValues
virtual bool isSimpleType() const
Definition: qschematype.cpp:56
QString formatType(const NamePool::Ptr &np, const T &type)
Formats ItemType and SequenceType.
SchemaType::List anonymousTypes() const
Definition: qxsdschema.cpp:181
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
bool contains(const Key &key) const
Returns true if the hash contains an item with the key; otherwise returns false.
Definition: qhash.h:872
static QByteArray qualifiedName(const QMetaEnum &e)
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
QExplicitlySharedDataPointer< XsdSchemaContext > m_context
Match an enumeration (Enumeration Definition)
Definition: qxsdfacet_p.h:115
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
const TCastTarget * as() const
void error(const QString &message, const ReportContext::ErrorCode errorCode, const QSourceLocation &sourceLocation)
static QNameValue::Ptr fromValue(const NamePool::Ptr &np, const QXmlName name)
Definition: qqnamevalue.cpp:59
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QSourceLocation sourceLocation(const NamedSchemaComponent::Ptr component) const
quint16 values[128]
static QString formatData(const QString &data)
A helper class for handling nested namespace declarations.
Represents instances of derived xs:string types, such as xs:normalizedString.
The QXmlName class represents the name of an XML node, in an efficient, namespace-aware way...
Definition: qxmlname.h:58
QList< AnySimpleType::Ptr > List
static const AtomicType::Ptr xsQName
static const struct @32 types[]
static bool wxsTypeMatches(const SchemaType::Ptr &type, const SchemaType::Ptr &otherType, QSet< SchemaType::Ptr > &visitedTypes, SchemaType::Ptr &conflictingType)
XsdFacet::Hash facets() const
static bool isQName(const QString &qName)
SchemaType::List types() const
Definition: qxsdschema.cpp:131
static const AtomicType::Ptr xsNOTATION

◆ resolveKeyReferences()

void XsdSchemaResolver::resolveKeyReferences ( )
private

Resolves key references.

Definition at line 347 of file qxsdschemaresolver.cpp.

Referenced by resolve().

348 {
349  for (int i = 0; i < m_keyReferences.count(); ++i) {
350  const KeyReference ref = m_keyReferences.at(i);
351 
352  const XsdIdentityConstraint::Ptr constraint = m_schema->identityConstraint(ref.reference);
353  if (!constraint) {
354  m_context->error(QtXmlPatterns::tr("%1 references unknown %2 or %3 element %4.")
355  .arg(formatKeyword(ref.keyRef->displayName(m_namePool)))
356  .arg(formatElement("key"))
357  .arg(formatElement("unique"))
358  .arg(formatKeyword(m_namePool, ref.reference)),
359  XsdSchemaContext::XSDError, ref.location);
360  return;
361  }
362 
363  if (constraint->category() != XsdIdentityConstraint::Key && constraint->category() != XsdIdentityConstraint::Unique) { // only key and unique can be referenced
364  m_context->error(QtXmlPatterns::tr("%1 references identity constraint %2 that is no %3 or %4 element.")
365  .arg(formatKeyword(ref.keyRef->displayName(m_namePool)))
366  .arg(formatKeyword(m_namePool, ref.reference))
367  .arg(formatElement("key"))
368  .arg(formatElement("unique")),
369  XsdSchemaContext::XSDError, ref.location);
370  return;
371  }
372 
373  if (constraint->fields().count() != ref.keyRef->fields().count()) {
374  m_context->error(QtXmlPatterns::tr("%1 has a different number of fields from the identity constraint %2 that it references.")
375  .arg(formatKeyword(ref.keyRef->displayName(m_namePool)))
376  .arg(formatKeyword(m_namePool, ref.reference)),
377  XsdSchemaContext::XSDError, ref.location);
378  return;
379  }
380 
381  ref.keyRef->setReferencedKey(constraint);
382  }
383 }
QAtomicInt ref
Definition: qshareddata.h:59
QString formatKeyword(const QString &keyword)
XsdIdentityConstraint::Ptr identityConstraint(const QXmlName &name) const
Definition: qxsdschema.cpp:258
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
QExplicitlySharedDataPointer< XsdSchemaContext > m_context
void error(const QString &message, const ReportContext::ErrorCode errorCode, const QSourceLocation &sourceLocation)
static QString formatElement(const QString &element)
Formats element name.
XsdXPathExpression::List fields() const
QVector< KeyReference > m_keyReferences
The constraint is an unique constraint.
The constraint is a key constraint.

◆ resolveSimpleContentComplexTypes() [1/2]

void XsdSchemaResolver::resolveSimpleContentComplexTypes ( )
private

Resolves the simple content model of a complex type depending on its base type.

Definition at line 584 of file qxsdschemaresolver.cpp.

Referenced by resolve(), and resolveSimpleContentComplexTypes().

585 {
586  XsdComplexType::List complexTypes;
587 
588  // first collect the global complex types
590  for (int i = 0; i < types.count(); ++i) {
591  if (types.at(i)->isComplexType() && types.at(i)->isDefinedBySchema())
592  complexTypes.append(types.at(i));
593  }
594 
595  // then collect all anonymous simple types
596  const SchemaType::List anonymousTypes = m_schema->anonymousTypes();
597  for (int i = 0; i < anonymousTypes.count(); ++i) {
598  if (anonymousTypes.at(i)->isComplexType() && anonymousTypes.at(i)->isDefinedBySchema())
599  complexTypes.append(anonymousTypes.at(i));
600  }
601 
602  QSet<XsdComplexType::Ptr> visitedTypes;
603  for (int i = 0; i < complexTypes.count(); ++i) {
604  if (XsdComplexType::Ptr(complexTypes.at(i))->contentType()->variety() == XsdComplexType::ContentType::Simple)
605  resolveSimpleContentComplexTypes(complexTypes.at(i), visitedTypes);
606  }
607 }
SchemaType::List anonymousTypes() const
Definition: qxsdschema.cpp:181
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
virtual bool isComplexType() const
Definition: qschematype.cpp:70
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The complex type has only simple type content (e.g. text, number etc.)
static const struct @32 types[]
QList< SchemaType::Ptr > List
Definition: qschematype_p.h:84
virtual bool isDefinedBySchema() const
Definition: qschematype.cpp:75
SchemaType::List types() const
Definition: qxsdschema.cpp:131

◆ resolveSimpleContentComplexTypes() [2/2]

void XsdSchemaResolver::resolveSimpleContentComplexTypes ( const XsdComplexType::Ptr complexType,
QSet< XsdComplexType::Ptr > &  visitedTypes 
)
private

Resolves the simple content model of a complex type depending on its base type.

Parameters
complexTypeThe complex type to resolve.
visitedTypesA set of already resolved types, used for termination of recursion.

Definition at line 609 of file qxsdschemaresolver.cpp.

610 {
611  if (visitedTypes.contains(complexType))
612  return;
613  else
614  visitedTypes.insert(complexType);
615 
616  const SchemaType::Ptr baseType = complexType->wxsSuperType();
617 
618  // at this point simple types have been resolved already, so we care about
619  // complex types here only
620 
621  // http://www.w3.org/TR/xmlschema11-1/#dcl.ctd.ctsc
622  // 1
623  if (baseType->isComplexType() && baseType->isDefinedBySchema()) {
624  const XsdComplexType::Ptr complexBaseType = baseType;
625 
626  resolveSimpleContentComplexTypes(complexBaseType, visitedTypes);
627 
628  if (complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Simple) {
630  if (complexType->contentType()->simpleType()) {
631  // 1.1 contains the content of the <simpleType> already
632  } else {
633  // 1.2
634  const XsdSimpleType::Ptr anonType(new XsdSimpleType());
635  XsdSimpleType::TypeCategory baseCategory = complexBaseType->contentType()->simpleType()->category();
636  anonType->setCategory(baseCategory);
637 
638  if (baseCategory == XsdSimpleType::SimpleTypeList) {
639  const XsdSimpleType::Ptr baseSimpleType = complexBaseType->contentType()->simpleType();
640  anonType->setItemType(baseSimpleType->itemType());
641  }
642 
643  anonType->setDerivationMethod(XsdSimpleType::DerivationRestriction);
644  anonType->setWxsSuperType(complexBaseType->contentType()->simpleType());
645  anonType->setFacets(complexTypeFacets(complexType));
646 
647  QSet<AnySimpleType::Ptr> visitedPrimitiveTypes;
648  const AnySimpleType::Ptr primitiveType = findPrimitiveType(anonType->wxsSuperType(), visitedPrimitiveTypes);
649  anonType->setPrimitiveType(primitiveType);
650 
651  complexType->contentType()->setSimpleType(anonType);
652 
653  m_schema->addAnonymousType(anonType);
655  }
656  } else if (complexBaseType->derivationMethod() == XsdComplexType::DerivationExtension) { // 3
657  complexType->contentType()->setSimpleType(complexBaseType->contentType()->simpleType());
658  }
659  } else if (complexBaseType->contentType()->variety() == XsdComplexType::ContentType::Mixed &&
661  XsdSchemaHelper::isParticleEmptiable(complexBaseType->contentType()->particle())) { // 2
662  // simple type was already set in parser
663 
664  const XsdSimpleType::Ptr anonType(new XsdSimpleType());
665  anonType->setCategory(complexType->contentType()->simpleType()->category());
666  anonType->setDerivationMethod(XsdSimpleType::DerivationRestriction);
667  anonType->setWxsSuperType(complexType->contentType()->simpleType());
668  anonType->setFacets(complexTypeFacets(complexType));
669 
670  QSet<AnySimpleType::Ptr> visitedPrimitiveTypes;
671  const AnySimpleType::Ptr primitiveType = findPrimitiveType(anonType->wxsSuperType(), visitedPrimitiveTypes);
672  anonType->setPrimitiveType(primitiveType);
673 
674  complexType->contentType()->setSimpleType(anonType);
675 
676  m_schema->addAnonymousType(anonType);
678  } else {
679  complexType->contentType()->setSimpleType(BuiltinTypes::xsAnySimpleType);
680  }
681  } else if (baseType->isSimpleType()) { // 4
682  complexType->contentType()->setSimpleType(baseType);
683  } else { // 5
684  complexType->contentType()->setSimpleType(BuiltinTypes::xsAnySimpleType);
685  }
686 }
The complex type has further elements or attributes and text as content.
Represents a XSD simpleType object.
virtual bool isSimpleType() const
Definition: qschematype.cpp:56
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
ContentType::Ptr contentType() const
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
virtual SchemaType::Ptr wxsSuperType() const
QHash< NamedSchemaComponent::Ptr, QSourceLocation > m_componentLocationHash
bool contains(const T &value) const
Definition: qset.h:91
virtual bool isComplexType() const
Definition: qschematype.cpp:70
XsdFacet::Hash complexTypeFacets(const XsdComplexType::Ptr &complexType) const
const_iterator insert(const T &value)
Definition: qset.h:179
The complex type has only simple type content (e.g. text, number etc.)
virtual DerivationMethod derivationMethod() const
void addAnonymousType(const SchemaType::Ptr &type)
Definition: qxsdschema.cpp:168
static const SchemaType::Ptr xsAnySimpleType
AnySimpleType::Ptr findPrimitiveType(const AnySimpleType::Ptr &type, QSet< AnySimpleType::Ptr > &visitedTypes)
static bool isParticleEmptiable(const XsdParticle::Ptr &particle)
virtual bool isDefinedBySchema() const
Definition: qschematype.cpp:75
AnySimpleType::Ptr itemType() const

◆ resolveSimpleListType()

void XsdSchemaResolver::resolveSimpleListType ( )
private

Resolves the item type property of simple types derived by list.

Definition at line 469 of file qxsdschemaresolver.cpp.

Referenced by resolve().

470 {
471  // iterate over all simple types where the item type shall be resolved
472  for (int i = 0; i < m_simpleListTypes.count(); ++i) {
473  const SimpleListType item = m_simpleListTypes.at(i);
474 
475  // try to resolve the name
476  SchemaType::Ptr type = m_schema->type(item.typeName);
477  if (!type) {
478  // maybe it's a basic type...
479  type = m_context->schemaTypeFactory()->createSchemaType(item.typeName);
480  if (!type) {
481  m_context->error(QtXmlPatterns::tr("Item type %1 of %2 element cannot be resolved.")
482  .arg(formatType(m_namePool, item.typeName))
483  .arg(formatElement("list")),
484  XsdSchemaContext::XSDError, item.location);
485  return;
486  }
487  }
488 
489  item.simpleType->setItemType(type);
490  }
491 }
int type
Definition: qmetatype.cpp:239
QVector< SimpleListType > m_simpleListTypes
QString formatType(const NamePool::Ptr &np, const T &type)
Formats ItemType and SequenceType.
QExplicitlySharedDataPointer< XsdSchemaContext > m_context
void error(const QString &message, const ReportContext::ErrorCode errorCode, const QSourceLocation &sourceLocation)
SchemaTypeFactory::Ptr schemaTypeFactory() const
static QString formatElement(const QString &element)
Formats element name.
SchemaType::Ptr type(const QXmlName &name) const
Definition: qxsdschema.cpp:124
virtual SchemaType::Ptr createSchemaType(const QXmlName name) const =0

◆ resolveSimpleRestrictionBaseTypes()

void XsdSchemaResolver::resolveSimpleRestrictionBaseTypes ( )
private

Resolves the base types of simple types derived by restriction.

Definition at line 385 of file qxsdschemaresolver.cpp.

Referenced by resolve().

386 {
387  // iterate over all simple types that are derived by restriction
388  for (int i = 0; i < m_simpleRestrictionBases.count(); ++i) {
389  const SimpleRestrictionBase item = m_simpleRestrictionBases.at(i);
390 
391  // find the base type
392  SchemaType::Ptr type = m_schema->type(item.baseName);
393  if (!type) {
394  // maybe it's a basic type...
395  type = m_context->schemaTypeFactory()->createSchemaType(item.baseName);
396  if (!type) {
397  m_context->error(QtXmlPatterns::tr("Base type %1 of %2 element cannot be resolved.")
398  .arg(formatType(m_namePool, item.baseName))
399  .arg(formatElement("restriction")),
400  XsdSchemaContext::XSDError, item.location);
401  return;
402  }
403  }
404 
405  item.simpleType->setWxsSuperType(type);
406  }
407 }
int type
Definition: qmetatype.cpp:239
QString formatType(const NamePool::Ptr &np, const T &type)
Formats ItemType and SequenceType.
QVector< SimpleRestrictionBase > m_simpleRestrictionBases
QExplicitlySharedDataPointer< XsdSchemaContext > m_context
void error(const QString &message, const ReportContext::ErrorCode errorCode, const QSourceLocation &sourceLocation)
SchemaTypeFactory::Ptr schemaTypeFactory() const
static QString formatElement(const QString &element)
Formats element name.
SchemaType::Ptr type(const QXmlName &name) const
Definition: qxsdschema.cpp:124
virtual SchemaType::Ptr createSchemaType(const QXmlName name) const =0

◆ resolveSimpleRestrictions() [1/2]

void XsdSchemaResolver::resolveSimpleRestrictions ( )
private

Resolves the other properties except the base type of all simple restrictions.

Definition at line 409 of file qxsdschemaresolver.cpp.

Referenced by resolve(), and resolveSimpleRestrictions().

410 {
411  XsdSimpleType::List simpleTypes;
412 
413  // first collect the global simple types
415  for (int i = 0; i < types.count(); ++i) {
416  if (types.at(i)->isSimpleType() && (types.at(i)->derivationMethod() == SchemaType::DerivationRestriction))
417  simpleTypes.append(types.at(i));
418  }
419 
420  // then collect all anonymous simple types
421  const SchemaType::List anonymousTypes = m_schema->anonymousTypes();
422  for (int i = 0; i < anonymousTypes.count(); ++i) {
423  if (anonymousTypes.at(i)->isSimpleType() && (anonymousTypes.at(i)->derivationMethod() == SchemaType::DerivationRestriction))
424  simpleTypes.append(anonymousTypes.at(i));
425  }
426 
427  QSet<XsdSimpleType::Ptr> visitedTypes;
428  for (int i = 0; i < simpleTypes.count(); ++i) {
429  resolveSimpleRestrictions(simpleTypes.at(i), visitedTypes);
430  }
431 }
virtual bool isSimpleType() const
Definition: qschematype.cpp:56
SchemaType::List anonymousTypes() const
Definition: qxsdschema.cpp:181
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QList< AnySimpleType::Ptr > List
static const struct @32 types[]
virtual DerivationMethod derivationMethod() const =0
SchemaType::List types() const
Definition: qxsdschema.cpp:131

◆ resolveSimpleRestrictions() [2/2]

void XsdSchemaResolver::resolveSimpleRestrictions ( const XsdSimpleType::Ptr simpleType,
QSet< XsdSimpleType::Ptr > &  visitedTypes 
)
private

Resolves the other properties except the base type of the given simple restriction.

Parameters
simpleTypeThe restricted type to resolve.
visitedTypesA set of already resolved types, used for termination of recursion.

Definition at line 433 of file qxsdschemaresolver.cpp.

434 {
435  if (visitedTypes.contains(simpleType))
436  return;
437  else
438  visitedTypes.insert(simpleType);
439 
441  return;
442 
443  // as xs:NMTOKENS, xs:ENTITIES and xs:IDREFS are provided by our XsdSchemaTypesFactory, they are
444  // setup correctly already and shouldn't be handled here
445  if (m_predefinedSchemaTypes.contains(simpleType))
446  return;
447 
448  const SchemaType::Ptr baseType = simpleType->wxsSuperType();
449  Q_ASSERT(baseType);
450 
451  if (baseType->isDefinedBySchema())
452  resolveSimpleRestrictions(XsdSimpleType::Ptr(baseType), visitedTypes);
453 
454  simpleType->setCategory(baseType->category());
455 
456  if (simpleType->category() == XsdSimpleType::SimpleTypeAtomic) {
457  QSet<AnySimpleType::Ptr> visitedPrimitiveTypes;
458  const AnySimpleType::Ptr primitiveType = findPrimitiveType(baseType, visitedPrimitiveTypes);
459  simpleType->setPrimitiveType(primitiveType);
460  } else if (simpleType->category() == XsdSimpleType::SimpleTypeList) {
461  const XsdSimpleType::Ptr simpleBaseType = baseType;
462  simpleType->setItemType(simpleBaseType->itemType());
463  } else if (simpleType->category() == XsdSimpleType::SimpleTypeUnion) {
464  const XsdSimpleType::Ptr simpleBaseType = baseType;
465  simpleType->setMemberTypes(simpleBaseType->memberTypes());
466  }
467 }
virtual DerivationMethod derivationMethod() const
virtual TypeCategory category() const =0
virtual TypeCategory category() const
void setItemType(const AnySimpleType::Ptr &type)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
virtual SchemaType::Ptr wxsSuperType() const
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
Definition: qlist.h:880
bool contains(const T &value) const
Definition: qset.h:91
const_iterator insert(const T &value)
Definition: qset.h:179
void setMemberTypes(const AnySimpleType::List &types)
void setPrimitiveType(const AnySimpleType::Ptr &type)
void setCategory(TypeCategory category)
AnySimpleType::Ptr findPrimitiveType(const AnySimpleType::Ptr &type, QSet< AnySimpleType::Ptr > &visitedTypes)
AnySimpleType::List memberTypes() const
virtual bool isDefinedBySchema() const
Definition: qschematype.cpp:75
AnySimpleType::Ptr itemType() const

◆ resolveSimpleUnionTypes()

void XsdSchemaResolver::resolveSimpleUnionTypes ( )
private

Resolves the member types property of simple types derived by union.

Definition at line 493 of file qxsdschemaresolver.cpp.

Referenced by resolve().

494 {
495  // iterate over all simple types where the union member types shall be resolved
496  for (int i = 0; i < m_simpleUnionTypes.count(); ++i) {
497  const SimpleUnionType item = m_simpleUnionTypes.at(i);
498 
499  AnySimpleType::List memberTypes;
500 
501  // iterate over all union member type names
502  const QList<QXmlName> typeNames = item.typeNames;
503  for (int j = 0; j < typeNames.count(); ++j) {
504  const QXmlName typeName = typeNames.at(j);
505 
506  // try to resolve the name
507  SchemaType::Ptr type = m_schema->type(typeName);
508  if (!type) {
509  // maybe it's a basic type...
510  type = m_context->schemaTypeFactory()->createSchemaType(typeName);
511  if (!type) {
512  m_context->error(QtXmlPatterns::tr("Member type %1 of %2 element cannot be resolved.")
513  .arg(formatType(m_namePool, typeName))
514  .arg(formatElement("union")),
515  XsdSchemaContext::XSDError, item.location);
516  return;
517  }
518  }
519 
520  memberTypes.append(type);
521  }
522 
523  // append the types that have been defined as <simpleType> children
524  memberTypes << item.simpleType->memberTypes();
525 
526  item.simpleType->setMemberTypes(memberTypes);
527  }
528 }
int type
Definition: qmetatype.cpp:239
QString formatType(const NamePool::Ptr &np, const T &type)
Formats ItemType and SequenceType.
QVector< SimpleUnionType > m_simpleUnionTypes
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
QExplicitlySharedDataPointer< XsdSchemaContext > m_context
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
void error(const QString &message, const ReportContext::ErrorCode errorCode, const QSourceLocation &sourceLocation)
SchemaTypeFactory::Ptr schemaTypeFactory() const
static QString formatElement(const QString &element)
Formats element name.
const char * typeName
Definition: qmetatype.cpp:239
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
SchemaType::Ptr type(const QXmlName &name) const
Definition: qxsdschema.cpp:124
The QXmlName class represents the name of an XML node, in an efficient, namespace-aware way...
Definition: qxmlname.h:58
virtual SchemaType::Ptr createSchemaType(const QXmlName name) const =0

◆ resolveSubstitutionGroupAffiliations()

void XsdSchemaResolver::resolveSubstitutionGroupAffiliations ( )
private

Resolves substitution group affiliations.

Definition at line 1017 of file qxsdschemaresolver.cpp.

Referenced by resolve().

1018 {
1019  for (int i = 0; i < m_substitutionGroupAffiliations.count(); ++i) {
1020  const SubstitutionGroupAffiliation item = m_substitutionGroupAffiliations.at(i);
1021 
1022  XsdElement::List affiliations;
1023  for (int j = 0; j < item.elementNames.count(); ++j) {
1024  const XsdElement::Ptr element = m_schema->element(item.elementNames.at(j));
1025  if (!element) {
1026  m_context->error(QtXmlPatterns::tr("Substitution group %1 of %2 element cannot be resolved.")
1027  .arg(formatKeyword(m_namePool, item.elementNames.at(j)))
1028  .arg(formatElement("element")),
1029  XsdSchemaContext::XSDError, item.location);
1030  return;
1031  }
1032 
1033  // @see http://www.w3.org/TR/xmlschema11-1/#e-props-correct 5)
1034  if (hasCircularSubstitutionGroup(element, item.element, m_namePool)) {
1035  m_context->error(QtXmlPatterns::tr("Substitution group %1 has circular definition.").arg(formatKeyword(m_namePool, item.elementNames.at(j))), XsdSchemaContext::XSDError, item.location);
1036  return;
1037  }
1038 
1039  affiliations.append(element);
1040  }
1041 
1042  item.element->setSubstitutionGroupAffiliations(affiliations);
1043  }
1044 
1045  for (int i = 0; i < m_substitutionGroupTypes.count(); ++i) {
1046  const XsdElement::Ptr element = m_substitutionGroupTypes.at(i);
1047  element->setType(element->substitutionGroupAffiliations().first()->type());
1048  }
1049 }
XsdElement::Ptr element(const QXmlName &name) const
Definition: qxsdschema.cpp:82
QString formatKeyword(const QString &keyword)
XsdElement::List substitutionGroupAffiliations() const
bool hasCircularSubstitutionGroup(const XsdElement::Ptr &current, const XsdElement::Ptr &head, const NamePool::Ptr &namePool)
QExplicitlySharedDataPointer< XsdSchemaContext > m_context
SchemaType::Ptr type() const
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
void error(const QString &message, const ReportContext::ErrorCode errorCode, const QSourceLocation &sourceLocation)
static QString formatElement(const QString &element)
Formats element name.
void setType(const SchemaType::Ptr &type)
T & first()
Returns a reference to the first item in the list.
Definition: qlist.h:282
QVector< XsdElement::Ptr > m_substitutionGroupTypes
QVector< SubstitutionGroupAffiliation > m_substitutionGroupAffiliations

◆ resolveSubstitutionGroups()

void XsdSchemaResolver::resolveSubstitutionGroups ( )
private

Resolves substitution groups.

Definition at line 1065 of file qxsdschemaresolver.cpp.

Referenced by resolve().

1066 {
1068  for (int i = 0; i < elements.count(); ++i) {
1069  const XsdElement::Ptr element = elements.at(i);
1070 
1071  // the element is always itself in the substitution group
1072  element->addSubstitutionGroup(element);
1073 
1074  for (int j = 0; j < elements.count(); ++j) {
1075  if (i == j)
1076  continue;
1077 
1078  if (isSubstGroupHeadOf(element, elements.at(j), m_namePool))
1079  element->addSubstitutionGroup(elements.at(j));
1080  }
1081  }
1082 }
void addSubstitutionGroup(const XsdElement::Ptr &elements)
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static const QTextHtmlElement elements[Html_NumElements]
bool isSubstGroupHeadOf(const XsdElement::Ptr &head, const XsdElement::Ptr &element, const NamePool::Ptr &namePool)
XsdElement::List elements() const
Definition: qxsdschema.cpp:89

◆ resolveTermReference()

void XsdSchemaResolver::resolveTermReference ( const XsdParticle::Ptr particle,
QSet< QXmlName visitedGroups 
)
private

Resolves all XsdReferences in the particle recursive by their corresponding XsdElement or XsdModelGroup terms.

Definition at line 1120 of file qxsdschemaresolver.cpp.

Referenced by resolveTermReferences().

1121 {
1122  if (!particle)
1123  return;
1124 
1125  const XsdTerm::Ptr term = particle->term();
1126 
1127  // if it is a model group, we iterate over it recursive...
1128  if (term->isModelGroup()) {
1129  const XsdModelGroup::Ptr modelGroup = term;
1130  const XsdParticle::List particles = modelGroup->particles();
1131 
1132  for (int i = 0; i < particles.count(); ++i) {
1133  resolveTermReference(particles.at(i), visitedGroups);
1134  }
1135 
1136  // check for unique names of elements inside all compositor
1137  if (modelGroup->compositor() != XsdModelGroup::ChoiceCompositor) {
1138  for (int i = 0; i < particles.count(); ++i) {
1139  const XsdParticle::Ptr particle = particles.at(i);
1140  const XsdTerm::Ptr term = particle->term();
1141 
1142  if (!(term->isElement()))
1143  continue;
1144 
1145  for (int j = 0; j < particles.count(); ++j) {
1146  const XsdParticle::Ptr otherParticle = particles.at(j);
1147  const XsdTerm::Ptr otherTerm = otherParticle->term();
1148 
1149  if (otherTerm->isElement() && i != j) {
1150  const XsdElement::Ptr element = term;
1151  const XsdElement::Ptr otherElement = otherTerm;
1152 
1153  if (element->name(m_namePool) == otherElement->name(m_namePool)) {
1154  if (modelGroup->compositor() == XsdModelGroup::AllCompositor) {
1155  m_context->error(QtXmlPatterns::tr("Duplicated element names %1 in %2 element.")
1156  .arg(formatKeyword(element->displayName(m_namePool)))
1157  .arg(formatElement("all")),
1159  return;
1160  } else if (modelGroup->compositor() == XsdModelGroup::SequenceCompositor) {
1161  if (element->type() != otherElement->type()) { // not same variety
1162  m_context->error(QtXmlPatterns::tr("Duplicated element names %1 in %2 element.")
1163  .arg(formatKeyword(element->displayName(m_namePool)))
1164  .arg(formatElement("sequence")),
1166  return;
1167  }
1168  }
1169  }
1170  }
1171  }
1172  }
1173  }
1174 
1175  return;
1176  }
1177 
1178  // ...otherwise we have reached the end of recursion...
1179  if (!term->isReference())
1180  return;
1181 
1182  // ...or we have reached a reference term that must be resolved
1183  const XsdReference::Ptr reference = term;
1184  switch (reference->type()) {
1185  case XsdReference::Element:
1186  {
1187  const XsdElement::Ptr element = m_schema->element(reference->referenceName());
1188  if (element) {
1189  particle->setTerm(element);
1190  } else {
1191  m_context->error(QtXmlPatterns::tr("Reference %1 of %2 element cannot be resolved.")
1192  .arg(formatKeyword(m_namePool, reference->referenceName()))
1193  .arg(formatElement("element")),
1194  XsdSchemaContext::XSDError, reference->sourceLocation());
1195  return;
1196  }
1197  }
1198  break;
1200  {
1201  const XsdModelGroup::Ptr modelGroup = m_schema->elementGroup(reference->referenceName());
1202  if (modelGroup) {
1203  if (visitedGroups.contains(modelGroup->name(m_namePool))) {
1204  m_context->error(QtXmlPatterns::tr("Circular group reference for %1.").arg(formatKeyword(modelGroup->displayName(m_namePool))),
1205  XsdSchemaContext::XSDError, reference->sourceLocation());
1206  } else {
1207  visitedGroups.insert(modelGroup->name(m_namePool));
1208  }
1209 
1210  particle->setTerm(modelGroup);
1211 
1212  // start recursive iteration here as well to get all references resolved
1213  const XsdParticle::List particles = modelGroup->particles();
1214  for (int i = 0; i < particles.count(); ++i) {
1215  resolveTermReference(particles.at(i), visitedGroups);
1216  }
1217 
1218  if (modelGroup->compositor() == XsdModelGroup::AllCompositor) {
1219  if (m_allGroups.contains(reference)) {
1220  m_context->error(QtXmlPatterns::tr("%1 element is not allowed in this scope").arg(formatElement("all.")),
1221  XsdSchemaContext::XSDError, reference->sourceLocation());
1222  return;
1223  }
1224  if (particle->maximumOccursUnbounded() || particle->maximumOccurs() != 1) {
1225  m_context->error(QtXmlPatterns::tr("%1 element cannot have %2 attribute with value other than %3.")
1226  .arg(formatElement("all"))
1227  .arg(formatAttribute("maxOccurs"))
1228  .arg(formatData("1")),
1229  XsdSchemaContext::XSDError, reference->sourceLocation());
1230  return;
1231  }
1232  if (particle->minimumOccurs() != 0 && particle->minimumOccurs() != 1) {
1233  m_context->error(QtXmlPatterns::tr("%1 element cannot have %2 attribute with value other than %3 or %4.")
1234  .arg(formatElement("all"))
1235  .arg(formatAttribute("minOccurs"))
1236  .arg(formatData("0"))
1237  .arg(formatData("1")),
1238  XsdSchemaContext::XSDError, reference->sourceLocation());
1239  return;
1240  }
1241  }
1242  } else {
1243  m_context->error(QtXmlPatterns::tr("Reference %1 of %2 element cannot be resolved.")
1244  .arg(formatKeyword(m_namePool, reference->referenceName()))
1245  .arg(formatElement("group")),
1246  XsdSchemaContext::XSDError, reference->sourceLocation());
1247  return;
1248  }
1249  }
1250  break;
1251  }
1252 }
void resolveTermReference(const XsdParticle::Ptr &particle, QSet< QXmlName > visitedGroups)
XsdElement::Ptr element(const QXmlName &name) const
Definition: qxsdschema.cpp:82
QString formatKeyword(const QString &keyword)
XsdTerm::Ptr term() const
QSet< XsdReference::Ptr > m_allGroups
The model group contains elements only.
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
QExplicitlySharedDataPointer< XsdSchemaContext > m_context
SchemaType::Ptr type() const
unsigned int maximumOccurs() const
virtual bool isElement() const
Definition: qxsdterm.cpp:48
The reference points to a model group.
void error(const QString &message, const ReportContext::ErrorCode errorCode, const QSourceLocation &sourceLocation)
unsigned int minimumOccurs() const
XsdParticle::List particles() const
static QString formatElement(const QString &element)
Formats element name.
bool contains(const T &value) const
Definition: qset.h:91
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
XsdModelGroup::Ptr elementGroup(const QXmlName &name) const
Definition: qxsdschema.cpp:216
virtual QString displayName(const NamePool::Ptr &namePool) const
const_iterator insert(const T &value)
Definition: qset.h:179
QSourceLocation sourceLocation(const NamedSchemaComponent::Ptr component) const
void setTerm(const XsdTerm::Ptr &term)
static QString formatData(const QString &data)
virtual QXmlName name(const NamePool::Ptr &namePool) const
bool maximumOccursUnbounded() const
virtual bool isReference() const
Definition: qxsdterm.cpp:63
virtual bool isModelGroup() const
Definition: qxsdterm.cpp:53
ModelCompositor compositor() const
static QString formatAttribute(const QString &attribute)
Formats attribute name.
The reference points to an element.

◆ resolveTermReferences()

void XsdSchemaResolver::resolveTermReferences ( )
private

Resolves all XsdReferences in the schema by their corresponding XsdElement or XsdModelGroup terms.

Definition at line 1084 of file qxsdschemaresolver.cpp.

Referenced by resolve().

1085 {
1086  // first the global complex types
1087  const SchemaType::List types = m_schema->types();
1088  for (int i = 0; i < types.count(); ++i) {
1089  if (!(types.at(i)->isComplexType()) || !types.at(i)->isDefinedBySchema())
1090  continue;
1091 
1092  const XsdComplexType::Ptr complexType = types.at(i);
1093  if (complexType->contentType()->variety() != XsdComplexType::ContentType::ElementOnly && complexType->contentType()->variety() != XsdComplexType::ContentType::Mixed)
1094  continue;
1095 
1096  resolveTermReference(complexType->contentType()->particle(), QSet<QXmlName>());
1097  }
1098 
1099  // then all anonymous complex types
1100  const SchemaType::List anonymousTypes = m_schema->anonymousTypes();
1101  for (int i = 0; i < anonymousTypes.count(); ++i) {
1102  if (!(anonymousTypes.at(i)->isComplexType()) || !anonymousTypes.at(i)->isDefinedBySchema())
1103  continue;
1104 
1105  const XsdComplexType::Ptr complexType = anonymousTypes.at(i);
1106  if (complexType->contentType()->variety() != XsdComplexType::ContentType::ElementOnly && complexType->contentType()->variety() != XsdComplexType::ContentType::Mixed)
1107  continue;
1108 
1109  resolveTermReference(complexType->contentType()->particle(), QSet<QXmlName>());
1110  }
1111 
1112  const XsdModelGroup::List groups = m_schema->elementGroups();
1113  for (int i = 0; i < groups.count(); ++i) {
1114  const XsdParticle::Ptr particle(new XsdParticle());
1115  particle->setTerm(groups.at(i));
1116  resolveTermReference(particle, QSet<QXmlName>());
1117  }
1118 }
The complex type has further elements or attributes and text as content.
void resolveTermReference(const XsdParticle::Ptr &particle, QSet< QXmlName > visitedGroups)
SchemaType::List anonymousTypes() const
Definition: qxsdschema.cpp:181
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
XsdModelGroup::List elementGroups() const
Definition: qxsdschema.cpp:223
ContentType::Ptr contentType() const
virtual bool isComplexType() const
Definition: qschematype.cpp:70
Represents a XSD particle object.
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static const struct @32 types[]
virtual bool isDefinedBySchema() const
Definition: qschematype.cpp:75
SchemaType::List types() const
Definition: qxsdschema.cpp:131
The complex type has further elements or attributes but no text as content.

◆ setDefaultOpenContent()

void XsdSchemaResolver::setDefaultOpenContent ( const XsdComplexType::OpenContent::Ptr openContent,
bool  appliesToEmpty 
)

Sets the defaultOpenContent object from the schema parser.

Definition at line 341 of file qxsdschemaresolver.cpp.

Referenced by QPatternist::XsdSchemaParser::parse().

342 {
343  m_defaultOpenContent = openContent;
344  m_defaultOpenContentAppliesToEmpty = appliesToEmpty;
345 }
XsdComplexType::OpenContent::Ptr m_defaultOpenContent

◆ sourceLocation()

QSourceLocation XsdSchemaResolver::sourceLocation ( const NamedSchemaComponent::Ptr  component) const
private

Returns the source location of the given schema component or a dummy source location if the component is not found in the component location hash.

Definition at line 1636 of file qxsdschemaresolver.cpp.

Referenced by checkRedefinedAttributeGroups(), checkRedefinedGroups(), resolveAttributeInheritance(), resolveComplexContentComplexTypes(), resolveEnumerationFacetValues(), and resolveTermReference().

1637 {
1638  if (m_componentLocationHash.contains(component)) {
1639  return m_componentLocationHash.value(component);
1640  } else {
1642  location.setLine(1);
1643  location.setColumn(1);
1644  location.setUri(QString::fromLatin1("dummyUri"));
1645 
1646  return location;
1647  }
1648 }
void setUri(const QUrl &newUri)
Sets the URI to newUri.
void setLine(qint64 newLine)
Sets the line number to newLine.
bool contains(const Key &key) const
Returns true if the hash contains an item with the key; otherwise returns false.
Definition: qhash.h:872
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
QHash< NamedSchemaComponent::Ptr, QSourceLocation > m_componentLocationHash
void setColumn(qint64 newColumn)
Sets the column number to newColumn.
The QSourceLocation class identifies a location in a resource by URI, line, and column.
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63

◆ typeNameOfAttribute()

QXmlName XsdSchemaResolver::typeNameOfAttribute ( const XsdAttribute::Ptr attribute) const

Returns the to resolve type name for the given attribute.

Note
That functionality is only used by the redefine algorithm in the XsdSchemaParser.

Definition at line 331 of file qxsdschemaresolver.cpp.

332 {
333  for (int i = 0; i < m_attributeTypes.count(); ++i) {
334  if (m_attributeTypes.at(i).attribute == attribute)
335  return m_attributeTypes.at(i).typeName;
336  }
337 
338  return QXmlName();
339 }
The QXmlName class represents the name of an XML node, in an efficient, namespace-aware way...
Definition: qxmlname.h:58
QVector< AttributeType > m_attributeTypes

Properties

◆ m_allGroups

QSet<XsdReference::Ptr> QPatternist::XsdSchemaResolver::m_allGroups
private

Definition at line 561 of file qxsdschemaresolver_p.h.

Referenced by addAllGroupCheck(), and resolveTermReference().

◆ m_alternativeTypeElements

QVector<AlternativeTypeElement> QPatternist::XsdSchemaResolver::m_alternativeTypeElements
private

◆ m_alternativeTypes

QVector<AlternativeType> QPatternist::XsdSchemaResolver::m_alternativeTypes
private

◆ m_attributeTypes

QVector<AttributeType> QPatternist::XsdSchemaResolver::m_attributeTypes
private

◆ m_checker

QExplicitlySharedDataPointer<XsdSchemaChecker> QPatternist::XsdSchemaResolver::m_checker
private

Definition at line 564 of file qxsdschemaresolver_p.h.

Referenced by resolve().

◆ m_complexBaseTypes

QVector<ComplexBaseType> QPatternist::XsdSchemaResolver::m_complexBaseTypes
private

◆ m_complexContentTypes

QVector<ComplexContentType> QPatternist::XsdSchemaResolver::m_complexContentTypes
private

◆ m_componentLocationHash

QHash<NamedSchemaComponent::Ptr, QSourceLocation> QPatternist::XsdSchemaResolver::m_componentLocationHash
private

◆ m_context

QExplicitlySharedDataPointer<XsdSchemaContext> QPatternist::XsdSchemaResolver::m_context
private

◆ m_defaultOpenContent

XsdComplexType::OpenContent::Ptr QPatternist::XsdSchemaResolver::m_defaultOpenContent
private

◆ m_defaultOpenContentAppliesToEmpty

bool QPatternist::XsdSchemaResolver::m_defaultOpenContentAppliesToEmpty
private

◆ m_elementTypes

QVector<ElementType> QPatternist::XsdSchemaResolver::m_elementTypes
private

◆ m_enumerationFacetValues

QHash<AtomicValue::Ptr, NamespaceSupport> QPatternist::XsdSchemaResolver::m_enumerationFacetValues
private

◆ m_keyReferences

QVector<KeyReference> QPatternist::XsdSchemaResolver::m_keyReferences
private

◆ m_namePool

NamePool::Ptr QPatternist::XsdSchemaResolver::m_namePool
private

◆ m_predefinedSchemaTypes

SchemaType::List QPatternist::XsdSchemaResolver::m_predefinedSchemaTypes
private

Definition at line 570 of file qxsdschemaresolver_p.h.

Referenced by resolveSimpleRestrictions(), and XsdSchemaResolver().

◆ m_redefinedAttributeGroups

QVector<RedefinedAttributeGroups> QPatternist::XsdSchemaResolver::m_redefinedAttributeGroups
private

◆ m_redefinedGroups

QVector<RedefinedGroups> QPatternist::XsdSchemaResolver::m_redefinedGroups
private

Definition at line 558 of file qxsdschemaresolver_p.h.

Referenced by addRedefinedGroups(), and checkRedefinedGroups().

◆ m_schema

XsdSchema::Ptr QPatternist::XsdSchemaResolver::m_schema
private

◆ m_simpleListTypes

QVector<SimpleListType> QPatternist::XsdSchemaResolver::m_simpleListTypes
private

◆ m_simpleRestrictionBases

QVector<SimpleRestrictionBase> QPatternist::XsdSchemaResolver::m_simpleRestrictionBases
private

◆ m_simpleUnionTypes

QVector<SimpleUnionType> QPatternist::XsdSchemaResolver::m_simpleUnionTypes
private

◆ m_substitutionGroupAffiliations

QVector<SubstitutionGroupAffiliation> QPatternist::XsdSchemaResolver::m_substitutionGroupAffiliations
private

◆ m_substitutionGroupTypes

QVector<XsdElement::Ptr> QPatternist::XsdSchemaResolver::m_substitutionGroupTypes
private

The documentation for this class was generated from the following files: