Xml Pipes And Filters
Martin
Introduction
XML Pipes and Filters (XPF) is a collection of command-line tools for manipulating XML. XPF provides tools for removing nodes, changing text of nodes, and testing properties of an XML document. XPF tools (aka
filters) accept input on the standard input and produce output to the standard output, hence they can be composed into pipelines. The tools are based on the XPath language for addressing nodes in an XML document.
Download
Release 0.2 is available at:
The subversion repository of XPF is:
XPF requires Python and the Libxml2 bindings for Python.
Tools
All tools allow the following options:
-i <file> Use <file> as input [stdin]
-o <file> Output result in <file> [stdout]
-f <file> Use <file> as input and output
-? | -h | --help Display this usage information
xpf-rm
Usage:
xpf-rm [-i file] [-o file] <xpath>
Description:
Removes all nodes addressed by the given XPath expression
xpf-ed
Usage:
xpf-ed [-i file] [-o file] <xpath> <text>
Description:
Replaces nodes addressed by the given XPath expression with the
given text.
xpf-test
Usage:
xpf-test [-i file] [-o file] <xpath>
Description:
The XPath expression is evaluated and the resulting object is
converted to a boolean by a call to the boolean function. If the
result is true, then the exit code is 0 and the input document is
written to the output. If the result is false, then the exit code
is 1 and the input document is not written to the output.
Note that the xpf-test tool is comparable to the xsl:if element fo
XSLT.