Package lxml :: Module etree :: Class XPathElementEvaluator

[frames] | no frames]

# Class XPathElementEvaluator

             object --+
                      |
    _XPathEvaluatorBase --+
                          |
                         XPathElementEvaluator

Known Subclasses:
  - XPathDocumentEvaluator

XPathElementEvaluator(self, element, namespaces=None, extensions=None, regexp=True) Create an XPath evaluator for an element.

Absolute XPath expressions (starting with '/') will be evaluated against the ElementTree as returned by getroottree().

Additional namespace declarations can be passed with the 'namespace' keyword argument. EXSLT regular expression support can be disabled with the 'regexp' boolean keyword (defaults to True).

Instance Methods

__call__(self, _path, **_variables) Evaluate an XPath expression on the document. |

__init__(self, element, 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, ...) |

registerNamespace(...) Register a namespace with the XPath context. |

registerNamespaces(...) Register a prefix -> uri dict. |

register_namespace(...) Register a namespace with the XPath context. |

register_namespaces(...) Register a prefix -> uri dict. |

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

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

Method Details

### __call__(self, _path, **_variables)
(Call operator)

Evaluate an XPath expression on the document.

Variables may be provided as keyword arguments. Note that namespaces are currently not supported for variables.

Absolute XPath expressions (starting with '/') will be evaluated against the ElementTree as returned by getroottree().

### __init__(self, element, 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__

### registerNamespace(...)

Register a namespace with the XPath context.

Deprecated: use `register_namespace()` instead

### registerNamespaces(...)

Register a prefix -> uri dict.

Deprecated: use `register_namespaces()` instead