Main XML Element class.
Element children are accessed as object attributes. Multiple children
with the same name are available through a list index. Example:
Note that you cannot (and must not) instantiate this class or its
subclasses.
|
|
|
|
|
|
|
|
__getattr__(...)
Return the (first) child with the given tag name. If no namespace
is provided, the child will be looked up in the same one as self. |
|
|
|
|
|
|
|
__getitem__(...)
Return a sibling, counting from the first child of the parent. The
method behaves like both a dict and a sequence. |
|
|
|
|
__iter__(self)
Iterate over self and all siblings with the same tag. |
|
|
|
|
|
|
a new object with type S, a subtype of T
|
|
|
|
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value |
|
|
|
|
|
|
|
|
|
|
addattr(self,
tag,
value)
Add a child value to the element. |
|
|
|
|
countchildren(self)
Return the number of children of this element, regardless of their
name. |
|
|
|
|
descendantpaths(self,
prefix=None)
Returns a list of object path expressions for all descendants. |
|
|
|
|
find(self,
path)
Finds the first matching subelement, by tag name or path. |
|
|
|
|
findall(self,
path)
Finds all matching subelements, by tag name or path. |
|
|
|
|
findtext(self,
path,
default=None)
Finds text for the first matching subelement, by tag name or path. |
|
|
|
|
getchildren(self)
Returns a sequence of all direct children. The elements are
returned in document order. |
|
|
|
|
iterfind(self,
path)
Iterates over all matching subelements, by tag name or path. |
|
|
|
Inherited from etree.ElementBase:
__init__
Inherited from etree._Element:
__contains__,
__copy__,
__deepcopy__,
__nonzero__,
__repr__,
__reversed__,
addnext,
addprevious,
append,
clear,
extend,
get,
getiterator,
getnext,
getparent,
getprevious,
getroottree,
index,
insert,
items,
iter,
iterancestors,
iterchildren,
iterdescendants,
itersiblings,
itertext,
keys,
makeelement,
remove,
replace,
set,
values,
xpath
Inherited from object:
__format__,
__hash__,
__reduce__,
__reduce_ex__,
__sizeof__,
__subclasshook__
|