Skip to main content

XML (XPath, XSD, XSLT) Utilities

Project description

https://img.shields.io/pypi/pyversions/xul.svg https://img.shields.io/pypi/v/xul

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


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.1.tar.gz (14.0 kB view hashes)

Uploaded Source

Built Distributions

Xul-2.0.1-py3-none-any.whl (22.3 kB view hashes)

Uploaded Python 3

Xul-2.0.1-py2-none-any.whl (22.3 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