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

Class Element

Node --+
       |
      Element

Known Subclasses:
admonition, attention, authors, block_quote, bullet_list, caution, citation, colspec, danger, decoration, definition, definition_list, definition_list_item, description, docinfo, document, entry, enumerated_list, error, field, field_body, field_list, figure, footer, footnote, header, hint, important, legend, list_item, meta, note, option, option_group, option_list, option_list_item, pending, row, section, sidebar, system_message, table, tbody, TextElement, tgroup, thead, tip, topic, transition, warning

Element is the superclass to all specific elements.

Elements contain attributes and child nodes. Elements emulate dictionaries for attributes, indexing by attribute name (a string). To set the attribute 'att' to 'value', do:

element['att'] = 'value'

Elements also emulate lists for child nodes (element nodes and/or text nodes), indexing by integer. To get the first child node, use:

element[0]

Elements may be constructed using the += operator. To add one new child node to element, do:

element += node

This is equivalent to element.append(node).

To add a list of multiple child nodes at once, use the same += operator:

element += [node1, node2]

This is equivalent to element.extend([node1, node2]).


Method Summary
  __init__(self, rawsource, *children, **attributes)
  __add__(self, other)
  __delitem__(self, key)
  __getitem__(self, key)
  __iadd__(self, other)
Append a node or a list of nodes to self.children.
  __len__(self)
  __radd__(self, other)
  __repr__(self)
  __setitem__(self, key, item)
  __str__(self)
  __unicode__(self)
  append(self, item)
  astext(self)
  attlist(self)
  copy(self)
Return a copy of self.
  delattr(self, attr)
  emptytag(self)
  endtag(self)
  extend(self, item)
  first_child_matching_class(self, childclass, start, end)
Return the index of the first child whose class exactly matches.
  first_child_not_matching_class(self, childclass, start, end)
Return the index of the first child whose class does not match.
  get(self, key, failobj)
  get_children(self)
Return this element's children.
  has_key(self, attr)
  hasattr(self, attr)
  index(self, item)
  insert(self, index, item)
  pformat(self, indent, level)
Return an indented pseudo-XML representation, for test purposes.
  pop(self, i)
  remove(self, item)
  replace(self, old, new)
Replace one child Node with another child or children.
  set_class(self, name)
Add a new name to the "class" attribute.
  setdefault(self, key, failobj)
  shortrepr(self)
  starttag(self)
    Inherited from Node
  __nonzero__(self)
Node instances are always true, even if they're empty.
  asdom(self, dom)
Return a DOM fragment representation of this Node.
  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
str child_text_separator = '\n\n'
NoneType tagname = None                                                                  
    Inherited from Node
NoneType document = None                                                                  
NoneType line = None                                                                  
NoneType parent = None                                                                  
NoneType source = None                                                                  

Method Details

__iadd__(self, other)

Append a node or a list of nodes to self.children.

copy(self)

Return a copy of self.
Overrides:
docutils.nodes.Node.copy (inherited documentation)

first_child_matching_class(self, childclass, start=0, end=2147483647)

Return the index of the first child whose class exactly matches.

Parameters:

  • childclass: A Node subclass to search for, or a tuple of Node classes. If a tuple, any of the classes may match.
  • start: Initial index to check.
  • end: Initial index to not check.

first_child_not_matching_class(self, childclass, start=0, end=2147483647)

Return the index of the first child whose class does not match.

Parameters:

  • childclass: A Node subclass to skip, or a tuple of Node classes. If a tuple, none of the classes may match.
  • start: Initial index to check.
  • end: Initial index to not check.

get_children(self)

Return this element's children.

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

Return an indented pseudo-XML representation, for test purposes.
Overrides:
docutils.nodes.Node.pformat (inherited documentation)

replace(self, old, new)

Replace one child Node with another child or children.

set_class(self, name)

Add a new name to the "class" attribute.

Class Variable Details

child_text_separator

Type:
str
Value:
'''

'''                                                                    

tagname

Type:
NoneType
Value:
None                                                                  

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