xbrl.Instance

An xbrl.Instance object represents an XBRL instance document.

Base class: xml.Instance -> xml.Document

class xbrl.Instance

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

Class methods

classmethod xbrl.Instance.create_from_buffer(type cls, buf, *, DTS dts=None, catalog=None, taxonomy_package=None, utr=None, **kargs)

Returns a tuple with an xbrl.Instance and xml.ErrorLog object. Constructs a new xbrl.Instance object after parsing the XML content in the given buffer. To validate the instance against a specific DTS, supply an xbrl.taxonomy.DTS object using the dts parameters. Optional user XML catalogs can be specified with the catalog argument. Optional taxonomy packages can be specified with the taxonomy_package argument. Optional Units Registry can be specified with the utr argument. Other validation options can be specified using additional kargs. Please consult the RaptorXML CLI documentation http://manual.altova.com/RaptorXML/raptorxmlxbrlserver/rxcli_xbrl_valxbrl.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 xbrl.Instance.create_from_element(type cls, ElementInformationItem xbrl, *, DTS dts=None, catalog=None, taxonomy_package=None, utr=None, **kargs)

Returns a tuple with an xbrl.Instance and xml.ErrorLog object. Constructs a new xbrl.Instance object after processing the XML fragment xbrl. To validate the instance against a specific DTS, supply an xbrl.taxonomy.DTS object using the dts parameters. Optional user XML catalogs can be specified with the catalog argument. Optional taxonomy packages can be specified with the taxonomy_package argument. Optional Units Registry can be specified with the utr argument. Other validation options can be specified using additional kargs. Please consult the RaptorXML CLI documentation http://manual.altova.com/RaptorXML/raptorxmlxbrlserver/rxcli_xbrl_valxbrl.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 xbrl.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 xbrl.Instance.create_from_url(type cls, url, *, DTS dts=None, catalog=None, taxonomy_package=None, utr=None, **kargs)

Returns a tuple with an xbrl.Instance and xml.ErrorLog object. Constructs a new xbrl.Instance object after parsing the XML content retrieved from the given url. To validate the instance against a specific DTS, supply an xbrl.taxonomy.DTS object using the dts parameters. Optional user XML catalogs can be specified with the catalog argument. Optional taxonomy packages can be specified with the taxonomy_package argument. Optional Units Registry can be specified with the utr argument. Other validation options can be specified using additional kargs. Please consult the RaptorXML CLI documentation http://manual.altova.com/RaptorXML/raptorxmlxbrlserver/rxcli_xbrl_valxbrl.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 xbrl.Instance.detect_dts_references(input, *, Catalog catalog=None)
classmethod xbrl.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 xbrl.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 xbrl.Instance.validate_buffer(type cls, buf, *, DTS dts=None, catalog=None, taxonomy_package=None, utr=None, **kargs)

Validates the XBRL instance from the given buffer buf according to the XBRL 2.1, Dimensions 1.0, Formula 1.0 and Table Linkbase 1.0 specification and returns an xml.ErrorLog object with the results. To validate the instance against a specific DTS, supply an xbrl.taxonomy.DTS object using the dts parameters. Optional user XML catalogs can be specified with the catalog argument. Optional taxonomy packages can be specified with the taxonomy_package argument. Optional Units Registry can be specified with the utr argument. Other validation options can be specified using additional kargs. Please consult the RaptorXML CLI documentation http://manual.altova.com/RaptorXML/raptorxmlxbrlserver/rxcli_xbrl_valxbrl.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 xbrl.Instance.validate_element(type cls, ElementInformationItem xbrl, *, DTS dts=None, catalog=None, taxonomy_package=None, utr=None, **kargs)

Validates the XBRL instance from the given XML fragment xbrl according to the XBRL 2.1, Dimensions 1.0, Formula 1.0 and Table Linkbase 1.0 specification and returns an xml.ErrorLog object with the results. To validate the instance against a specific DTS, supply an xbrl.taxonomy.DTS object using the dts parameters. Optional user XML catalogs can be specified with the catalog argument. Optional taxonomy packages can be specified with the taxonomy_package argument. Optional Units Registry can be specified with the utr argument. Other validation options can be specified using additional kargs. Please consult the RaptorXML CLI documentation http://manual.altova.com/RaptorXML/raptorxmlxbrlserver/rxcli_xbrl_valxbrl.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 xbrl.Instance.validate_url(type cls, url, *, DTS dts=None, catalog=None, taxonomy_package=None, utr=None, **kargs)

Validates the XBRL instance at the given url according to the XBRL 2.1, Dimensions 1.0, Formula 1.0 and Table Linkbase 1.0 specification and returns an xml.ErrorLog object with the results. To validate the instance against a specific DTS, supply an xbrl.taxonomy.DTS object using the dts parameters. Optional user XML catalogs can be specified with the catalog argument. Optional taxonomy packages can be specified with the taxonomy_package argument. Optional Units Registry can be specified with the utr argument. Other validation options can be specified using additional kargs. Please consult the RaptorXML CLI documentation http://manual.altova.com/RaptorXML/raptorxmlxbrlserver/rxcli_xbrl_valxbrl.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

xbrl.Instance.arcrole_refs

Returns an iterator of xbrl.taxonomy.ArcroleRef objects which represent the XBRL arcroleRefs present in this instance.

xbrl.Instance.child_facts

Returns an xbrl.FactSet object which represents all the XBRL root level facts in this instance (doesn’t include facts that are children of other tuples).

xbrl.Instance.child_items

Returns an xbrl.FactSet object which represents all the XBRL root level items in this instance (doesn’t include items that are children of other tuples).

xbrl.Instance.child_tuples

Returns an xbrl.FactSet object which represents all the XBRL root level tuples in this instance (doesn’t include tuples that are children of other tuples).

xbrl.Instance.contexts

Returns an iterator of xbrl.Context objects which represent the XBRL contexts present in this instance.

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.

xbrl.Instance.dts

Returns an xbrl.taxonomy.DTS object which represents the XBRL DTS discovered from this instance as a starting point.

xbrl.Instance.facts

Returns an xbrl.FactSet object which represents all the XBRL facts in this instance including facts that are children of other tuples.

Returns an iterator of xbrl.taxonomy.ExtendedLink objects which represent the XBRL footnote links present in this instance.

xbrl.Instance.id

Returns the value of the ‘id’ attribute as a string, or None if the XBRL root element doesn’t have an ‘id’ attribute.

xbrl.Instance.linkbase_refs

Returns an iterator of xbrl.taxonomy.LinkbaseRef objects which represent the XBRL linkbaseRefs present in this instance.

xbrl.Instance.nil_facts

Returns an xbrl.FactSet object which represents all nil XBRL facts in this instance including facts that are children of other tuples.

xbrl.Instance.non_nil_facts

Returns an xbrl.FactSet object which represents all non-nil XBRL facts in this instance including facts that are children of other tuples.

xbrl.Instance.role_refs

Returns an iterator of xbrl.taxonomy.RoleRef objects which represent the XBRL roleRefs present in this 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.

xbrl.Instance.schema_refs

Returns an iterator of xbrl.taxonomy.SchemaRef objects which represent the XBRL schemaRefs present in this instance.

xml.Document.source_document

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

xbrl.Instance.units

Returns an iterator of xbrl.Unit objects which represent the XBRL units present in this instance.

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

xbrl.Instance.arcrole_ref(arcroleURI)

Returns an xbrl.taxonomy.ArcroleRef object which represents the XBRL arcroleRef with the given arcroleURI, or None if no XBRL arcroleRef was found.

xbrl.Instance.context(id)

Returns an xbrl.Context object which represents the XBRL context with the given ‘id’, or None if no XBRL context was found.

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.

xbrl.Instance.find_fact(xpointer)

Returns an xbrl.Fact object which represent the fact with the given ID or at the given XPointer location. Returns None if no appropriate fact can be found.

xbrl.Instance.footnote_base_set(linkrole, arcrole=None)

Returns an xbrl.taxonomy.BaseSet object which represents the base set of footnote arc for the given linkrole and arcrole URI. If arcrole was not specified, the default fact-footnote arcrole is used.

Returns a set with link role URIs for each footnoteLink extended link that contains arcs with the given arcrole. If arcrole was not specified, the default fact-footnote arcrole is used.

xbrl.Instance.footnote_network(linkrole, arcrole=None)

Returns an xbrl.taxonomy.RelationshipNetwork object which represents the network of relationships of footnote arcs for the given linkrole and arcrole URI. If arcrole was not specified, the default fact-footnote arcrole is used.

xbrl.Instance.generate_layout_model(**kargs)

Generates the layout model for all tables defined in the supporting DTS by table resolution and layout against this instance and returns an xbrl.table.layout.TableModel, xml.ErrorLog tuple. Formula parameters can be set using the ‘formula_parameters’ argument by supplying a dict with the user-supplied parameter values. Use the same JSON format as accepted by the –formula-parameters CLI option. The ordering of layout nodes generated by an aspect node can be specified with the ‘aspect_node_order’ parameter which can be either ‘lexical’ or ‘instance’. When ‘preserve_empty_aspect_nodes’ is set to True, a placeholder structural node will created when the aspect node expands to the empty set. When ‘preserve_empty_relationship_nodes’ is set to True, a placeholder structural node will created when the relationship node expands to the empty set. When ‘preserve_merged_rule_nodes’ is set to True, a distinct structural node will be always created even if that node should be merged. When ‘table_elimination’ is set to True, any unpopulated slices (table rows or colulmns) are eliminated from the table.

xbrl.Instance.is_fact_equal(Instance instance, *, aspect_model=altova_xbrlapi_cpp.k_nAspectModel_dimensional, ignore_ids=True, ignore_duplicates=True, force_collapse_whitespace=False, compare_effective_numeric_values=True, compare_nans_as_equal=True)

Compares this XBRL instance with the given instance and returns True if both contain the exactly the same facts. Both instances must reference the same DTS. The following parameters influence the nature of the comparison: The aspect_model argument chooses the aspect model used to determine the aspects of each fact for comparison. Possible values are xbrl.formula.DIMENSIONAL and xbrl.formula.NON_DIMENSIONAL. When ignore_ids is set to True, id attributes on fact elements are not included in the comparison. When ignore_duplicates is set to True, multiple facts with equal aspects and value are collapsed into a single fact. When force_collapse_whitespace is set to True, XML whitespace collapsing is applied to all string values ignoring the whitespace factet of the actual XSD type definition. When compare_effective_numeric_values is set to True, XBRL 2.1 rounding (honoring the decimals/precision attribute) is applied before comparing numeric values. In this case the decimals and precision attributes are not compared anymore. When compare_nans_as_equal is set to True, facts with numeric value NaN are allowed to be a successful match.

xbrl.Instance.process_assertions(**kargs)

Processes all validation assertions defined in the supporting DTS against this instance and returns an xbrl.formula.AssertionProcessingResult, xml.ErrorLog tuple. Formula parameters can be set using the ‘formula_parameters’ argument by supplying a dict with the user-supplied parameter values. Use the same JSON format as accepted by the –formula-parameters CLI option. Other assertion processing options can be specified using additional kargs. Please consult the RaptorXML CLI documentation http://manual.altova.com/RaptorXML/raptorxmlxbrlserver/rxcli_xbrl_valxbrl.htm for a list of available options. Any errors and warnings reported during the assertion processing can be accessed through the returned xml.ErrorLog object.

xbrl.Instance.process_formulas(**kargs)

Processes all formulas defined in the supporting DTS against this instance and returns an xml.Instance, xml.ErrorLog tuple. The actual type of the returned instance can be an xbrl.Instance object if ‘validate_formula_output’ was set to True and the formula generated instance is XBRL 2.1 valid. Formula parameters can be set using the ‘formula_parameters’ argument by supplying a dict with the user-supplied parameter values. Use the same JSON format as accepted by the –formula-parameters CLI option. Other formula processing options can be specified using additional kargs. Please consult the RaptorXML CLI documentation http://manual.altova.com/RaptorXML/raptorxmlxbrlserver/rxcli_xbrl_valxbrl.htm for a list of available options. Any errors and warnings reported during the formula processing can be accessed through the returned xml.ErrorLog object.

xbrl.Instance.role_ref(roleURI)

Returns an xbrl.taxonomy.RoleRef object which represents the XBRL roleRef with the given roleURI, or None if no XBRL roleRef was 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.

xbrl.Instance.unit(id)

Returns an xbrl.Unit object which represents the XBRL uinit with the given ‘id’, or None if no XBRL unit was found.

Special methods

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