Skip to main content

XML (XPath, XSD, XSLT) Utilities

Project description

Xul scripts

XML utilities written in Python.

  • 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

Use the --help option to print a command line script’s parameters:

$ 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

URL

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

Pipe

Redirect output (pipe) to a Xul script:

curl -s https://www.python.org/dev/peps/peps.rss/ | ppx

XML standards

W3C XML standards:

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

Xul-2.0.0.tar.gz (14.7 kB view hashes)

Uploaded Source

Built Distributions

Xul-2.0.0-py3-none-any.whl (22.1 kB view hashes)

Uploaded Python 3

Xul-2.0.0-py2-none-any.whl (22.1 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page