Package docutils :: Module nodes :: Class Node
[show private | hide private]
[frames | no frames]

Class Node

Known Subclasses:
Element, Text

Abstract base class of nodes in a document tree.
Method Summary
  __nonzero__(self)
Node instances are always true, even if they're empty.
  asdom(self, dom)
Return a DOM fragment representation of this Node.
  copy(self)
Return a copy of self.
  pformat(self, indent, level)
Return an indented pseudo-XML representation, for test purposes.
  setup_child(self, child)
  walk(self, visitor)
Traverse a tree of Node objects, calling visit_... methods of visitor when entering each node.
  walkabout(self, visitor)
Perform a tree traversal similarly to Node.walk() (which see), except also call depart_... methods before exiting each node.

Class Variable Summary
NoneType document = None                                                                  
NoneType line = None                                                                  
NoneType parent = None                                                                  
NoneType source = None                                                                  

Method Details

__nonzero__(self)
(Boolean test operator)

Node instances are always true, even if they're empty. A node is more than a simple container. Its boolean "truth" does not depend on having one or more subnodes in the doctree.

Use len() to check node length. Use None to represent a boolean false value.

asdom(self, dom=<module 'xml.dom.minidom' from '/usr/lib/python2.2/site-p...)

Return a DOM fragment representation of this Node.

copy(self)

Return a copy of self.

pformat(self, indent='    ', level=0)

Return an indented pseudo-XML representation, for test purposes.

walk(self, visitor)

Traverse a tree of Node objects, calling visit_... methods of visitor when entering each node. If there is no visit_particular_node method for a node of type particular_node, the unknown_visit method is called. (The walkabout() method is similar, except it also calls depart_... methods before exiting each node.)

This tree traversal supports limited in-place tree modifications. Replacing one node with one or more nodes is OK, as is removing an element. However, if the node removed or replaced occurs after the current node, the old node will still be traversed, and any new nodes will not.

Within visit_... methods (and depart_... methods for walkabout()), TreePruningException subclasses may be raised (SkipChildren, SkipSiblings, SkipNode, SkipDeparture).

Parameter visitor: A NodeVisitor object, containing a visit_... method for each Node subclass encountered.

walkabout(self, visitor)

Perform a tree traversal similarly to Node.walk() (which see), except also call depart_... methods before exiting each node. If there is no depart_particular_node method for a node of type particular_node, the unknown_departure method is called.

Parameter visitor: A NodeVisitor object, containing visit_... and depart_... methods for each Node subclass encountered.


Class Variable Details

document

Type:
NoneType
Value:
None                                                                  

line

Type:
NoneType
Value:
None                                                                  

parent

Type:
NoneType
Value:
None                                                                  

source

Type:
NoneType
Value:
None                                                                  

Generated by Epydoc 2.0 on Tue Jul 22 05:30:43 2003 http://epydoc.sf.net