XML (XPath, XSD, XSLT) Utilities
Project description
Xul is a set of XML scripts written in Python. Documentation can be found on Read The Docs.
Xul scripts
ppx: pretty print XML
xp: select nodes in XML source
transform: transform XML with XSLT
validate: validate an XML source
Installation
The Xul command line scripts can be installed with pip:
$ pip install Xul
Install Pygments for XML syntax highlighting (optional).
$ pip install Pygments
Dependencies
Xul uses the excellent lxml XML toolkit, a Pythonic binding for the C libraries libxml2 and libxslt.
Options
The --help option displays the parameters of a script:
$ ppx --help
Usage: ppx [-nr] xml_source_1 ... xml_source_n
Pretty Print XML source in human readable form.
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-n, --no-syntax no syntax highlighting
-r, --remove-declaration
remove the XML declaration
XML source
An XML source can be a local file, an URL or a pipe.
File
Pretty print any local XML file with ppx:
ppx data_dump.xml
Pipe
You can redirect output (pipe) to a Xul script:
curl -s https://www.python.org/dev/peps/peps.rss/ | ppx
URL
libxml2 supports loading XML through HTTP (and FTP). For example, to pretty print an RSS feed:
ppx http://feeds.feedburner.com/PythonInsider
Loading XML through HTTPS is not supported and will result in an failed to load external entity error.
XML standards
W3C XML standards:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.