Pure python3 Alternative to stdlib xml.etree with HTML support
Project description
PyXml
Pure python3 Alternative to stdlib xml.etree with HTML support
Install
pip install pyxml3
Advantages
The primary advantage of this library over stdlib or lxml is the completeness of it's XPATH implementation. Additional functions and features are supported allowing for more complex queries and simplifying parsing efforts.
Examples
Standard Usage:
import pyxml
etree = pyxml.fromstring(b'<p>Hello World!</p>')
for element in etree.iter():
print(element)
with open('example.xml', 'rb') as f:
etree = pyxml.fromstring(f)
print(etree)
Monkey Patch:
import pyxml
pyxml.compat.monkey_patch()
from xml.etree import ElementTree as ET
etree = ET.fromstring('<div><p class="hello world">Hello World!</p></div>')
for element in etree.iter():
print(element)
print(etree.find('//p[starts-with(@class, "hello")]'))
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyxml3-0.0.1.tar.gz
(20.0 kB
view details)
File details
Details for the file pyxml3-0.0.1.tar.gz
.
File metadata
- Download URL: pyxml3-0.0.1.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c9cf451d7781a33ee8561695204b8d17220ef48da6a4cd2c6477ec959532cec |
|
MD5 | 8b2f9a03741fce345ac03d970ccee251 |
|
BLAKE2b-256 | 3d2d013bf480a8503bfe83e074e3afa609c9f8d57148e3ede4506895857bcbd6 |