arelle.XmlUtil

See COPYRIGHT.md for copyright information.

Module Contents

Functions

Data

API

arelle.XmlUtil.htmlEltUriAttrs: dict[str, Collection[str]] | None

None

arelle.XmlUtil.resolveHtmlUri: Callable[[arelle.ModelObject.ModelObject, str | bytes | None, str | bytes | None], str] | None

None

arelle.XmlUtil.datetimePattern

‘compile(…)’

arelle.XmlUtil.xmlDeclarationPattern

‘compile(…)’

arelle.XmlUtil.xmlEncodingPattern

‘compile(…)’

arelle.XmlUtil.xpointerFragmentIdentifierPattern

‘compile(…)’

arelle.XmlUtil.xmlnsStripPattern

‘compile(…)’

arelle.XmlUtil.nonSpacePattern

‘compile(…)’

exception arelle.XmlUtil.XmlDeclarationLocationException

Bases: Exception

arelle.XmlUtil.xmlns(element: arelle.ModelObject.ModelObject, prefix: str | None) str | None
arelle.XmlUtil.xmlnsprefix(element: lxml.etree._Element | arelle.ModelObject.ModelObject, ns: str | None) str | None
arelle.XmlUtil.targetNamespace(element: arelle.ModelObject.ModelObject) str | None
arelle.XmlUtil.schemaLocation(element: lxml.etree._Element, namespace: str, returnElement: bool = False) lxml.etree._Element | str | None
arelle.XmlUtil.clarkNotationToPrefixNsLocalname(element: arelle.ModelObject.ModelObject, clarkName: str, isAttribute: bool = False) tuple[str | None, str | None, str]
arelle.XmlUtil.clarkNotationToPrefixedName(element: arelle.ModelObject.ModelObject, clarkName: str, isAttribute: bool = False) str
arelle.XmlUtil.prefixedNameToNamespaceLocalname(element: arelle.ModelObject.ModelObject, prefixedName: str, defaultNsmap: Mapping[str, str] | None = None) tuple[str | None, str, str | None] | None
arelle.XmlUtil.prefixedNameToClarkNotation(element: arelle.ModelObject.ModelObject, prefixedName: str) str | None
arelle.XmlUtil.encoding(xml: arelle.XmlUtil.encoding.str | bytes, default: arelle.XmlUtil.encoding.str = 'utf-8') arelle.XmlUtil.encoding.str
arelle.XmlUtil.text(element: arelle.ModelObject.ModelObject | arelle.PrototypeDtsObject.PrototypeObject) str
arelle.XmlUtil.childText(element: arelle.ModelObject.ModelObject, childNamespaceURIs: str | None, childLocalNames: tuple[str, ...]) str | None
arelle.XmlUtil.textNotStripped(element: arelle.ModelObject.ModelObject | arelle.PrototypeDtsObject.PrototypeObject | None) str
arelle.XmlUtil.selfClosable(elt: arelle.ModelObject.ModelObject) bool
arelle.XmlUtil.innerText(element: arelle.ModelObject.ModelObject, ixExclude: bool = False, ixEscape: str | None = None, ixContinuation: bool = False, ixResolveUris: bool = False, strip: bool = True) str
arelle.XmlUtil.innerTextList(element: arelle.ModelObject.ModelObject, ixExclude: bool = False, ixEscape: str | None = None, ixContinuation: bool = False, ixResolveUris: bool = False) str
arelle.XmlUtil.innerTextNodes(element: arelle.ModelObject.ModelObject | None, ixExclude: bool | str, ixEscape: str | None, ixContinuation: bool, ixResolveUris: bool) Generator[str, None, None]
arelle.XmlUtil.escapedNode(elt: arelle.ModelObject.ModelObject, start: bool, empty: bool, ixEscape: str, ixResolveUris: bool) str
arelle.XmlUtil.escapedText(text: str) str
arelle.XmlUtil.collapseWhitespace(s: str) str
arelle.XmlUtil.parentId(element: arelle.ModelObject.ModelObject, parentNamespaceURI: str, parentLocalName: str) str | None
arelle.XmlUtil.hasChild(element: arelle.ModelObject.ModelObject, childNamespaceURI: str, childLocalNames: str) bool
arelle.XmlUtil.hasDescendant(element: arelle.ModelObject.ModelObject, descendantNamespaceURI: str, descendantLocalNames: str) bool
arelle.XmlUtil.hasAncestor(element: arelle.ModelObject.ModelObject, ancestorNamespaceURI: str, ancestorLocalNames: str | tuple[str, ...]) bool
arelle.XmlUtil.ancestor(element: arelle.ModelObject.ModelObject, ancestorNamespaceURI: str, ancestorLocalNames: str | tuple[str, ...]) arelle.ModelObject.ModelObject | None
arelle.XmlUtil.parent(element: arelle.ModelObject.ModelObject, parentNamespaceURI: str | None = None, parentLocalNames: str | tuple[str, ...] | None = None, ixTarget: bool = False) arelle.ModelObject.ModelObject | None
arelle.XmlUtil.ancestors(element: arelle.ModelObject.ModelObject, ancestorNamespaceURI: str | None = None, ancestorLocalNames: str | tuple[str, ...] | None = None) list[arelle.ModelObject.ModelObject]
arelle.XmlUtil.ancestorOrSelfAttr(element: arelle.ModelObject.ModelObject, attrClarkName: str) str | None
arelle.XmlUtil.childAttr(element: arelle.ModelObject.ModelObject, childNamespaceURI: str, childLocalNames: str | tuple[str, ...], attrClarkName: str) str | None
arelle.XmlUtil.descendantAttr(element: arelle.ModelObject.ModelObject, childNamespaceURI: str, childLocalNames: str | tuple[str, ...], attrClarkName: str, attrName: str | None = None, attrValue: str | None = None) str | None
arelle.XmlUtil.children(element: arelle.ModelObject.ModelObject | lxml.etree._ElementTree | arelle.PrototypeDtsObject.PrototypeElementTree, childNamespaceURIs: str | tuple[str, ...] | None, childLocalNames: str | tuple[str, ...], ixTarget: bool = False) Sequence[arelle.ModelObject.ModelObject]
arelle.XmlUtil.child(element: arelle.ModelObject.ModelObject, childNamespaceURI: str | tuple[str, ...] | None = None, childLocalNames: str | tuple[str, ...] = ('*',)) arelle.ModelObject.ModelObject | None
arelle.XmlUtil.lastChild(element: arelle.ModelObject.ModelObject, childNamespaceURI: str | tuple[str, ...] | None = None, childLocalNames: str | tuple[str, ...] = ('*',)) arelle.ModelObject.ModelObject | arelle.ModelInstanceObject.ModelContext | arelle.ModelInstanceObject.ModelUnit | None
arelle.XmlUtil.previousSiblingElement(element: arelle.ModelObject.ModelObject) arelle.ModelObject.ModelObject | None
arelle.XmlUtil.nextSiblingElement(element: arelle.ModelObject.ModelObject) arelle.ModelObject.ModelObject | None
arelle.XmlUtil.childrenAttrs(element: arelle.ModelObject.ModelObject, childNamespaceURI: str, childLocalNames: str | tuple[str, ...], attrLocalName: str) list[str]
arelle.XmlUtil.descendant(element: arelle.ModelObject.ModelObject | arelle.PrototypeDtsObject.PrototypeObject, descendantNamespaceURI: str | None, descendantLocalNames: str | tuple[str, ...], attrName: str | None = None, attrValue: str | None = None) arelle.ModelObject.ModelObject | arelle.PrototypeDtsObject.PrototypeObject | None
arelle.XmlUtil.descendants(element: arelle.ModelObject.ModelObject | arelle.PrototypeDtsObject.PrototypeObject | lxml.etree._ElementTree, descendantNamespaceURI: str | None, descendantLocalNames: str | tuple[str, ...], attrName: str | None = None, attrValue: str | None = None, breakOnFirst: bool = False, ixTarget: bool = False) Sequence[arelle.ModelObject.ModelObject | arelle.PrototypeDtsObject.PrototypeObject]
arelle.XmlUtil.isDescendantOf(element: arelle.ModelObject.ModelObject, ancestorElement: arelle.ModelObject.ModelObject) bool
arelle.XmlUtil.schemaDescendantsNames(element: arelle.ModelObject.ModelObject, descendantNamespaceURI: str, descendantLocalName: str, qnames: set[arelle.ModelValue.QName | None] | None = None) set[arelle.ModelValue.QName | None]
arelle.XmlUtil.schemaDescendant(element: arelle.ModelObject.ModelObject, descendantNamespaceURI: str, descendantLocalName: str, name: str) arelle.ModelObject.ModelObject | None
arelle.XmlUtil.schemaBaseTypeDerivedFrom(element: arelle.ModelObject.ModelObject) Any
arelle.XmlUtil.schemaFacets(element: lxml.etree._Element, facetTags: list[str], facets: list[lxml.etree._Element | None] | None = None) list[lxml.etree._Element | None]
arelle.XmlUtil.schemaAttributesGroups(element: lxml.etree._Element, attributes: list[lxml.etree._Element] | None = None, attributeWildcards: list[lxml.etree._Element] | None = None, attributeGroups: list[lxml.etree._Element] | None = None) tuple[list[lxml.etree._Element], list[lxml.etree._Element], list[lxml.etree._Element]]
arelle.XmlUtil.emptyContentModel(element: lxml.etree._Element) bool
arelle.XmlUtil.addChild(parent: arelle.ModelObject.ModelObject, childName1: str | arelle.ModelValue.QName, childName2: str | None = None, attributes: Sequence[tuple[str | arelle.ModelValue.QName, str]] | dict[str | arelle.ModelValue.QName, str] | tuple[str, str] | None = None, text: str | None = None, afterSibling: arelle.ModelObject.ModelObject | None = None, beforeSibling: arelle.ModelObject.ModelObject | None = None, appendChild: bool = True) arelle.ModelObject.ModelObject
arelle.XmlUtil.copyNodes(parent: arelle.ModelObject.ModelObject, elts: Sequence[arelle.ModelObject.ModelObject] | arelle.ModelObject.ModelObject) None
arelle.XmlUtil.copyChildren(parent: arelle.ModelObject.ModelObject, elt: arelle.ModelObject.ModelObject) None
arelle.XmlUtil.copyIxFootnoteHtml(srcXml: lxml.etree._Element, tgtHtml: lxml.etree._Element, targetModelDocument: arelle.ModelDocument.ModelDocument | None = None, withText: bool = False, isContinChainElt: bool = True, tgtStack: list[list[lxml.etree._Element | str]] | None = None, srcLevel: int = 0) None
arelle.XmlUtil.addComment(parent: arelle.ModelObject.ModelObject, commentText: str) None
arelle.XmlUtil.addProcessingInstruction(parent: arelle.ModelObject.ModelObject, piTarget: str | bytes, piText: str, insertBeforeChildElements: bool = True, insertBeforeParentElement: bool = False) None
arelle.XmlUtil.addQnameValue(modelDocument: arelle.ModelDocument.ModelDocument, qnameValue: arelle.ModelValue.QName | str) str
arelle.XmlUtil.setXmlns(modelDocument: lxml.etree._ElementTree | arelle.ModelDocument.ModelDocument, prefix: str | None, namespaceURI: str) None
arelle.XmlUtil.sortKey(parentElement: arelle.ModelObject.ModelObject, childNamespaceUri: str, childLocalNames: tuple[str, ...], childAttributeName: str | None = None, qnames: bool = False) list[tuple[str, str, str | None]]
arelle.XmlUtil.DATETIME_MINYEAR

‘datetime(…)’

arelle.XmlUtil.DATETIME_MAXYEAR

‘datetime(…)’

arelle.XmlUtil.tzinfo(tz: str | None) datetime.timezone | None
arelle.XmlUtil.datetimeValue(element: arelle.ModelObject.ModelObject, addOneDay: bool = False, none: str | None = None, subtractOneDay: bool = False) datetime.datetime | None

Parses text value from element as a datetime.

If element is None, returns None, unless none is provided: “minyear”: minimum datetime value “maxyear”: maximum datetime value

If the text value does not match a date/datetime pattern, returns None.

If the text value has a time portion with 24:00:00, the date is rolled forward to it’s 00:00:00 equivalent.

If the text value has a time portion and subtractOneDay is True, 00:00:00 datetimes will cause a day to be subtracted from the result.

If the text value does not have a time portion and addOneDay is True, a day will be added to the result.

Parameters:
  • element – Element that provides text value to be parsed.

  • addOneDay – If value does not have a time portion, add one day

  • none – Determines what to return if element is None. “minyear” or “maxyear”

  • subtractOneDay – If value has a zero-valued time portion, subtract one day

Returns:

arelle.XmlUtil.dateunionValue(datetimeValue: Any, subtractOneDay: bool = False, dateOnlyHour: int | None = None) str
arelle.XmlUtil.xpointerSchemes(fragmentIdentifier: str) list[tuple[str, str]]
arelle.XmlUtil.xpointerElement(modelDocument: arelle.ModelDocument.ModelDocument, fragmentIdentifier: str) lxml.etree._Element | arelle.ModelObject.ModelObject | None
arelle.XmlUtil.elementFragmentIdentifier(element: lxml.etree.ElementBase | lxml.etree._Element | arelle.ModelObject.ModelObject | None) str | None
arelle.XmlUtil.elementIndex(element: Any) int
arelle.XmlUtil.elementChildSequence(element: lxml.etree._Element | lxml.etree.ElementBase | arelle.ModelObject.ModelObject | None) str
arelle.XmlUtil.elementTagnamesPath(element: lxml.etree._Element | arelle.ModelObject.ModelObject | None) str
arelle.XmlUtil.xmlstring(elt: lxml.etree._Element | arelle.ModelObject.ModelObject, stripXmlns: bool = False, prettyPrint: bool = False, contentsOnly: bool = False, includeText: bool = False) str
arelle.XmlUtil.writexml(writer: TextIO, node: lxml.etree._ElementTree | lxml.etree._Element | arelle.ModelObject.ModelObject, encoding: str | None = None, indent: str = '', xmlcharrefreplace: bool = False, edgarcharrefreplace: bool = False, skipInvalid: bool = False, parentNsmap: dict[str | None, str] | None = None) None