pyuppsala documentation¶
pyuppsala is a Python binding for the Uppsala XML library – a zero-dependency, pure-Rust implementation of XML 1.0, Namespaces, XPath 1.0, and XSD validation.
This release is against 0.9 of Uppsala library.
Features¶
XML 1.0 parsing with namespace support and encoding detection (UTF-8/UTF-16)
DOM with tree traversal, mutation, and serialization
Source tracking – access original source text and byte ranges for any node
XPath 1.0 evaluation (node-sets, strings, numbers, booleans)
XSD 1.1 validation with 44+ built-in types, facets, identity constraints
XSD regex pattern matching
XmlWriter for imperative XML construction
lxml.etree-compatible API via
pyuppsala.etree– a drop-in for much oflxml.etreebacked by Uppsala’s secure parserSIMD-accelerated parsing on x86_64
Zero Python dependencies – ships as a native extension plus a thin pure-Python
etreelayer
Contents
- Quick start
- API reference
- The
pyuppsala.etreemodule - Exceptions
- Examples
- Parse, query, modify
- Namespace-aware processing
- Schema validation with detailed errors
- Building XML with XmlWriter
- XSD regex patterns
- Streaming serialization
- Fast text extraction with element_text
- Source tracking for error reporting
- Namespace-aware child search
- Element name matching
- Building a document from scratch
- XPath context nodes
- Combining XmlWriter with validation
- Tree manipulation: reorder children
- Node iteration patterns
- Fast native etree scans
- Resource limits and hardening