lxml.objectify.ElementMaker

Package lxml :: Module objectify :: Class ElementMaker |
[hide private]
[frames] | no frames]

# Class ElementMaker

    object --+
             |
            ElementMaker

ElementMaker(self, namespace=None, nsmap=None, annotate=True, makeelement=None)

An ElementMaker that can be used for constructing trees.

Example:

    >>> M = ElementMaker(annotate=False)
    >>> html = M.html( M.body( M.p('hello', M.br, 'objectify') ) )

    >>> from lxml.etree import tostring
    >>> print(tostring(html, method='html').decode('ASCII'))
    <html><body><p>hello<br>objectify</p></body></html>

Note that this module has a predefined ElementMaker instance called `E`.

Instance Methods | [hide private]
__getattr__(...) |
__getattribute__(...) x.__getattribute__('name') <==> x.name |
__init__(self, namespace=None, nsmap=None, annotate=True, makeelement=None) x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
a new object with type S, a subtype of T |
__new__(T, S, ...) |
Inherited from `object`: `__delattr__`, `__format__`, `__hash__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __getattribute__(...) |
x.__getattribute__('name') <==> x.name Overrides: object.__getattribute__

### __init__(self, namespace=None, nsmap=None, annotate=True, makeelement=None) (Constructor) |
x.__init__(...) initializes x; see x.__class__.__doc__ for signature Overrides: object.__init__

### __new__(T, S, ...) |
Returns: a new object with type S, a subtype of T Overrides: object.__new__