Home | Top | ← | → | Overview | Module | Class | Index | Help |
|
About |
---|
|
||||
XSD 1.0 schema class. <schema attributeFormDefault = (qualified | unqualified) : unqualified blockDefault = (#all | List of (extension | restriction | substitution)) : '' elementFormDefault = (qualified | unqualified) : unqualified finalDefault = (#all | List of (extension | restriction | list | union)) : '' id = ID targetNamespace = anyURI version = token xml:lang = language {any attributes with non-schema namespace . . .}> Content: ((include | import | redefine | annotation)*, (((simpleType | complexType | group | attributeGroup) | element | attribute | notation), annotation*)*) </schema>
Instance Methods | |
Inherited from Inherited from Inherited from |
Class Methods | |
Inherited from |
Class Variables | |
XSD_VERSION = '1.0'
|
|
meta_schema = os.path.join(SCHEMAS_DIR, 'XSD_1.0/XMLSchema.xsd')
|
|
Inherited from Inherited from |
Method Details |
Makes a copy of the schema instance. The new instance has independent maps of shared XSD components.
|
|
|
|
|
A list with all the building errors of the XSD validator and its components.
|
Returns the Element attributes. For compatibility with the ElementTree API.
|
The base URL of the source of the schema.
|
Property that is ``True`` if schema validator has been fully parsed and built, ``False`` otherwise.
|
Validates the given schema against the XSD meta-schema (:attr:`meta_schema`). :param schema: the schema instance that has to be validated. :param namespaces: is an optional mapping from namespace prefix to URI. :raises: :exc:`XMLSchemaValidationError` if the schema is invalid.
|
Makes a copy of the schema instance. The new instance has independent maps of shared XSD components.
|
Creates a new meta-schema instance. :param source: an optional argument referencing to or containing the XSD meta-schema resource. Required if the schema class doesn't already have a meta-schema. :param base_schemas: an optional dictionary that contains namespace URIs and schema locations. If provided it's used as substitute for class 's BASE_SCHEMAS. Also a sequence of (namespace, location) items can be provided if there are more schema documents for one or more namespaces. :param global_maps: is an optional argument containing an :class:`XsdGlobals` instance for the new meta schema. If not provided a new map is created.
|
Decodes XML data using the XSD schema/component. :param source: the source of XML data. For a schema can be a path to a file or an URI of a resource or an opened file-like object or an Element Tree instance or a string containing XML data. For other XSD components can be a string for an attribute or a simple type validators, or an ElementTree's Element otherwise. :param args: arguments that maybe passed to :func:`XMLSchema.iter_decode`. :param kwargs: keyword arguments from the ones included in the optional arguments of the :func:`XMLSchema.iter_decode`. :return: a dictionary like object if the XSD component is an element, a group or a complex type; a list if the XSD component is an attribute group; a simple data type object otherwise. If *validation* argument is 'lax' a 2-items tuple is returned, where the first item is the decoded object and the second item is a list containing the errors. :raises: :exc:`XMLSchemaValidationError` if the object is not decodable by the XSD component, or also if it's invalid when ``validation='strict'`` is provided.
|
Helper method for generating decode errors. Incompatible with 'skip' validation mode. Il validation mode is 'lax' returns the error, otherwise raises the error. :param validation: an error-compatible validation mode: can be 'lax' or 'strict'. :param obj: the not validated XML data. :param decoder: the XML data decoder. :param reason: the detailed reason of failed validation. :param source: the XML resource that contains the error. :param namespaces: is an optional mapping from namespace prefix to URI. :param _kwargs: keyword arguments of the validation process that are not used.
|
The namespace associated to the empty prefix ''.
|
Defines when to defuse XML data, can be 'always', 'remote' or 'never'.
|
Encodes data to XML using the XSD schema/component. :param obj: the data to be encoded to XML. :param args: arguments that maybe passed to :func:`XMLSchema.iter_encode`. :param kwargs: keyword arguments from the ones included in the optional arguments of the :func:`XMLSchema.iter_encode`. :return: An element tree's Element if the original data is a structured data or a string if it's simple type datum. If *validation* argument is 'lax' a 2-items tuple is returned, where the first item is the encoded object and the second item is a list containing the errors. :raises: :exc:`XMLSchemaValidationError` if the object is not encodable by the XSD component, or also if it's invalid when ``validation='strict'`` is provided.
|
Helper method for generating encode errors. Incompatible with 'skip' validation mode. Il validation mode is 'lax' returns the error, otherwise raises the error. :param validation: an error-compatible validation mode: can be 'lax' or 'strict'. :param obj: the not validated XML data. :param encoder: the XML encoder. :param reason: the detailed reason of failed validation. :param source: the XML resource that contains the error. :param namespaces: is an optional mapping from namespace prefix to URI. :param _kwargs: keyword arguments of the validation process that are not used.
|
Finds the first XSD subelement matching the path. :param path: an XPath expression that considers the XSD component as the root element. :param namespaces: an optional mapping from namespace prefix to full name. :return: The first matching XSD subelement or ``None`` if there is not match.
|
Finds all XSD subelements matching the path. :param path: an XPath expression that considers the XSD component as the root element. :param namespaces: an optional mapping from namespace prefix to full name. :return: a list containing all matching XSD subelements in document order, an empty list is returned if there is no match.
|
Gets an Element attribute. For compatibility with the ElementTree API.
|
Returns a new converter instance. :param converter: can be a converter class or instance. If it's an instance the new instance is copied from it and configured with the provided arguments. :param namespaces: is an optional mapping from namespace prefix to URI. :param kwargs: optional arguments for initialize the converter instance. :return: a converter instance.
|
Gets the XSD text of the schema. If the source text is not available creates an encoded string representation of the XSD tree.
|
The schema's *id* attribute, defaults to ``None``.
|
Imports a schema for an external namespace, from a specific URL. :param namespace: is the URI of the external namespace. :param location: is the URL of the schema. :param base_url: is an optional base URL for fetching the schema resource. :param force: is set to `True` imports the schema also if the namespace is already imported. :return: the imported :class:`XMLSchema` instance.
|
Includes a schema for the same namespace, from a specific URL. :param location: is the URL of the schema. :param base_url: is an optional base URL for fetching the schema resource. :return: the included :class:`XMLSchema` instance.
|
Like :meth:`validate` except that do not raises an exception but returns ``True`` if the XML document is valid, ``False`` if it's invalid. :param source: the source of XML data. For a schema can be a path to a file or an URI of a resource or an opened file-like object or an Element Tree instance or a string containing XML data. For other XSD components can be a string for an attribute or a simple type validators, or an ElementTree's Element otherwise. :param use_defaults: indicates whether to use default values for filling missing data.
|
Creates an iterator for the XSD element and its subelements. If tag is not `None` or '*', only XSD elements whose matches tag are returned from the iterator. Local elements are expanded without repetitions. Element references are not expanded because the global elements are not descendants of other elements.
|
Creates an iterator for traversing all XSD components of the validator. :param xsd_classes: returns only a specific class/classes of components, otherwise returns all components.
|
Creates an iterator for decoding an XML source to a data structure. :param source: the XML data source. Can be a path to a file or an URI of a resource or an opened file-like object or an Element Tree instance or a string containing XML data. :param path: is an optional XPath expression that matches the parts of the document that have to be decoded. The XPath expression considers the schema as the root element with global elements as its children. :param validation: defines the XSD validation mode to use for decode, can be 'strict', 'lax' or 'skip'. :param process_namespaces: indicates whether to use namespace information in the decoding process, using the map provided with the argument *namespaces* and the map extracted from the XML document. :param namespaces: is an optional mapping from namespace prefix to URI. :param use_defaults: indicates whether to use default values for filling missing data. :param decimal_type: conversion type for `Decimal` objects (generated by XSD `decimal` built-in and derived types), useful if you want to generate a JSON-compatible data structure. :param datetime_types: if set to `True` the datetime and duration XSD types are decoded, otherwise their origin XML string is returned. :param converter: an :class:`XMLSchemaConverter` subclass or instance to use for the decoding. :param defuse: Overrides when to defuse XML data. Can be 'always', 'remote' or 'never'. :param timeout: Overrides the timeout setted for the schema. :param kwargs: Keyword arguments containing options for converter and decoding. :return: Yields a decoded data object, eventually preceded by a sequence of validation or decoding errors.
|
Creates an iterator for encoding a data structure to an ElementTree's Element. :param obj: the data that has to be encoded. :param path: is an optional XPath expression for selecting the element of the schema that matches the data that has to be encoded. For default the first global element of the schema is used. :param validation: the XSD validation mode. Can be 'strict', 'lax' or 'skip'. :param namespaces: is an optional mapping from namespace prefix to URI. :param converter: an :class:`XMLSchemaConverter` subclass or instance to use for the encoding. :param kwargs: Keyword arguments containing options for converter and encoding. :return: Yields an Element instance, eventually preceded by a sequence of validation or encoding errors.
|
Creates an iterator for the errors generated by the validation of an XML data against the XSD schema/component instance. :param source: the source of XML data. For a schema can be a path to a file or an URI of a resource or an opened file-like object or an Element Tree instance or a string containing XML data. For other XSD components can be a string for an attribute or a simple type validators, or an ElementTree's Element otherwise. :param path: is an optional XPath expression that defines the parts of the document that have to be validated. The XPath expression considers the schema as the root element with global elements as its children. :param use_defaults: Use schema's default values for filling missing data. :param namespaces: is an optional mapping from namespace prefix to URI.
|
Creates an iterator for XSD global definitions/declarations related to schema namespace. :param schema: Optional argument for filtering only globals related to a schema instance.
|
Creates an iterator for the child elements of the XSD component. If *tag* is not `None` or '*', only XSD elements whose name matches tag are returned from the iterator.
|
Creates and iterator for all XSD subelements matching the path. :param path: an XPath expression that considers the XSD component as the root element. :param namespaces: is an optional mapping from namespace prefix to full name. :return: an iterable yielding all matching XSD subelements in document order.
|
A location hint extracted from the *xsi:noNamespaceSchemaLocation* attribute of the schema.
|
Helper method for registering parse errors. Does nothing if validation mode is 'skip'. Il validation mode is 'lax' collects the error, otherwise raise the error. :param error: can be a parse error or an error message. :param elem: the Element instance related to the error, for default uses the 'elem' attribute of the validator, if it's present.
|
QName resolution for a schema instance. :param qname: a string in xs:QName format. :returns: an expanded QName in the format "{*namespace-URI*}*local-name*". :raises: `XMLSchemaValueError` for an invalid xs:QName or if the namespace prefix is not declared in the schema instance or if the namespace is not the *targetNamespace* and the namespace is not imported by the schema.
|
Root element of the schema.
|
The list of global elements that are not used by reference in any model of the schema. This is implemented as lazy property because it's computationally expensive to build when the schema model is complex.
|
A list of location hints extracted from the *xsi:schemaLocation* attribute of the schema.
|
Schema root tag. For compatibility with the ElementTree API.
|
The prefix associated to the *targetNamespace*.
|
Timeout in seconds for fetching resources.
|
Decodes XML data using the XSD schema/component. :param source: the source of XML data. For a schema can be a path to a file or an URI of a resource or an opened file-like object or an Element Tree instance or a string containing XML data. For other XSD components can be a string for an attribute or a simple type validators, or an ElementTree's Element otherwise. :param args: arguments that maybe passed to :func:`XMLSchema.iter_decode`. :param kwargs: keyword arguments from the ones included in the optional arguments of the :func:`XMLSchema.iter_decode`. :return: a dictionary like object if the XSD component is an element, a group or a complex type; a list if the XSD component is an attribute group; a simple data type object otherwise. If *validation* argument is 'lax' a 2-items tuple is returned, where the first item is the decoded object and the second item is a list containing the errors. :raises: :exc:`XMLSchemaValidationError` if the object is not decodable by the XSD component, or also if it's invalid when ``validation='strict'`` is provided.
|
Encodes data to XML using the XSD schema/component. :param obj: the data to be encoded to XML. :param args: arguments that maybe passed to :func:`XMLSchema.iter_encode`. :param kwargs: keyword arguments from the ones included in the optional arguments of the :func:`XMLSchema.iter_encode`. :return: An element tree's Element if the original data is a structured data or a string if it's simple type datum. If *validation* argument is 'lax' a 2-items tuple is returned, where the first item is the encoded object and the second item is a list containing the errors. :raises: :exc:`XMLSchemaValidationError` if the object is not encodable by the XSD component, or also if it's invalid when ``validation='strict'`` is provided.
|
Schema resource URL, is `None` if the schema is built from a string.
|
Returns `True` if the meta-schema is imported.
|
Validates an XML data against the XSD schema/component instance. :param source: the source of XML data. For a schema can be a path to a file or an URI of a resource or an opened file-like object or an Element Tree instance or a string containing XML data. For other XSD components can be a string for an attribute or a simple type validators, or an ElementTree's Element otherwise. :param use_defaults: indicates whether to use default values for filling missing data. :param namespaces: is an optional mapping from namespace prefix to URI. :raises: :exc:`XMLSchemaValidationError` if XML *data* instance is not a valid.
|
Property that returns the *validation status* of the XSD validator. It can be 'full', 'partial' or 'none'. | https://www.w3.org/TR/xmlschema-1/#e-validation_attempted | https://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/#e-validation_attempted
|
Helper method for generating and updating validation errors. Incompatible with 'skip' validation mode. Il validation mode is 'lax' returns the error, otherwise raises the error. :param validation: an error-compatible validation mode: can be 'lax' or 'strict'. :param error: an error instance or the detailed reason of failed validation. :param obj: the instance related to the error. :param source: the XML resource related to the validation process. :param namespaces: is an optional mapping from namespace prefix to URI. :param _kwargs: keyword arguments of the validation process that are not used.
|
Property that returns the XSD validator's validity. It can be âvalidâ, âinvalidâ or ânotKnownâ. | https://www.w3.org/TR/xmlschema-1/#e-validity | https://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/#e-validity
|
The schema's *version* attribute, defaults to ``None``.
|
Class Variable Details |
BUILDERS
|
BASE_SCHEMAS
|
Home | Top | ← | → | Overview | Module | Class | Index | Help |
|
About |
---|
Copyright(C) 2019 Arno-Can Uestuensoez @Ingenieurbuero Arno-Can Uestuensoez | https://arnocan.wordpress.com |
Generated by Epydoc 4.0.4 / Python-3.8 / fedora27 on Fri Dec 13 15:25:28 2019 | http://epydoc.sourceforge.net |