Pyxml
Pure python3 alternative to stdlib xml.etree with HTML support
Install
pip install pyxml3
Advantages
-
The default parser ignores XML Declaration Entities avoiding most if not all XML related vulnerabilities such as The Billion Laughs Attack
-
Our XPATH implementation is much more complete than both xml.etree and even LXML. Additional functions and features are available making it easier to quickly parse complex data structures in a single line.
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(lower-case(text()), "hello")]'))
HTML:
import pyxml.html
etree = pyxml.html.fromstring('<div><p>Hello World!</p><br></div>')
for element in etree.iter():
print(element)
print(etree.find('//p[notempty(text())]'))
Metadata
Release files for pyxml3 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyxml3-0.0.4.tar.gz | 25.2 kB | Without provenance | Details for pyxml3-0.0.4.tar.gz |
Release files / pyxml3-0.0.4.tar.gz
| Download URL | pyxml3-0.0.4.tar.gz |
|---|---|
| Size | 25.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
64d58131ea578cb050bc1434925c19a6ffff4c838769aeacfe33144698633b13
|
|
BLAKE2b-256 checksum How to use checksums |
20bb8f0b663b03a8819fef4fdc5034c74bdc910a1c7995ef16797ed8f038d529
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.3
|
Security for pyxml3 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.