xml.DocumentInformationItem
¶
The xml.DocumentInformationItem
class represents an XML document and exposes the properties
of the Document Information Item as well
as the post-schema-validation infoset properties for the validation root.
There is exactly one xml.DocumentInformationItem
in the information set, and all other xml.InformationItem
objects
are accessible from the properties of the xml.DocumentInformationItem
, either directly or indirectly
through the properties of other xml.InformationItem
objects.
Base class: xml.InformationItem
-
class
xml.
DocumentInformationItem
¶ Proper instances of this class will be created within RaptorXML only, instantiation from script code will throw a
NotImplementedError
exception.
Attributes¶
-
xml.DocumentInformationItem.
base_uri
¶ Returns the base URI of the document entity.
-
xml.DocumentInformationItem.
character_encoding_scheme
¶ Returns the name of the character encoding scheme in which the document entity is expressed.
-
xml.DocumentInformationItem.
children
¶ Returns an iterator of child
xml.InformationItem
objects, in document order.This provides:
exactly one
xml.ElementInformationItem
,one
xml.ProcessingInstructionInformationItem
for each processing instruction outside the document element,one
xml.CommentInformationItem
for each comment outside the document element andif there is a document type declaration also one
xml.DocumentTypeDeclarationInformationItem
.
-
xml.DocumentInformationItem.
deep_valid
¶ [PSVI] Returns True if the doucment is deep-valid, False otherwise. A document is deep-valid if it is root_valid and no
xml.ElementInformationItem
andxml.AttributeInformationItem
in the document has validity ==xml.Validity.INVALID
.
-
xml.InformationItem.
document
Returns an
xml.Document
object representing the XML instance file containing this information item.
-
xml.DocumentInformationItem.
document_element
¶ Returns the
xml.ElementInformationItem
corresponding to the document element.
-
xml.InformationItem.
first_child
Returns an
xml.InformationItem
object representing the first child information item. Returns None if this information item does not have any children.
-
xml.DocumentInformationItem.
id_idref_table
¶ [PSVI] Returns the ID/IDREF table of the validation root. The ID/IDREF table maps ID values to the
xml.ElementInformationItem
for which this ID was specified.
-
xml.InformationItem.
next
Returns an
xml.InformationItem
object representing the next sibling information item. Returns None if there is no next sibling information item.
-
xml.DocumentInformationItem.
notations
¶ Returns an iterator of
xml.NotationInformationItem
objects declared in the DTD.
-
xml.InformationItem.
prev
Returns an
xml.InformationItem
object representing the previous sibling information item. Returns None if there is no previous sibling information item.
-
xml.DocumentInformationItem.
root_valid
¶ [PSVI] Returns True if the document is root-valid, False otherwise. A document is root-valid if it’s root
xml.ElementInformationItem
has validity ==xml.Validity.VALID
and validation_attempted is eitherxml.ValidationAttempted.FULL
orxml.ValidationAttempted.PARTIAL
.
-
xml.DocumentInformationItem.
source_document
¶ Returns the source
xml.DocumentInformationItem
in case that the Infoset was constructed by an Inline XBRL transformation.
-
xml.DocumentInformationItem.
standalone
¶ Returns an indication of the standalone status of the document, either True or False. This property is derived from the optional standalone document declaration in the XML declaration at the beginning of the document entity, and returns None if there is no standalone document declaration.
-
xml.DocumentInformationItem.
uniformly_valid
¶ [PSVI] Returns True if the document is uniformly-valid, False otherwise. A document is uniformly-valid if it’s root
xml.ElementInformationItem
has validity ==xml.Validity.VALID
and validation_attempted ==xml.ValidationAttempted.FULL
.
-
xml.DocumentInformationItem.
unparsed_entities
¶ Returns an iterator of
xml.UnparsedEntityInformationItem
objects declared in the DTD.
-
xml.DocumentInformationItem.
version
¶ Returns a string representing the XML version of the document. This property is derived from the XML declaration optionally present at the beginning of the document entity, and is None if there is no XML declaration.
Methods¶
-
xml.DocumentInformationItem.
build_element_position_cache
()¶ Precalculates preceeding sibling counts for all
xml.ElementInformationItem
objects and caches them on thexml.DocumentInformationItem
. Subsequent calls toxml.ElementInformationItem.xpointer()
orxml.ElementInformationItem.xpath()
have a runtime in O(d) is the depth of thexml.ElementInformationItem
(i.e. the number of ancestors + 1).
-
xml.DocumentInformationItem.
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.
-
xml.InformationItem.
xlocation_url
(item_value=False) Returns proprietary Altova URL to this Item. If item_value is True the URL references the value content of an Element or Attribute item (is ignored for other kinds).
Special methods¶
__bool__, __eq__, __ge__, __gt__, __le__, __lt__, __ne__