XML source

The Xul scripts require an XML source to operate on. An XML source can be a local file, an URL or a pipe.

File

With xp you can select nodes in a local XML file with an XPath expression:

xp 'node()' entity.xml

Pipe

Redirect output (pipe) to a Xul script:

curl -s https://developer.apple.com/news/rss/news.rss | ppx

URL

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

ppx http://feeds.launchpad.net/pytz/announcements.atom

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

XHTML

XHTML [1] is part of the family of XML markup languages. It’s obsolete.

Examples

Pretty print an XHTML document:

curl -s https://www.webstandards.org/learn/reference/templates/xhtml11/ | ppx

Validate an XHTML document with the XHTML 1.0 strict DTD:

curl -s https://www.webstandards.org/learn/reference/templates/xhtml10t/ | validate -d examples/dtd/xhtml1-transitional.dtd

Print the link destinations in an XHTML document:

xp -d html "//html:link/@href" http://www.w3.org/1999/xhtml/

More XSDs and DTDs examples can be found in the Xul Bitbucket repository.

See also

Xul scripts: ppx, xp, validate, transform

Footnotes

[1]XHTML™ 1.0 The Extensible HyperText Markup Language