Element class.
References a document object and a libxml node.
By pointing to a Document instance, a reference is kept to
_Document as long as there is some pointer to a node in it.
|
__contains__(x,
y)
y in x |
|
|
|
|
|
|
|
__delitem__(x,
y)
del x[y] |
|
|
|
__getitem__(...)
Returns the subelement at the given position or the requested
slice. |
|
|
|
|
|
|
a new object with type S, a subtype of T
|
|
|
|
|
|
|
|
|
__setitem__(x,
i,
y)
x[i]=y |
|
|
|
_init(self)
Called after object initialisation. |
|
|
|
addnext(self,
element)
Adds the element as a following sibling directly after this
element. |
|
|
|
addprevious(self,
element)
Adds the element as a preceding sibling directly before this
element. |
|
|
|
append(self,
element)
Adds a subelement to the end of this element. |
|
|
|
clear(self)
Resets an element. |
|
|
|
extend(self,
elements)
Extends the current children by the elements in the iterable. |
|
|
|
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. |
|
|
|
get(self,
key,
default=None)
Gets an element attribute. |
|
|
|
|
|
getiterator(self,
tag=None)
Returns a sequence or iterator of all elements in the subtree in
document order (depth first pre-order), starting with this
element. |
|
|
|
getnext(self)
Returns the following sibling of this element or None. |
|
|
|
getparent(self)
Returns the parent of this element or None for the root element. |
|
|
|
getprevious(self)
Returns the preceding sibling of this element or None. |
|
|
|
getroottree(self)
Return an ElementTree for the root node of the document that
contains this element. |
|
|
|
index(self,
child,
start=None,
stop=None)
Find the position of the child within the parent. |
|
|
|
insert(self,
index,
element)
Inserts a subelement at the given position in this element |
|
|
|
items(self)
Gets element attributes, as a sequence. |
|
|
|
iter(self,
tag=None)
Iterate over all elements in the subtree in document order (depth
first pre-order), starting with this element. |
|
|
|
iterancestors(self,
tag=None)
Iterate over the ancestors of this element (from parent to parent). |
|
|
|
iterchildren(self,
tag=None,
reversed=False)
Iterate over the children of this element. |
|
|
|
iterdescendants(self,
tag=None)
Iterate over the descendants of this element in document order. |
|
|
|
iterfind(self,
path)
Iterates over all matching subelements, by tag name or path. |
|
|
|
itersiblings(self,
tag=None,
preceding=False)
Iterate over the following or preceding siblings of this element. |
|
|
|
itertext(self,
tag=None,
with_tail=True)
Iterates over the text content of a subtree. |
|
|
|
keys(self)
Gets a list of attribute names. |
|
|
|
makeelement(self,
_tag,
attrib=None,
nsmap=None,
**_extra)
Creates a new element associated with the same document. |
|
|
|
remove(self,
element)
Removes a matching subelement. |
|
|
|
replace(self,
old_element,
new_element)
Replaces a subelement with the element passed as second argument. |
|
|
|
set(self,
key,
value)
Sets an element attribute. |
|
|
|
values(self)
Gets element attribute values as a sequence of strings. |
|
|
|
xpath(self,
_path,
namespaces=None,
extensions=None,
smart_strings=True,
**_variables)
Evaluate an xpath expression using the element as context node. |
|
|
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__init__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__ ,
__str__
|