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

# Class XPath

             object --+
                      |
    _XPathEvaluatorBase --+
                          |
                         XPath

Known Subclasses:
  - ETXPath
  - , cssselect.CSSSelector

XPath(self, path, namespaces=None, extensions=None, regexp=True, smart_strings=True) A compiled XPath expression that can be called on Elements and ElementTrees.

Besides the XPath expression, you can pass prefix-namespace mappings and extension functions to the constructor through the keyword arguments `namespaces` and `extensions`. EXSLT regular expression support can be disabled with the 'regexp' boolean keyword (defaults to True). Smart strings will be returned for string results unless you pass `smart_strings=False`.

Instance Methods | [hide private]
__call__(self, _etree_or_element, **_variables) |
__init__(self, path, namespaces=None, extensions=None, regexp=True, smart_strings=True) x.__init__(...) initializes x; see help(type(x)) for signature |
a new object with type S, a subtype of T |
__new__(T, S, ...) |
__repr__(x) repr(x) |
Inherited from `_XPathEvaluatorBase`: `evaluate` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties | [hide private]
| path The literal XPath expression.
Inherited from `_XPathEvaluatorBase`: `error_log` Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, path, namespaces=None, extensions=None, regexp=True, smart_strings=True) (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__

### __repr__(x) (Representation operator) |
repr(x) Overrides: object.__repr__