Package lxml :: Module etree :: Class XPath

[frames] | no frames]

# Class XPath

             object --+
                      |
    _XPathEvaluatorBase --+
                          |
                         XPath

Known Subclasses:
  - ETXPath
  - , cssselect.CSSSelector

XPath(self, path, namespaces=None, extensions=None, regexp=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).

Instance Methods

__call__(self, _etree_or_element, **_variables) |

__init__(self, path, namespaces=None, extensions=None, regexp=True) x.__init__(...) initializes x; see x.__class__.__doc__ for signature |

a new object with type S, a subtype of T

__new__(T, S, ...) |

__repr__(...) repr(x) |

Inherited from `_XPathEvaluatorBase`: `evaluate` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__str__`

Properties
| path
Inherited from `_XPathEvaluatorBase`: `error_log` Inherited from `object`: `__class__`

Method Details

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

### __repr__(...)
(Representation operator)

repr(x)

Overrides: object.__repr__
  (inherited documentation)