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

  1. Create a DocumentBuilderFactory
  2. Create Document object (from the xml file provided in the -x argment above)
  3. Complie XPath expression and evaluate it against the document
  4. Return the XPath results