Package repast.simphony.integration
Class JDOMXPathUtils
java.lang.Object
repast.simphony.integration.JDOMXPathUtils
Utility classes for working with XPath expressions on JDOM.
- Author:
- Jerry Vos
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
Returns the first result fromevalXPaths(java.lang.String,org.jdom.Element)
or null if no such element exists.static List<?>
evalXPaths
(String xpathExpression, org.jdom.Element nodeContext) Returns the nodes selected in the given context with the given XPath string.static String
evalXPathString
(String xpathExpression, org.jdom.Element nodeContext) Same asgetValue(evalXPath(xpathExpression, nodeContext));
evalXPathStrings
(String xpathExpression, org.jdom.Element nodeContext) Returns a list of Strings which are the result of callinggetValue(java.lang.Object)
on the results ofevalXPaths(java.lang.String,org.jdom.Element)
.static String
Retrieves the value of an object.
-
Constructor Details
-
JDOMXPathUtils
public JDOMXPathUtils()
-
-
Method Details
-
getValue
Retrieves the value of an object. The return value is:o property Value o is null null o is not an Element
o.toString() o is an Element
and has some contentthe first content attribute o is an Element
and has no contentnull - Parameters:
o
- the object to get a value from- Returns:
- the object's value as specified
-
evalXPaths
public static List<?> evalXPaths(String xpathExpression, org.jdom.Element nodeContext) throws org.jdom.JDOMException Returns the nodes selected in the given context with the given XPath string.- Parameters:
xpathExpression
- the XPath expressionnodeContext
- the element to apply the XPath query to- Returns:
- the results of
XPath.selectNodes(java.lang.Object)
- Throws:
org.jdom.JDOMException
- if there was an error querying- See Also:
-
XPath.selectNodes(java.lang.Object)
-
evalXPath
public static Object evalXPath(String xpathExpression, org.jdom.Element nodeContext) throws org.jdom.JDOMException Returns the first result fromevalXPaths(java.lang.String,org.jdom.Element)
or null if no such element exists.- Parameters:
xpathExpression
- the XPath expression to usenodeContext
- the element to apply the XPath query to- Returns:
- the first result from
evalXPaths(java.lang.String,org.jdom.Element)
or null - Throws:
org.jdom.JDOMException
- if there was an error querying- See Also:
-
evalXPathStrings
public static List<String> evalXPathStrings(String xpathExpression, org.jdom.Element nodeContext) throws org.jdom.JDOMException Returns a list of Strings which are the result of callinggetValue(java.lang.Object)
on the results ofevalXPaths(java.lang.String,org.jdom.Element)
.- Parameters:
xpathExpression
- the xpath expressionnodeContext
- the context to search under- Returns:
- a list of strings
- Throws:
org.jdom.JDOMException
- if there was an error using the XPath expression
-
evalXPathString
public static String evalXPathString(String xpathExpression, org.jdom.Element nodeContext) throws org.jdom.JDOMException Same asgetValue(evalXPath(xpathExpression, nodeContext));
- Throws:
org.jdom.JDOMException
- See Also:
-