Revision [282]
This is an old revision of CommandXpath made by DavidLee on 2008-10-25 11:44:41.
Command xpath
Name
xpath evaluate an XPATH expression and print the resultSynopsis
xpath [-f xpath-file] [-i input-file] [-n] [-q] xpath-expr [-v name value [name value ...]]Description
-f xpath-file read xpath expression from file-i input use input as the source xml document, otherwise stdin
if input is an XML expression then use it directly (dont treat as filename).
[-q] xpath-expr xpath expression
-v Read remaining pairs of arguments as name/value pairs to assign as xpath variables
Note that the "-q" is optional. It is only required if you need to specify both -n and -v
Examples
xpath-n -q expr -v variable some-value
Example
$ xls | xpath '//file[1]/@name' name=".classpath"
Return Value
Returns 0 if the the xpath expression executed successfully and a non-empty result is returned. otherwise 1CategoryCommands