lxml :: html :: HtmlElement :: Class HtmlElement

[hide private]
[frames] | no frames]

# Class HtmlElement

source code

        object --+
                 |
    etree._Element --+
                     |
     etree.ElementBase --+
                         |
            object --+   |
                     |   |
             HtmlMixin --+
                         |
                        HtmlElement

Known Subclasses:
  - FormElement
  - , InputElement
  - , LabelElement
  - , SelectElement
  - , TextareaElement

Instance Methods | [hide private]

cssselect(self, expr, translator=`'``html``'`) Run the CSS expression on this element and its children, returning a list of the results. | source code

set(self, key, value=None) Sets an element attribute. If no value is provided, or if the value is None, creates a 'boolean' attribute without value, e.g. "<form novalidate></form>" for `form.set('novalidate')`. | source code

Inherited from `etree.ElementBase`: `__init__`, `__new__`

Inherited from `etree._Element`: `__contains__`, `__copy__`, `__deepcopy__`, `__delitem__`, `__getitem__`, `__iter__`, `__len__`, `__nonzero__`, `__repr__`, `__reversed__`, `__setitem__`, `addnext`, `addprevious`, `append`, `clear`, `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`, `values`, `xpath`

Inherited from `etree._Element` (private): `_init`

Inherited from `HtmlMixin`: `drop_tag`, `drop_tree`, `find_class`, `find_rel_links`, `get_element_by_id`, `iterlinks`, `make_links_absolute`, `resolve_base_href`, `rewrite_links`, `text_content`

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

Properties | [hide private]

Inherited from `etree._Element`: `attrib`, `base`, `nsmap`, `prefix`, `sourceline`, `tag`, `tail`, `text` Inherited from `HtmlMixin`: `base_url`, `body`, `classes`, `forms`, `head`, `label` Inherited from `object`: `__class__`

Method Details | [hide private]

### cssselect(self, expr, translator=`'``html``'`)

source code

Run the CSS expression on this element and its children, returning a list of the results.

Equivalent to lxml.cssselect.CSSSelect(expr, translator='html')(self) -- note that pre-compiling the expression can provide a substantial speedup.

Overrides: HtmlMixin.cssselect

### set(self, key, value=None)

source code

Sets an element attribute. If no value is provided, or if the value is None, creates a 'boolean' attribute without value, e.g. "<form novalidate></form>" for `form.set('novalidate')`.

Overrides: HtmlMixin.set