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

Eval Documentation

Eval is a command line utility to evaluate XPath 2.0 expression.

Eval is executed as follows:

Usage: eval [options] "XPath Expression" [ data1.xml ... ]
-f : Enable XPath 1.0 compatibility mode (default is off)
-h : Show this display
-i inputfile : append the child nodes in inputfile to input()
-I inputfile : append the document root of inputfile to input()
-e : Enable schema error reporting
-d : Enable debug
-x : Enable full exception debugging (all exception throws shown)
-N prefix uri : bind prefix to the namespace uri

For example:

eval "avg(//Price)" test.xml

ie. Retrieve the average price of books in the following file:

<?xml version="1.0" encoding="utf-8"?>
<Catalogue>
<Book>
<ISBN>1234</ISBN>
<Price>14.99</Price>
</Book>
<Book>
<ISBN>1235</ISBN>
<Price>89.99</Price>
</Book>
<Book>
<ISBN>1237</ISBN>
<Price>14.999</Price>
</Book>
</Catalogue>

will produce the result

39.99

and the following line, where we bind the 'xdt' prefix to the XPath 2.0 datatypes URI:

eval 'xs:float("3.56") + xdt:untypedAtomic("17.3") cast as xs:decimal' -N xdt http://www.w3.org/2003/05/xpath-datatypes

doesn't take an xml file, and evaluates the sum of an xs:float and an xdt:untypedAtomic, and then casts the result to an xs:decimal. The output given is:

20.86

There are many functional tests in the functionalTesting/ directory. To run them all, run the program './runTests.sh' from that directory. Alternatively, you can choose to run tests in a particular directory by calling './tester {path to directory}'. While this is designed to be run under UNIX systems, the shell scripts provide example invocations of eval which can be used on Windows systems.

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