Instances are terminal nodes (leaves) containing text only; no child nodes or attributes. Initialize by passing a string to the constructor. Access the text itself with the astext method.
There are no implemented interfaces.
asdom(dom=None)
Return a DOM fragment representation of this Node.
astext()
capitalize()
center(width, *args)
copy()
count(sub, start=0, end=2147483647)
decode(encoding=None, errors=None)
deepcopy()
encode(encoding=None, errors=None)
endswith(suffix, start=0, end=2147483647)
expandtabs(tabsize=8)
find(sub, start=0, end=2147483647)
index(sub, start=0, end=2147483647)
isalnum()
isalpha()
isdecimal()
isdigit()
islower()
isnumeric()
isspace()
istitle()
isupper()
join(seq)
ljust(width, *args)
lower()
lstrip(chars=None)
next_node(condition=None, include_self=0, descend=1, siblings=0, ascend=0)
Return the first node in the iterable returned by traverse(), or None if the iterable is empty.
Parameter list is the same as of traverse. Note that include_self defaults to 0, though.
pformat(indent=' ', level=0)
replace(old, new, maxsplit=-1)
rfind(sub, start=0, end=2147483647)
rindex(sub, start=0, end=2147483647)
rjust(width, *args)
rsplit(sep=None, maxsplit=-1)
rstrip(chars=None)
setup_child(child)
shortrepr()
split(sep=None, maxsplit=-1)
splitlines(keepends=0)
startswith(prefix, start=0, end=2147483647)
strip(chars=None)
swapcase()
title()
translate(*args)
traverse(condition=None, include_self=1, descend=1, siblings=0, ascend=0)
Return an iterable containing
If condition is not None, the iterable contains only nodes for which condition(node) is true. If condition is a node class cls, it is equivalent to a function consisting of return isinstance(node, cls).
If ascend is true, assume siblings to be true as well.
For example, given the following tree:
<paragraph> <emphasis> <--- emphasis.traverse() and <strong> <--- strong.traverse() are called. Foo Bar <reference name="Baz" refid="baz"> Baz
Then list(emphasis.traverse()) equals
[<emphasis>, <strong>, <#text: Foo>, <#text: Bar>]
and list(strong.traverse(ascend=1)) equals
[<strong>, <#text: Foo>, <#text: Bar>, <reference>, <#text: Baz>]
upper()
walk(visitor)
Traverse a tree of Node objects, calling the dispatch_visit() method of visitor when entering each node. (The walkabout() method is similar, except it also calls the dispatch_departure() method 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 implementation for each Node subclass encountered.
walkabout(visitor)
Perform a tree traversal similarly to Node.walk() (which see), except also call the dispatch_departure() method before exiting each node.
Parameter visitor: A NodeVisitor object, containing a visit and depart implementation for each Node subclass encountered.
zfill(width)
There are no known subclasses.