[CentOS] XML, XPATH in Centos?

Daniel de Kok daniel-lists at taickim.com
Fri Dec 8 14:04:31 UTC 2006


On Fri, 8 Dec 2006 14:52:17 +0100
"Christian Nygaard" <christiannygaard at gmail.com> wrote:
> What built in utilities are there that can evaluate XML XPath statements in
> CentOS?

libxml2 has XPath support. Bindings against libxml2 are provided by
many languages, e.g. you could install the libxml2-python package from
CentOS 4. Besides that, it is relatively easy to write a C program that
uses libxml2 to evaluate XPath expressions (which is handy for shell
scripting). A quick and dirty example can be found at:

http://danieldk.org/code/snippets/xpgrep-0.0.1.tar.gz

(I wrote/use it as a minimal grep workalike that accepts XPath
expressions).

BTW. If you have files that are not well-formed (like many XHTML)
files, or if the information to extract is trivial, it is often easier
to grep or write a simple line-processing Perl script.

-- Daniel



More information about the CentOS mailing list