A Document object represents an XML document information item.

class xml.Document



The base URI of the document entity.


The name of the character encoding scheme in which the document entity is expressed.


An ordered list of child information items, in document order. The list contains exactly one element information item. The list also contains one processing instruction information item for each processing instruction outside the document element, and one comment information item for each comment outside the document element. Processing instructions and comments within the DTD are excluded. If there is a document type declaration, the list also contains a document type declaration information item.


The element information item corresponding to the document element.


An unordered set of notation information items, one for each notation declared in the DTD.


An indication of the standalone status of the document, either True or False. This attribute 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.


An unordered set of unparsed entity information items, one for each unparsed entity declared in the DTD.


A string representing the XML version of the document. This attribute is derived from the XML declaration optionally present at the beginning of the document entity, and is None if there is no XML declaration.

Special methods

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