Class JDOMQueryer

java.lang.Object
repast.simphony.integration.JDOMQueryer
All Implemented Interfaces:
Queryable

public class JDOMQueryer extends Object implements 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 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

      public Object selectNode(String path)
      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 interface Queryable
      Parameters:
      path - the XPath query
      Returns:
      the object (generally an Element) selected with the given path
      See Also:
    • selectNode

      public Object selectNode(Object curContext, String path)
      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 interface Queryable
      Parameters:
      curContext - the context of the query
      path - the query
      Returns:
      the object (generally an Element) selected with the given path
      See Also:
    • selectNodes

      public List<?> selectNodes(String path)
      Retrieves a list of nodes as specified in the select node methods.
      Specified by:
      selectNodes in interface Queryable
      Parameters:
      path - the query
      Returns:
      a list of nodes
    • selectNodes

      public List<?> selectNodes(Object curContext, String path)
      Retrieves a list of nodes as specified in the select node methods.
      Specified by:
      selectNodes in interface Queryable
      path - the query
      Returns:
      a list of nodes
    • getRoot

      public Object getRoot()
      The root element of the document specified in the construction.
      Specified by:
      getRoot in interface Queryable
      Returns:
      the document's root element
    • getValue

      public Object getValue(Object o)
      Description copied from interface: Queryable
      Extracts a value from a Node and returns it. What this means is implementation dependent.
      Specified by:
      getValue in interface Queryable
      Parameters:
      o - the node to extract a value from
      Returns:
      See Also: