Skip to main content

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


The Xul command line scripts can be installed with pip:

$ pip install Xul

Install Pygments for XML syntax highlighting (optional).

$ pip install Pygments


Xul uses the excellent lxml XML toolkit, a Pythonic binding for the C libraries libxml2 and libxslt.


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.

  --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.


Pretty print any local XML file with ppx:

ppx data_dump.xml


You can redirect output (pipe) to a Xul script:

curl -s | ppx


libxml2 supports loading XML through HTTP (and FTP). For example, to pretty print an RSS feed:


Loading XML through HTTPS is not supported and will result in an failed to load external entity error.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Xul, version 2.0.1
Filename, size File type Python version Upload date Hashes
Filename, size Xul-2.0.1-py2-none-any.whl (22.3 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size Xul-2.0.1-py3-none-any.whl (22.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size Xul-2.0.1.tar.gz (14.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page