Qt 4.8
|
The validating schema instance reader. More...
#include <qxsdvalidatinginstancereader_p.h>
Public Types | |
typedef QExplicitlySharedDataPointer< XsdValidatingInstanceReader > | Ptr |
Public Types inherited from QPatternist::XsdInstanceReader | |
typedef QExplicitlySharedDataPointer< XsdInstanceReader > | Ptr |
Public Functions | |
void | addSchema (const XsdSchema::Ptr &schema, const QUrl &url) |
bool | read () |
XsdValidatingInstanceReader (XsdValidatedXmlNodeModel *model, const QUrl &documentUri, const XsdSchemaContext::Ptr &context) | |
Public Functions inherited from QPatternist::XsdInstanceReader | |
XsdInstanceReader (const QAbstractXmlNodeModel *model, const XsdSchemaContext::Ptr &context) | |
Private Types | |
typedef QHash< QUrl, QStringList > | MergedSchemas |
typedef QHashIterator< QUrl, QStringList > | MergedSchemasIterator |
Additional Inherited Members | |
Protected Functions inherited from QPatternist::XsdInstanceReader | |
bool | atEnd () const |
QString | attribute (const QXmlName &name) const |
QXmlItem | attributeItem (const QXmlName &name) const |
QSet< QXmlName > | attributeNames () const |
QXmlName | convertToQName (const QString &name) const |
bool | hasAttribute (const QXmlName &name) const |
bool | hasChildElement () const |
bool | hasChildText () const |
bool | isEndElement () const |
bool | isStartElement () const |
QXmlItem | item () const |
QXmlName | name () const |
QVector< QXmlName > | namespaceBindings (const QXmlNodeModelIndex &index) const |
void | readNext () |
QSourceLocation | sourceLocation () const |
QString | text () const |
Protected Variables inherited from QPatternist::XsdInstanceReader | |
XsdSchemaContext::Ptr | m_context |
The validating schema instance reader.
This class reads in a xml instance document from a QAbstractXmlNodeModel and validates it against a given xml schema.
Definition at line 79 of file qxsdvalidatinginstancereader_p.h.
|
private |
Definition at line 269 of file qxsdvalidatinginstancereader_p.h.
|
private |
Definition at line 270 of file qxsdvalidatinginstancereader_p.h.
typedef QExplicitlySharedDataPointer<XsdValidatingInstanceReader> QPatternist::XsdValidatingInstanceReader::Ptr |
Definition at line 82 of file qxsdvalidatinginstancereader_p.h.
XsdValidatingInstanceReader::XsdValidatingInstanceReader | ( | XsdValidatedXmlNodeModel * | model, |
const QUrl & | documentUri, | ||
const XsdSchemaContext::Ptr & | context | ||
) |
Creates a new validating instance reader that reads the data from the given model
.
model | The model the data shall be read from. |
documentUri | The uri of the document the model is from. |
context | The context that is used to report errors etc. |
Definition at line 98 of file qxsdvalidatinginstancereader.cpp.
|
private |
Adds the ID/IDREF binding to the validated model and checks for duplicates.
Definition at line 1221 of file qxsdvalidatinginstancereader.cpp.
Referenced by validateAttribute(), and validateElementSimpleType().
void XsdValidatingInstanceReader::addSchema | ( | const XsdSchema::Ptr & | schema, |
const QUrl & | url | ||
) |
Adds a new schema
to the pool of schemas that shall be used for validation. The schema is located at the given url
.
Definition at line 111 of file qxsdvalidatinginstancereader.cpp.
Referenced by loadSchema(), and QXmlSchemaValidator::validate().
|
private |
Returns the xs:anyType that is used to build up the state machine. We need that as the BuiltinTypes::xsAnyType is not a XsdComplexType.
Definition at line 1242 of file qxsdvalidatinginstancereader.cpp.
Referenced by validate(), and validateElementComplexType().
|
private |
Returns the attribute declaration with the given name
from the pool of all schemas.
Definition at line 1207 of file qxsdvalidatinginstancereader.cpp.
Referenced by validateElementComplexType().
|
private |
Helper method that creates a state machine for the given particle
and pushes it on the state machine stack.
Definition at line 409 of file qxsdvalidatinginstancereader.cpp.
Referenced by validate(), and validateElementComplexType().
|
private |
Creates an QXmlQuery object with the defined namespaceBindings
that has the contextNode
as focus and will execute query
.
Definition at line 1075 of file qxsdvalidatinginstancereader.cpp.
Referenced by selectNodeSets().
|
private |
Returns the element declaration with the given name
from the pool of all schemas.
Definition at line 1202 of file qxsdvalidatinginstancereader.cpp.
Referenced by validate().
|
private |
Reports an error via the report context.
Definition at line 184 of file qxsdvalidatinginstancereader.cpp.
Referenced by addIdIdRefBinding(), loadSchema(), qNameAttribute(), read(), selectNodeSets(), validate(), validateAttribute(), validateElement(), validateElementComplexType(), validateElementSimpleType(), validateElementType(), validateKeyIdentityConstraint(), validateKeyRefIdentityConstraint(), and validateUniqueIdentityConstraint().
|
private |
Loads a schema with the given targetNamespace
from the given location
and adds it to the pool of schemas that are used for validation.
This method is used to load schemas defined in the xsi:schemaLocation or xsi:noNamespaceSchemaLocation attributes in the instance document.
Definition at line 189 of file qxsdvalidatinginstancereader.cpp.
Referenced by validate().
Helper method that reads an attribute of type xs:QName and does syntax checking.
Definition at line 1231 of file qxsdvalidatinginstancereader.cpp.
Referenced by validate(), and validateElement().
bool XsdValidatingInstanceReader::read | ( | ) |
Reads and validates the instance document.
Definition at line 131 of file qxsdvalidatinginstancereader.cpp.
Referenced by QXmlSchemaValidator::validate().
|
private |
Selects two sets of nodes that match the given identity constraint
.
element | The element the identity constraint belongs to. |
currentItem | The current element that will be used as focus for the XQuery. |
constraint | The constraint (selector and fields) that describe the two sets. |
targetNodeSet | The target node set as defined by the schema specification. |
qualifiedNodeSet | The qualified node set as defined by the schema specification. |
Definition at line 1098 of file qxsdvalidatinginstancereader.cpp.
Referenced by validateIdentityConstraint().
|
private |
Returns the type declaration with the given name
from the pool of all schemas.
Definition at line 1212 of file qxsdvalidatinginstancereader.cpp.
Referenced by validate(), and validateElement().
|
private |
Validates the current element tag of the instance document.
hasStateMachine | Used to remember whether this element represents the start tag of a complex type and therefor pushes a new state machine on the stack. |
element | Used to remember which element has been validated in this step. |
Definition at line 212 of file qxsdvalidatinginstancereader.cpp.
Referenced by read().
|
private |
Validates the given value
against the attribute use declaration
.
Definition at line 833 of file qxsdvalidatinginstancereader.cpp.
Referenced by validateElementComplexType().
|
private |
Validates the given value
against the attribute declaration
.
Definition at line 879 of file qxsdvalidatinginstancereader.cpp.
|
private |
Validates the given attributeName
against the wildcard
.
Definition at line 924 of file qxsdvalidatinginstancereader.cpp.
Referenced by validateElementComplexType().
|
private |
Validates the current tag of the instance document against the given element declaration
.
declaration | The element declaration to validate against. |
hasStateMachine | Used to remember whether this element represents the start tag of a complex type and therefor pushes a new state machine on the stack. |
Definition at line 433 of file qxsdvalidatinginstancereader.cpp.
Referenced by validate().
|
private |
Validates the current tag of the instance document against the given complex type
of the element declaration
.
declaration | The element declaration to validate against. |
type | The type to validate against. |
isNilled | Defines whether the element is nilled by the instance document. |
hasStateMachine | Used to remember whether this element represents the start tag of a complex type and therefor pushes a new state machine on the stack. |
type
can differ from the element declaration
type if the instance document has defined it via xsi:type attribute. Definition at line 624 of file qxsdvalidatinginstancereader.cpp.
Referenced by validateElementType().
|
private |
Validates the current tag of the instance document against the given simple type
of the element declaration
.
declaration | The element declaration to validate against. |
type | The type to validate against. |
isNilled | Defines whether the element is nilled by the instance document. |
type
can differ from the element declaration
type if the instance document has defined it via xsi:type attribute. Definition at line 539 of file qxsdvalidatinginstancereader.cpp.
Referenced by validateElementType().
|
private |
Validates the current tag of the instance document against the given type
of the element declaration
.
declaration | The element declaration to validate against. |
type | The type to validate against. |
isNilled | Defines whether the element is nilled by the instance document. |
hasStateMachine | Used to remember whether this element represents the start tag of a complex type and therefor pushes a new state machine on the stack. |
type
can differ from the element declaration
type if the instance document has defined it via xsi:type attribute. Definition at line 518 of file qxsdvalidatinginstancereader.cpp.
Referenced by validateElement().
|
private |
Validates the identity constraints of an element
.
Definition at line 937 of file qxsdvalidatinginstancereader.cpp.
Referenced by read().
|
private |
Validates the key identity constraint
of the element
.
Definition at line 1000 of file qxsdvalidatinginstancereader.cpp.
Referenced by validateIdentityConstraint().
|
private |
Validates the keyref identity constraint
of the element
.
Definition at line 1041 of file qxsdvalidatinginstancereader.cpp.
Referenced by validateIdentityConstraint().
|
private |
Validates the unique identity constraint
of the element
.
Definition at line 971 of file qxsdvalidatinginstancereader.cpp.
Referenced by validateIdentityConstraint(), and validateKeyIdentityConstraint().
|
private |
Definition at line 283 of file qxsdvalidatinginstancereader_p.h.
Referenced by anyType().
|
private |
Definition at line 282 of file qxsdvalidatinginstancereader_p.h.
Referenced by createXQuery(), and validate().
|
private |
Definition at line 287 of file qxsdvalidatinginstancereader_p.h.
Referenced by validateKeyIdentityConstraint(), validateKeyRefIdentityConstraint(), and validateUniqueIdentityConstraint().
Definition at line 286 of file qxsdvalidatinginstancereader_p.h.
Referenced by read(), validateAttribute(), and validateElementSimpleType().
|
private |
Definition at line 288 of file qxsdvalidatinginstancereader_p.h.
Referenced by validateAttribute(), validateElementSimpleType(), and XsdValidatingInstanceReader().
|
private |
Definition at line 273 of file qxsdvalidatinginstancereader_p.h.
Referenced by addSchema().
|
private |
Definition at line 272 of file qxsdvalidatinginstancereader_p.h.
Referenced by addIdIdRefBinding(), read(), selectNodeSets(), validate(), validateAttribute(), validateElementComplexType(), validateElementSimpleType(), and validateKeyIdentityConstraint().
|
private |
Definition at line 275 of file qxsdvalidatinginstancereader_p.h.
Referenced by anyType(), createAndPushStateMachine(), createXQuery(), loadSchema(), qNameAttribute(), read(), selectNodeSets(), validate(), validateAttribute(), validateAttributeWildcard(), validateElement(), validateElementComplexType(), validateElementSimpleType(), validateElementType(), validateKeyIdentityConstraint(), validateKeyRefIdentityConstraint(), validateUniqueIdentityConstraint(), and XsdValidatingInstanceReader().
Definition at line 284 of file qxsdvalidatinginstancereader_p.h.
Referenced by validate().
Definition at line 285 of file qxsdvalidatinginstancereader_p.h.
Referenced by validate().
|
private |
Definition at line 274 of file qxsdvalidatinginstancereader_p.h.
Referenced by addSchema(), attributeByName(), elementByName(), typeByName(), and validate().
|
private |
Definition at line 281 of file qxsdvalidatinginstancereader_p.h.
Referenced by createAndPushStateMachine(), read(), and validate().
|
private |
Definition at line 276 of file qxsdvalidatinginstancereader_p.h.
Referenced by validate(), validateElement(), validateElementComplexType(), and validateElementSimpleType().
|
private |
Definition at line 279 of file qxsdvalidatinginstancereader_p.h.
Referenced by validate(), validateElementComplexType(), and validateElementSimpleType().
|
private |
Definition at line 278 of file qxsdvalidatinginstancereader_p.h.
Referenced by validate(), validateElementComplexType(), and validateElementSimpleType().
|
private |
Definition at line 277 of file qxsdvalidatinginstancereader_p.h.
Referenced by validate(), validateElement(), validateElementComplexType(), and validateElementSimpleType().