Nodes
A node is the representation of an XML element or character data (i.e. text).
They are passed as the argument to handlers functions.
<p>Hello, world!</p>
The XML document above has two nodes:
- An element node of name
p; - A text node of text
Hello, world!, whose parent if the previous node.
XMLElement
name-
The name of the element, without the namespace.
namespace-
The namespace of the element (or an empty string if no namespace).
attributes-
The attributes of the node as a
dict-like object. parents-
All parents of the node, in order, as a
tupleofXMLElementinstances. iter_from,return_from-
Methods to handle the children of the node, same as
Parserinstances. text-
A property to get a
strrepresentation of the text of the node.Warning
Using the
textproperty parses all the children of the XML element until the closing element is found. As a result, you have to choose between callingiter_from,return_from, or accessing thetextproperty, otherwise an exception will be raised.
XMLText
text-
The text of the node.
parents-
All parents of the node, in order, as a
tupleofXMLElementinstances.