xml.Instance

The xml.Instance class represents an XML instance. It provides properties for the corresponding xml.DocumentInformationItem and the xsd.Schema used for assessing schema-validity.

Base class: xml.Document

class xml.Instance

Proper instances of this class will be created within RaptorXML only, instantiation from script code will throw a NotImplementedError exception.

Class methods

classmethod xml.Instance.create_from_buffer(type cls, buf, *, DTD dtd=None, Schema schema=None, catalog=None, **kargs)

Returns a tuple with an xml.Instance and xml.ErrorLog object. Constructs a new xml.Instance object after parsing the XML content in the given buffer. To validate the instance against a specific DTD or XML Schema, supply an xml.dtd.DTD or xsd.Schema object using the dtd or schema parameters. Optional user XML catalogs can be specified with the catalog argument. Other validation options can be specified using additional kargs. Please consult the RaptorXML CLI documentation http://manual.altova.com/RaptorXML/raptorxmlxbrlserver/rxcli_xmlval_xmldtd.htm and http://manual.altova.com/RaptorXML/raptorxmlxbrlserver/rxcli_xmlval_xmlxsd.htm for a list of available options. Any errors and warnings reported during the validation can be accessed through the returned xml.ErrorLog object.

classmethod xml.Instance.create_from_string(type cls, text, Schema schema=None, catalog=None, DTD dtd=None)

Returns a tuple with an xml.Instance and xml.ErrorLog object. Constructs a new xml.Instance object after parsing the XML string in text and optionally validating it against the given xsd.Schema. Any errors or warnings reported during the validation are set on the returned xml.ErrorLog object. [DEPRECATED] This method has been deprecated, please use the new xml.Instance.create_from_buffer() class method instead.

classmethod xml.Instance.create_from_url(type cls, url, *, DTD dtd=None, Schema schema=None, catalog=None, **kargs)

Returns a tuple with an xml.Instance and xml.ErrorLog object. Constructs a new xml.Instance object after parsing the XML content retrieved from the given url. To validate the instance against a specific DTD or XML Schema, supply an xml.dtd.DTD or xsd.Schema object using the dtd or schema parameters. Optional user XML catalogs can be specified with the catalog argument. Other validation options can be specified using additional kargs. Please consult the RaptorXML CLI documentation http://manual.altova.com/RaptorXML/raptorxmlxbrlserver/rxcli_xmlval_xmldtd.htm and http://manual.altova.com/RaptorXML/raptorxmlxbrlserver/rxcli_xmlval_xmlxsd.htm for a list of available options. Any errors and warnings reported during the validation can be accessed through the returned xml.ErrorLog object.

classmethod xml.Instance.is_wellformed_buffer(type cls, buf, *, DTD dtd=None, catalog=None, **kargs)

Checks the buffer buf containing a XML document according to the XML 1.0 or XML 1.1 specification for wellformedness and returns an xml.ErrorLog object with the results. Optional user XML catalogs can be specified with the catalog argument. Other validation options can be specified using additional kargs. Please consult the RaptorXML CLI documentation http://manual.altova.com/RaptorXML/raptorxmlxbrlserver/rxcli_wf_xml.htm for a list of available options. Any errors and warnings reported during the validation can be accessed through the returned xml.ErrorLog object.

classmethod xml.Instance.is_wellformed_url(type cls, url, *, DTD dtd=None, catalog=None, **kargs)

Checks the XML document at the given url according to the XML 1.0 or XML 1.1 specification for wellformedness and returns an xml.ErrorLog object with the results. Optional user XML catalogs can be specified with the catalog argument. Other validation options can be specified using additional kargs. Please consult the RaptorXML CLI documentation http://manual.altova.com/RaptorXML/raptorxmlxbrlserver/rxcli_wf_xml.htm for a list of available options. Any errors and warnings reported during the validation can be accessed through the returned xml.ErrorLog object.

classmethod xml.Instance.validate_buffer(type cls, buf, *, DTD dtd=None, Schema schema=None, catalog=None, **kargs)

Validates the buffer buf containing a XML document according to either the XML or XML Schema specification and returns an xml.ErrorLog object with the results. To validate the instance against a specific DTD or XML Schema, supply an xml.dtd.DTD or xsd.Schema object using the dtd or schema parameters. Optional user XML catalogs can be specified with the catalog argument. Other validation options can be specified using additional kargs. Please consult the RaptorXML CLI documentation http://manual.altova.com/RaptorXML/raptorxmlxbrlserver/rxcli_xmlval_dtd.htm for a list of available options. Any errors and warnings reported during the validation can be accessed through the returned xml.ErrorLog object.

classmethod xml.Instance.validate_url(type cls, url, *, DTD dtd=None, Schema schema=None, catalog=None, **kargs)

Validates the XML document at the given url according to either the XML or XML Schema specification and returns an xml.ErrorLog object with the results. To validate the instance against a specific DTD or XML Schema, supply an xml.dtd.DTD or xsd.Schema object using the dtd or schema parameters. Optional user XML catalogs can be specified with the catalog argument. Other validation options can be specified using additional kargs. Please consult the RaptorXML CLI documentation http://manual.altova.com/RaptorXML/raptorxmlxbrlserver/rxcli_xmlval_dtd.htm for a list of available options. Any errors and warnings reported during the validation can be accessed through the returned xml.ErrorLog object.

Attributes

xml.Document.document

Returns the xml.DocumentInformationItem representing this document.

xml.Document.document_element

Returns the xml.ElementInformationItem representing the document information item for this document.

xml.Instance.dtd

Returns the xml.dtd.DTD associated with this XML instance.

xml.Instance.schema

Returns the xsd.Schema used to validate this XML instance, or None if no validation was performed.

xml.Document.schema_location_attributes

Returns an iterator of xml.AttributeInformationItem objects objects which represent all xsi:schemaLocation and xsi:noNamespaceSchemaLocation attributes in this instance.

xml.Document.source_document

Returns the source xml.Document in case that the document was constructed by an Inline XBRL transformation.

xml.Document.unmapped_uri

Attempts to return the original URI of the document before any catalog mappings were applied.

xml.Document.uri

Returns the URI of the document (after any catalog mappings) that was used to actually open the document and read its content.

Methods

xml.Document.find_element(id)

Returns an xml.ElementInformationItem object which represent the element with the given ID or at the given XPointer location. Returns None if no appropriate element can be found.

xml.Document.serialize(pretty_print=True, add_unspecified_attributes=False)

Returns a string with the serialized document. Setting the option pretty_print will insert appropriate indendation and newlines after each XML element. Setting the option add_unspecified_attributes will add any missing attributes that have a default value in the DTD/XSD Schema.

Special methods

__bool__, __eq__, __ge__, __gt__, __le__, __lt__, __ne__