arelle.ModelObject

See COPYRIGHT.md for copyright information.

Module Contents

Classes

ModelObject

ModelObjects represent the XML elements within a document, and are implemented as custom lxml proxy objects. Each modelDocument has a parser with the parser objects in ModelObjectFactory.py, to determine the type of model object to correspond to a proxied lxml XML element. Both static assignment of class, by namespace and local name, and dynamic assignment, by dynamic resolution of element namespace and local name according to the dynamically loaded schemas, are used in the ModelObjectFactory.

ModelComment

ModelConcept is a custom proxy objects for etree.

ModelProcessingInstruction

ModelProcessingInstruction is a custom proxy object for etree.

ModelAttribute

.. class:: ModelAttribute(modelElement, attrTag, xValid, xValue, sValue, text)

ObjectPropertyViewWrapper

Functions

Data

API

arelle.ModelObject.XmlUtil: Any

None

arelle.ModelObject.emptySet: set[Any]

‘set(…)’

arelle.ModelObject.init() None
class arelle.ModelObject.ModelObject

Bases: arelle.model.ElementBase

ModelObjects represent the XML elements within a document, and are implemented as custom lxml proxy objects. Each modelDocument has a parser with the parser objects in ModelObjectFactory.py, to determine the type of model object to correspond to a proxied lxml XML element. Both static assignment of class, by namespace and local name, and dynamic assignment, by dynamic resolution of element namespace and local name according to the dynamically loaded schemas, are used in the ModelObjectFactory.

ModelObjects are grouped into Python modules to ensure minimal inter-package references (which causes a performance impact). ModelDtsObjects collects DTS objects (schema and linkbase), ModelInstanceObjects collects instance objects (facts, contexts, dimensions, and units), ModelTestcaseObject collects testcase and variation objects, ModelVersioningObject has specialized objects representing versioning report contents, and ModelRssItem represents the item objects in an RSS feed.

The ModelObject custom lxml proxy object is implemented as a specialization of etree.ElementBase, and used as the superclass of discovered and created objects in XML-based objects in Arelle. ModelObject is also used as a phantom proxy object, for non-XML objects that are resolved from modelDocument objects, such as the ModelRelationship object. ModelObjects persistent with their owning ModelDocument, due to reference by modelObject list in modelDocument object.

(The attributes and methods for ModelObject are in addition to those for lxml base class, _ElementBase.)

.. attribute:: modelDocument
Owning ModelDocument object

.. attribute:: modelXbrl
modelDocument's owning ModelXbrl object

.. attribute:: localName
W3C DOM localName

.. attribute:: prefixedName
Prefix by ancestor xmlns and localName of element

.. attribute:: namespaceURI
W3C DOM namespaceURI (overridden for schema elements)

.. attribute:: elementNamespaceURI
W3C DOM namespaceURI (not overridden by subclasses)

.. attribute:: qname
QName of element (overridden for schema elements)

.. attribute:: elementQname
QName of element (not overridden by subclasses)

.. attribute:: parentQname
QName of parent element

.. attribute:: id
Id attribute or None

.. attribute:: elementAttributesTuple
Python tuple of (tag, value) of specified attributes of element, where tag is in Clark notation

.. attribute:: elementAttributesStr
String of tag=value[,tag=value...] of specified attributes of element

.. attribute:: xValid
XmlValidation.py validation state enumeration

.. attribute:: xValue
PSVI value (for formula processing)

.. attribute:: sValue
s-equals value (for s-equality)

.. attribute:: xAttributes
Dict by attrTag of ModelAttribute objects (see below) of specified and default attributes of this element.
_elementQname: arelle.ModelValue.QName

None

_parentQname: arelle.ModelValue.QName | None

None

_elementSequence: int

None

_namespaceURI: str | None

None

_hashSEqual: int

None

_hashXpathEqual: int

None

sValue: arelle.ModelValue.TypeSValue

None

xAttributes: dict[str, ModelAttribute]

None

xValue: arelle.ModelValue.TypeXValue

None

xValueError: Exception | None

None

xValid: int

None

xlinkLabel: str

None

targetModelXbrl: arelle.ModelXbrl.ModelXbrl

None

_init() None
clear() None
init(modelDocument: arelle.ModelDocument.ModelDocument) None
objectId(refId: str = '') str

Returns a string surrogate representing the object index of the model document, prepended by the refId string.

Parameters:

refId (str) – A string to prefix the refId for uniqueless (such as to use in tags for tkinter)

property modelXbrl: arelle.ModelXbrl.ModelXbrl | None
attr(attrname: str) str | None
property slottedAttributesNames: set[Any]
setNamespaceLocalName() None
getStripped(attrName: str) str | None
property localName: str
property prefixedName: str
property namespaceURI: str | None
property elementNamespaceURI: str | None
property qname: arelle.ModelValue.QName
property elementQname: arelle.ModelValue.QName
vQname(validationModelXbrl: arelle.ModelXbrl.ModelXbrl | None = None) arelle.ModelValue.QName
elementDeclaration(validationModelXbrl: arelle.ModelXbrl.ModelXbrl | None = None) arelle.ModelDtsObject.ModelConcept | None
property elementSequence: int
property parentQname: arelle.ModelValue.QName | None
property id: str | None
property stringValue: str
property textValue: str
_textNodes(recurse: bool = False) Generator[str | Any, None, None]
property document: arelle.ModelDocument.ModelDocument
prefixedNameQname(prefixedName: str | None) arelle.ModelValue.QName | None

Returns ModelValue.QName of prefixedName using this element and its ancestors’ xmlns.

Parameters:

prefixedName (str) – A prefixed name string

Returns:

QName – the resolved prefixed name, or None if no prefixed name was provided

property elementAttributesTuple: tuple[Any, ...]
property elementAttributesStr: str
resolveUri(hrefObject: tuple[str, arelle.ModelDocument.ModelDocument, str] | None = None, uri: str | None = None, dtsModelXbrl: arelle.ModelXbrl.ModelXbrl | None = None) arelle.ModelObject.ModelObject | None

Returns the modelObject within modelDocment that resolves a URI based on arguments relative to this element

Parameters:
  • hrefObject – an optional tuple of (hrefElement, modelDocument, id), or

  • uri (str) – An (element scheme pointer), and dtsModelXbrl (both required together if for a multi-instance href)

  • dtsModelXbrl (ModelXbrl) – DTS of href resolution (default is the element’s own modelXbrl)

Returns:

ModelObject – Document node corresponding to the href or resolved uri

genLabel(role: str | None = None, fallbackToQname: bool = False, fallbackToXlinkLabel: bool = False, lang: str | None = None, strip: bool = False, linkrole: str | None = None) str | None
viewText(labelrole: str | None = None, lang: str | None = None) str
property propertyView: tuple[Any, ...]
__repr__() str
class arelle.ModelObject.ModelComment

Bases: arelle.model.CommentBase

ModelConcept is a custom proxy objects for etree.

_init() None
init(modelDocument: arelle.ModelDocument.ModelDocument) None
class arelle.ModelObject.ModelProcessingInstruction

Bases: arelle.model.PIBase

ModelProcessingInstruction is a custom proxy object for etree.

_init() None
class arelle.ModelObject.ModelAttribute(modelElement: arelle.ModelObject.ModelObject | arelle.ModelDtsObject.ModelLink | arelle.ModelDtsObject.ModelLocator | arelle.ModelDtsObject.ModelResource | arelle.ModelInstanceObject.ModelInlineXbrliXbrl | arelle.ModelInstanceObject.ModelInlineFact | arelle.ModelInstanceObject.ModelDimensionValue | arelle.ModelInstanceObject.ModelInlineFootnote, attrTag: str, xValid: int, xValue: arelle.ModelValue.TypeXValue, sValue: arelle.ModelValue.TypeSValue, text: str)

.. class:: ModelAttribute(modelElement, attrTag, xValid, xValue, sValue, text)

ModelAttribute is a class of slot-based instances to store PSVI attribute values for each ModelObject that has been validated. It does not correspond to, or proxy, any lxml object.

Parameters:
  • modelElement (ModelObject) – owner element of attribute node

  • attrTag (str) – Clark notation attribute tag (from lxml)

  • xValid – XmlValidation.py validation state enumeration

  • xValue – PSVI value (for formula processing)

  • sValue – s-equals value (for s-equality)

Initialization

__slots__

(‘modelElement’, ‘attrTag’, ‘xValid’, ‘xValue’, ‘sValue’, ‘text’)

class arelle.ModelObject.ObjectPropertyViewWrapper(modelObject: arelle.ModelObject.ModelObject, extraProperties: tuple[Any, ...] = ())

Initialization

__slots__

(‘modelObject’, ‘extraProperties’)

modelObject: arelle.ModelObject.ModelObject

None

property propertyView: tuple[Any, ...]
__repr__() str