Package repast.simphony.integration
Class JDOMQueryer
java.lang.Object
repast.simphony.integration.JDOMQueryer
- All Implemented Interfaces:
Queryable
A queryable that works with JDOM. The querying functionality of this class is based on the
JDOMXPathUtils
class, and most methods delegate in some way to
that class.- Author:
- Jerry Vos
-
Constructor Summary
ConstructorDescriptionJDOMQueryer
(org.jdom.Document document) Constructs this queryer working on the specified document. -
Method Summary
Modifier and TypeMethodDescriptiongetRoot()
The root element of the document specified in the construction.Extracts a value from a Node and returns it.selectNode
(Object curContext, String path) Selects the node using the given xpath string.selectNode
(String path) Selects the node using the given xpath string.List<?>
selectNodes
(Object curContext, String path) Retrieves a list of nodes as specified in the select node methods.List<?>
selectNodes
(String path) Retrieves a list of nodes as specified in the select node methods.
-
Constructor Details
-
JDOMQueryer
public JDOMQueryer(org.jdom.Document document) Constructs this queryer working on the specified document.- Parameters:
document
- the document to run queries against
-
-
Method Details
-
selectNode
Selects the node using the given xpath string. This uses the root element of the document as the current context. A search of "/" will return the root document.- Specified by:
selectNode
in interfaceQueryable
- Parameters:
path
- the XPath query- Returns:
- the object (generally an Element) selected with the given path
- See Also:
-
selectNode
Selects the node using the given xpath string. Using the given the object as the context to search from. This context is used in relative queries, such as "element/sub", as the current location in the DOM tree.
The curContext currently must be an element. A document (for instance the root document) is not an acceptable value. the current context. A search of "/" will return the root document.- Specified by:
selectNode
in interfaceQueryable
- Parameters:
curContext
- the context of the querypath
- the query- Returns:
- the object (generally an Element) selected with the given path
- See Also:
-
selectNodes
Retrieves a list of nodes as specified in the select node methods.- Specified by:
selectNodes
in interfaceQueryable
- Parameters:
path
- the query- Returns:
- a list of nodes
-
selectNodes
Retrieves a list of nodes as specified in the select node methods.- Specified by:
selectNodes
in interfaceQueryable
path
- the query- Returns:
- a list of nodes
-
getRoot
The root element of the document specified in the construction. -
getValue
Description copied from interface:Queryable
Extracts a value from a Node and returns it. What this means is implementation dependent.
-