All the different kinds of nodes in a DOM tree share
these attributes from
The type of the node as an integer constant.
All nodes have a set of constant attributes that
for the various node types. Here is a table
showing all these constants:
||Represents an attribute of an XML element.|
||Represents a CDATA section.|
Represents a comment
||Represents a fragment of a document.|
||Represents an entire document.|
Represents a document type identifier
||Represents an XML element.|
||Represents an entity.|
Represents a reference to an entity
Represents a processing instruction
||Represents some text.|
The name of the node.
In an element node, this is the element name
"chapter" for a
Attr node, it is
the attribute name.
For a document type node, it is the name of the document type.
For a processing instruction, it is the target name.
The value of the node.
For an attribute node, it is the attribute's value as a string.
For a CDATA section, comment, or text node, it is the text inside the CDATA section, comment, or text section.
For a processing instruction, it is the content part.
Used only for
Element nodes, its value is a
Python dictionary containing the element's attributes.
In this dictionary, the key of each attribute is a
is the attribute's namespace URI, or
None for the default namespace.
is the attribute's unqualified name.
The corresponding value for that key is the attribute value as a Unicode string.
For example, for an attribute expressed as
class='alarm', the key would be
(None, u'class') and the value would be
If the element has children, this attribute is a list
Node objects containing its
children in document order.
Element nodes, this is a list
of its child elements; its attributes are not
considered children in this sense.
DocumentFragment nodes, the
children might include comments, document types,
and processing instructions, as well as an element
child that is the root of the XML document.
If the element has children, this attribute will be set to the first child.
If the element has children, this attribute will be the last child.
For names with a namespace prefix, holds the URI
associated with the namespace; otherwise
None. Compare the
The next child of the same parent, if any,
For every node in the tree, this attribute points
Document node that roots the
The element's parent node, or
the element is the root of the tree.
The namespace prefix of the element, or
None if it doesn't have one.
For example, if in this document namespace prefix
xsl: is defined by
.prefix attribute of
.prefix attribute would be
"xsl", and its
.namespaceURI attribute would
The element's parent's previous child if there is
Node objects include:
Once you have created a node
(e.g., with Section 12.1, “
this method to attach it to a parent node
already had some children, the new node will go after
the existing children.