Home | Trees | Index | Help |
|
---|
Package docutils :: Module nodes :: Class Element |
|
Node
--+
|
Element
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)
| |
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)
| |
Return a copy of self. | |
delattr(self,
attr)
| |
emptytag(self)
| |
endtag(self)
| |
extend(self,
item)
| |
Return the index of the first child whose class exactly matches. | |
Return the index of the first child whose class does not match. | |
get(self,
key,
failobj)
| |
Return this element's children. | |
has_key(self,
attr)
| |
hasattr(self,
attr)
| |
index(self,
item)
| |
insert(self,
index,
item)
| |
Return an indented pseudo-XML representation, for test purposes. | |
pop(self,
i)
| |
remove(self,
item)
| |
Replace one child Node with another child or children. | |
Add a new name to the "class" attribute. | |
setdefault(self,
key,
failobj)
| |
shortrepr(self)
| |
starttag(self)
| |
_dom_node(self,
domroot)
| |
Inherited from Node | |
Node instances are always true, even if they're empty. | |
Return a DOM fragment representation of this Node. | |
| |
Traverse a tree of Node objects, calling visit_... methods of
visitor when entering each node. | |
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 toself.children . |
copy(self)Return a copy of self.
|
first_child_matching_class(self, childclass, start=0, end=2147483647)Return the index of the first child whose class exactly matches. Parameters:
|
first_child_not_matching_class(self, childclass, start=0, end=2147483647)Return the index of the first child whose class does not match. Parameters:
|
get_children(self)Return this element's children. |
pformat(self, indent=' ', level=0)Return an indented pseudo-XML representation, for test purposes.
|
replace(self, old, new)Replace one childNode with another child or children. |
set_class(self, name)Add a new name to the "class" attribute. |
Class Variable Details |
---|
child_text_separator
|
tagname
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.0 on Tue Jul 22 05:30:57 2003 | http://epydoc.sf.net |