DecisionSoft website
Software
Home
Pathan
Pathan-P
Tools
Bugzilla
Pathan
Introduction
Pathan 1
Pathan 2
Documentation
Download
Mailing List
Pathan CVS
Bugzilla
Pathan Licence
Essentials
Licence
Trademarks
Contact
Links
DecisionSoft
W3C
Apache XML

XGrep Documentation

XGrep is a grep like utility for XML documents. XGrep is given an XPath expression and XML document, and returns all the matched nodes.

XGrep takes the following command line

Usage: xgrep [-h] [-p] [-t] [-v] [-n] "XPath Expression" data1.xml [data2.xml] ...

-h : Show this display
-p : Display an absolute xpath expression to query match
-t : Don't escape contents of output nodes
-v : Disable validation
-n : Disable namespaces

For normal usage it is typical to disable Xerces validation using the -v argument.

For example:

xgrep -v "/descendant::orderNumber" test.xml

ie. retrieve all orderNumber elements in file test.xml, using an XML datafile:

<?xml version="1.0" encoding="utf-8"?>
<purchases>
<orderNumber id="PA1" />
<group>
<orderNumber id="PA2" />
</group>
</purchases>

will produce results

<?xgrep-match [example.xml]--------------------------------?>
<orderNumber id="PA1"/>
<?xgrep-match [example.xml]--------------------------------?>
<orderNumber id="PA2"/>

In the examples/xgrep/tests directory, there are a number of simple xgrep tests in the form of shell scripts. These tests have been set up as a regression test suite, which is driven by the program xgrep-regressionTester.pl. While this is designed to be run under UNIX systems, the shell scripts provide example invocations of xgrep which can be used on Windows systems.

Pathan and XML Script are trademarks of DecisionSoft Limited
© Copyright 1998-2007 DecisionSoft Limited