elementpath v2.2.0
elementpath
Python library that provides XPath 1.0/2.0 parsers and selectors for ElementTree and lxml
Published by Scuola Internazionale Superiore di Studi Avanzati
Technical contact Davide Brunato
Vitality:
73%
The vitality index, as explicited in the guidelines for the acquisition and reuse of software for Italian PA, is calculated according to the following four main categories:
- Code activity: the daily number of commits and merges;
- Release history: the daily number of releases;
- User community: the number of unique authors;
- Longevity: the age of the project.
The ranges of every measure can be found in the vitality-ranges.yml file.
Development status: stable
Software functionality
XPath 1.0 and XPath 2.0 implementations
detailed information
elementpath v2.2.0
elementpath
Last release 2021-03-01 (v2.2.0)
Type of maintenance internal
License MIT
Platforms
linux
windows
mac
List of dependencies None
Enabling platforms None
Compliance None
Api documentation elementpath API
Extended description
This is a library for Python 3.6+ that provides XPath 1.0 and 2.0 selectors for Python’s ElementTree XML data structures, both for the standard ElementTree library and for the lxml library. For lxml this package can be useful for providing XPath 2.0 selectors, because lxml already has it’s own implementation of XPath 1.0.
Installation and usage
You can install the package with pip in a Python 3.6+ environment:
pip install elementpath
For using it import the package and apply the selectors on ElementTree nodes:
>>> import elementpath
>>> from xml.etree import ElementTree
>>> root = ElementTree.XML('<A><B1/><B2><C1/><C2/><C3/></B2></A>')
>>> elementpath.select(root, '/A/B2/\*') [<Element 'C1' at ...>, <Element'C2' at ...>, <Element 'C3' at ...>]