Home | Trees | Indices | Help |
|
---|
|
object --+ | _Element
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.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
a new object with type S, a subtype of T |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
attrib Element attribute dictionary. |
|||
nsmap Namespace prefix->URI mapping known in the context of this Element. |
|||
prefix Namespace prefix or None. |
|||
sourceline Original line number as found by the parser or None if unknown. |
|||
tag Element tag |
|||
tail Text after this element's end tag, but before the next sibling element's start tag. |
|||
text Text before the first subelement. |
|||
Inherited from |
|
|
repr(x)
|
Called after object initialisation. Custom subclasses may override this if they recursively call _init() in the superclasses. |
Adds the element as a following sibling directly after this element. This is normally used to set a processing instruction or comment after the root node of a document. Note that tail text is automatically discarded when adding at the root level. |
Adds the element as a preceding sibling directly before this element. This is normally used to set a processing instruction or comment before the root node of a document. Note that tail text is automatically discarded when adding at the root level. |
Resets an element. This function removes all subelements, clears all attributes and sets the text and tail properties to None. |
Returns all direct children. The elements are returned in document order. Deprecated: Note that this method has been deprecated as of ElementTree 1.3 and lxml 2.0. New code should use ``list(element)`` or simply iterate over elements. |
Returns a sequence or iterator of all elements in the subtree in document order (depth first pre-order), starting with this element. Can be restricted to find only elements with a specific tag (pass ``tag="xyz"``) or from a namespace (pass ``tag="{ns}*"``). You can also pass the Element, Comment, ProcessingInstruction and Entity factory functions to look only for the specific element type. Deprecated: Note that this method is deprecated as of ElementTree 1.3 and lxml 2.0. It returns an iterator in lxml, which diverges from the original ElementTree behaviour. If you want an efficient iterator, use the ``element.iter()`` method instead. You should only use this method in new code if you require backwards compatibility with older versions of lxml or ElementTree. |
Return an ElementTree for the root node of the document that contains this element. This is the same as following element.getparent() up the tree until it returns None (for the root element) and then build an ElementTree for the last parent that was returned. |
Find the position of the child within the parent. This method is not part of the original ElementTree API. |
Gets element attributes, as a sequence. The attributes are returned in an arbitrary order. |
Iterate over all elements in the subtree in document order (depth first pre-order), starting with this element. Can be restricted to find only elements with a specific tag (pass ``tag="xyz"``) or from a namespace (pass ``tag="{ns}*"``). You can also pass the Element, Comment, ProcessingInstruction and Entity factory functions to look only for the specific element type. |
Iterate over the ancestors of this element (from parent to parent). The generated elements can be restricted to a specific tag name with the 'tag' keyword. |
Iterate over the children of this element. As opposed to using normal iteration on this element, the generated elements can be restricted to a specific tag name with the 'tag' keyword and reversed with the 'reversed' keyword. |
Iterate over the descendants of this element in document order. As opposed to ``el.iter()``, this iterator does not yield the element itself. The generated elements can be restricted to a specific tag name with the 'tag' keyword. |
Iterate over the following or preceding siblings of this element. The direction is determined by the 'preceding' keyword which defaults to False, i.e. forward iteration over the following siblings. The generated elements can be restricted to a specific tag name with the 'tag' keyword. |
Iterates over the text content of a subtree. You can pass the ``tag`` keyword argument to restrict text content to a specific tag name. You can set the ``with_tail`` keyword argument to ``False`` to skip over tail text. |
Gets a list of attribute names. The names are returned in an arbitrary order (just like for an ordinary Python dictionary). |
Removes a matching subelement. Unlike the find methods, this method compares elements based on identity, not on tag value or contents. |
Gets element attribute values as a sequence of strings. The attributes are returned in an arbitrary order. |
|
attribElement attribute dictionary. Where possible, use get(), set(), keys(), values() and items() to access element attributes. |
tailText after this element's end tag, but before the next sibling element's start tag. This is either a string or the value None, if there was no text. |
textText before the first subelement. This is either a string or the value None, if there was no text. |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0 on Fri Feb 1 19:02:26 2008 | http://epydoc.sourceforge.net |