Class XPathUtils
java.lang.Object
gov.nasa.pds.registry.common.util.xml.XPathUtils
Utility class to work with XPath API.
- Author:
- karpenko
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic XPathExpressioncompileXPath(XPathFactory xpf, String str) Compile XPathgetFirstNode(Object item, String xpath) Get first node by XPath.intgetNodeCount(Object item, String xpath) Get node count by XPath.getNodeList(Object item, String xpath) Get node list by XPath.static NodeListgetNodeList(Object item, XPathExpression expr) Get node list by XPath.static String[]getStringArray(Document doc, XPathExpression expr) Get an array of string values by XPath.getStringList(Document doc, String xpath) Get a list of string values by XPath.getStringList(Document doc, XPathExpression expr) Get a list of string values by XPath.getStringSet(Document doc, String xpath) Get a set of string values by XPath.getStringSet(Document doc, XPathExpression expr) Get a set of string values by XPath.static StringgetStringValue(Document doc, XPathExpression expr) Get string value by XPath.
-
Constructor Details
-
XPathUtils
public XPathUtils()Constructor.
-
-
Method Details
-
compileXPath
Compile XPath- Parameters:
xpf- XPath factorystr- XPath string value- Returns:
- Compiled XPath
- Throws:
Exception- Generic exception
-
getStringValue
Get string value by XPath.- Parameters:
doc- XML documentexpr- an XPath- Returns:
- a string value
- Throws:
Exception- Generic exception
-
getStringList
Get a list of string values by XPath.- Parameters:
doc- XML documentexpr- an XPath- Returns:
- a list
- Throws:
Exception- Generic exception
-
getStringSet
Get a set of string values by XPath.- Parameters:
doc- XML documentexpr- an XPath- Returns:
- a set
- Throws:
Exception- Generic exception
-
getStringList
Get a list of string values by XPath.- Parameters:
doc- XML documentxpath- an XPath- Returns:
- a list
- Throws:
Exception- Generic exception
-
getStringSet
Get a set of string values by XPath.- Parameters:
doc- XML documentxpath- an XPath- Returns:
- a set
- Throws:
Exception- Generic exception
-
getStringArray
Get an array of string values by XPath.- Parameters:
doc- XML documentexpr- an XPath- Returns:
- an array
- Throws:
Exception- Generic exception
-
getNodeList
Get node list by XPath.- Parameters:
item- parent itemexpr- an XPath- Returns:
- Node list
- Throws:
Exception- Generic exception
-
getNodeList
Get node list by XPath.- Parameters:
item- parent itemxpath- an XPath- Returns:
- Node list
- Throws:
Exception- Generic exception
-
getNodeCount
Get node count by XPath.- Parameters:
item- parent itemxpath- an XPath- Returns:
- Node count
- Throws:
Exception- Generic exception
-
getFirstNode
Get first node by XPath.- Parameters:
item- Parent itemxpath- an XPath- Returns:
- a Node
- Throws:
Exception- Generic exception
-