Home | Top | ← | → | Overview | Module | Class | Index | Help |
|
About |
---|
|
||||
Mixin for implementing XML data validators/decoders. A derived class must implement the methods `iter_decode` and `iter_encode`.
Method Details |
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.
|
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 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.
|
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.
|
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.
|
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.
|
Creates an iterator for decoding an XML source to a Python object. :param source: the XML data source. The argument type depends by implementation. :param validation: the validation mode. Can be 'lax', 'strict' or 'skip. :param args: additional arguments for the decoder API. :param kwargs: keyword arguments for the decoder API. :return: Yields a decoded object, eventually preceded by a sequence of validation or decoding errors.
|
Creates an iterator for Encode data to an Element. :param obj: The data that has to be encoded. :param validation: The validation mode. Can be 'lax', 'strict' or 'skip'. :param args: additional arguments for the encoder API. :param kwargs: keyword arguments for the encoder API. :return: Yields an Element, eventually preceded by a sequence of validation or encoding errors.
|
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.
|
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.
|
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.
|
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 |