Overview
XPathTool.java allows command line parsing of an xml file. It is used in the env script to parse the vivo.xml file.
Short Option |
Long Option |
Parameter Value Map |
Description |
Required |
---|---|---|---|---|
x |
xml-file |
XML_FILE |
path to xml file to read data from |
true |
e |
expression |
XPATH_EXPRESSION |
xpath expression to export |
true |
Usage
Define Alias
XPathTool="java $OPTS -Dprocess-task=XPathTool org.vivoweb.harvester.util.XPathTool"
Invocation
USERNAME=`$XPathTool -e "/Model/Param@name='dbUser'" -x "config/models/vivo.xml"`
Methods
getXPathResult
- Create a DocumentBuilderFactory
- Create Document object (from the xml file provided in the -x argment above)
- Complie XPath expression and evaluate it against the document
- Return the XPath results