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__(...)
Iterate over self and all siblings with the same tag. |
|
|
|
__len__(...)
Count self and siblings with the same tag. |
|
|
a new object with type S, a subtype of T
|
|
|
|
|
__setattr__(...)
Set the value of 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. |
|
|
|
__setitem__(...)
Set the value of a sibling, counting from the first child of the
parent. Implements key assignment, item assignment and slice
assignment. |
|
|
|
|
|
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. |
|
|
|
getchildren(self)
Returns a sequence of all direct children. The elements are
returned in document order. |
|
|
Inherited from etree.ElementBase :
__init__
Inherited from etree._Element :
__contains__ ,
__copy__ ,
__deepcopy__ ,
__nonzero__ ,
__repr__ ,
__reversed__ ,
addnext ,
addprevious ,
append ,
clear ,
extend ,
find ,
findall ,
findtext ,
get ,
getiterator ,
getnext ,
getparent ,
getprevious ,
getroottree ,
index ,
insert ,
items ,
iter ,
iterancestors ,
iterchildren ,
iterdescendants ,
iterfind ,
itersiblings ,
itertext ,
keys ,
makeelement ,
remove ,
replace ,
set ,
values ,
xpath
Inherited from object :
__format__ ,
__hash__ ,
__reduce_ex__ ,
__sizeof__ ,
__subclasshook__
|