Package lxml :: Module etree :: Class ElementBase
[hide private]
[frames] | no frames]

Class ElementBase

object --+    
         |    
  _Element --+
             |
            ElementBase
Known Subclasses:

ElementBase(*children, attrib=None, nsmap=None, **_extra)

The public Element class. All custom Element classes must inherit from this one. To create an Element, use the Element() factory.

BIG FAT WARNING: Subclasses must not override __init__ or __new__ as it is absolutely undefined when these objects will be created or destroyed. All persistent state of Elements must be stored in the underlying XML. If you really need to initialize the object after creation, you can implement an _init(self) method that will be called directly after object creation.

Subclasses of this class can be instantiated to create a new Element. By default, the tag name will be the class name and the namespace will be empty. You can modify this with the following class attributes:

In user code, the latter three are commonly inherited in class hierarchies that implement a common namespace.

Instance Methods [hide private]
 
__init__(attrib=None, nsmap=None, *children, **_extra)
x.__init__(...) initializes x; see help(type(x)) for signature
a new object with type S, a subtype of T
__new__(T, S, ...)

Inherited from _Element: __contains__, __copy__, __deepcopy__, __delitem__, __getitem__, __iter__, __len__, __nonzero__, __repr__, __reversed__, __setitem__, addnext, addprevious, append, clear, cssselect, extend, find, findall, findtext, get, getchildren, getiterator, getnext, getparent, getprevious, getroottree, index, insert, items, iter, iterancestors, iterchildren, iterdescendants, iterfind, itersiblings, itertext, keys, makeelement, remove, replace, set, values, xpath

Inherited from _Element (private): _init

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from _Element: attrib, base, nsmap, prefix, sourceline, tag, tail, text

Inherited from object: __class__

Method Details [hide private]

__init__(attrib=None, nsmap=None, *children, **_extra)
(Constructor)

 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__

__new__(T, S, ...)

 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__