The Node class is the base class for all nodes in the plasTeX DOM inluding elements, text, etc.
a dictionary containing the attributes, in the case of plasTeX the LaTeX macro arguments
a list of the nodes that are contained by this one. In plasTeX, this generally contains the contents of a LaTeX environment.
boolean indicating whether or not the node only contains whitespace.
the last node in the childNodes list. If there are no child nodes, the value is None.
the name of the node. This is either the special node name as specified in the XML DOM (e.g. #document-fragment, #text, etc.), or, if the node corresponds to an element, it is the name of the element.
integer indicating the type of the node. The node types are defined as:
Node.ELEMENT_NODE
Node.ATTRIBUTE_NODE
Node.TEXT_NODE
Node.CDATA_SECTION_NODE
Node.ENTITY_REFERENCE_NODE
Node.ENTITY_NODE
Node.PROCESSING_INSTRUCTION_NODE
Node.COMMENT_NODE
Node.DOCUMENT_NODE
Node.DOCUMENT_TYPE_NODE
Node.DOCUMENT_FRAGMENT_NODE
Node.NOTATION_NODE
Note: These are defined by the XML DOM, not all of them are used by plasTeX.
refers to the node that contains this node
the node in the document that is adjacent to and immediately before this node. If one does not exist, the value is None.
the node in the document that is adjacent to and immediately after this node. If one does not exist, the value is None.
the node that owner of, and ultimate parent of, all nodes in the document
contains just the text content of this node
specifies a unicode string that could be used in place of the node. This unicode string will be converted into tokens in the plasTeX output stream.
dictionary used for holding user-defined data
create a new node that is the sum of self and other. This allows you to use nodes in Python statements like: node + other.
adds a new child to the end of the child nodes
same as append
create a clone of the current node. If deep is true, then the attributes and child nodes are cloned as well. Otherwise, all references to attributes and child nodes will be shared between the nodes.
same as isEqualNode, but allows you to compare nodes using the Python statement: node == other.
appends other to list of children then returns self
returns the child node at the index given by i. This allows you to use Python’s slicing syntax to retrieve child nodes: node[i].
retrieves the data in the userdata dictionary under the name key
returns a boolean indicating whether or not this node has attributes defined
returns a boolean indicating whether or not the node has child nodes
same as extend. This allows you to use nodes in Python statements like: node += other.
inserts node newChild into position i in the child nodes list
inserts newChild before refChild in this node. If refChild is not found, a NotFoundErr exception is raised.
indicates whether the given node is equivalent to this one
indicates whether the given node is the same node as this one
returns an iterator that iterates over the child nodes. This allows you to use Python’s iter() function on nodes.
returns the number of child nodes. This allows you to use Python’s len() function on nodes.
combine consecutive text nodes and remove comments in this node
removes child node and the index given by index. If no index is specified, the last child is removed.
create a new node that is the sum of other and self. This allows you to use nodes in Python statements like: other + node.
replaces oldChild with newChild in this node. If oldChild is not found, a NotFoundErr exception is raised.
removes oldChild from this node. If oldChild is not found, a NotFoundErr exception is raised.
sets the item at index i to node. This allows you to use Python’s slicing syntax to insert child nodes; see the example below.
mynode[5] = othernode mynode[6:10] = [node1, node2]
put data specified in data into the userdata dictionary under the name given by key
return an XML representation of the node