org.geotools.xml
Class XPathFactory

java.lang.Object
  extended byorg.geotools.xml.XPathFactory

public class XPathFactory
extends java.lang.Object

A factory to simplify the use of XPaths Currently each time a new XPath implementation is developed the createXPath(String, Class) method must be modified to be able to create XPath objects of that type.

Version:
$Revision: 1.9 $
Author:
Jesse Eichar

Constructor Summary
XPathFactory()
           
 
Method Summary
static XPath createXPath(java.lang.String xpath, java.lang.Class root)
          NOTE: This method is the only method that needs to be modified by developers
static XPath createXPath(java.lang.String xpath, java.lang.Object root)
          Creates an XPath that can evaluate the root object.
static java.util.List find(java.lang.String xpath, java.util.List elements, java.lang.Class root)
          Returns a list of the nodes that are identified by this XPath expression.
static java.util.List find(java.lang.String xpath, java.lang.Object root)
          Returns a list of the nodes that are identified by this XPath expression.
static java.util.List nodePaths(java.lang.String xpath, java.util.List elements, java.lang.Class root)
          Returns a list of the node paths for all the solutions to the XPath expression In other words all the nodes from the root to the identified node are included in the nodepath
static java.util.List nodePaths(java.lang.String xpath, java.lang.Object root)
          Returns a list of the node paths for all the solutions to the XPath expression In other words all the nodes from the root to the identified node are included in the nodepath
static java.util.List value(java.lang.String xpath, java.util.List elements, java.lang.Class root)
          Returns a list of the values of the nodes that are identified by this XPath expression.
static java.util.List value(java.lang.String xpath, java.lang.Object root)
          Returns a list of the values of the nodes that are identified by this XPath expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPathFactory

public XPathFactory()
Method Detail

createXPath

public static XPath createXPath(java.lang.String xpath,
                                java.lang.Class root)
NOTE: This method is the only method that needs to be modified by developers

Parameters:
xpath - The string representation of the XPath
root - The class type of the root object. This class is used to determine which type of XPath object should be instantiated
Returns:
XPath object that understands Nodes of type root and identifies nodes based on the xpath arguement. Null if the type is not recognized or root=null

createXPath

public static XPath createXPath(java.lang.String xpath,
                                java.lang.Object root)
Creates an XPath that can evaluate the root object.

Parameters:
xpath - The string representation of the XPath
root - An instance of the class that the XPath will be used with. This object is used to determine which type of XPath object should be instantiated
Returns:
XPath object that understands Nodes of type root and identifies nodes based on the xpath arguement. Null if the type is not recognized or root=null

find

public static java.util.List find(java.lang.String xpath,
                                  java.lang.Object root)
Returns a list of the nodes that are identified by this XPath expression. The children of root are compared to the first term of the XPath expression

Parameters:
xpath - The string representation of the XPath
root - An instance of the class that the XPath will be used with. This object is used to determine which type of XPath object should be instantiated
Returns:
a list of the nodes that are identified by this XPath expression. The children of root are compared to the first term of the XPath expression null if root is not a recognized type

value

public static java.util.List value(java.lang.String xpath,
                                   java.lang.Object root)
Returns a list of the values of the nodes that are identified by this XPath expression.

Parameters:
xpath - The string representation of the XPath
root - An instance of the class that the XPath will be used with. This object is used to determine which type of XPath object should be instantiated
Returns:
a list of the values of the nodes that are identified by this XPath expression. null if root is not a recognized type

nodePaths

public static java.util.List nodePaths(java.lang.String xpath,
                                       java.lang.Object root)
Returns a list of the node paths for all the solutions to the XPath expression In other words all the nodes from the root to the identified node are included in the nodepath

Parameters:
xpath - The string representation of the XPath
root - An instance of the class that the XPath will be used with. This object is used to determine which type of XPath object should be instantiated
Returns:
a list of the node paths for all the solutions to the XPath expression null if root is not a recognized type

find

public static java.util.List find(java.lang.String xpath,
                                  java.util.List elements,
                                  java.lang.Class root)
Returns a list of the nodes that are identified by this XPath expression. Elements are compared to the first term of the XPath expression

Parameters:
xpath - The string representation of the XPath
elements - The elements to be compared with the first term in the xpath
root - The class that the XPath will be used with. This class is used to determine which type of XPath object should be instantiated
Returns:
a list of the nodes that are identified by this XPath expression. Elements are compared to the first term of the XPath expression null if root is not a recognized type, or one of elements is not a LegalType. (@link org.geotools.xml.XPath#isLegalNode(Object)}

value

public static java.util.List value(java.lang.String xpath,
                                   java.util.List elements,
                                   java.lang.Class root)
Returns a list of the values of the nodes that are identified by this XPath expression.

Parameters:
xpath - The string representation of the XPath
elements - The elements to be compared with the first term in the xpath
root - The class that the XPath will be used with. This class is used to determine which type of XPath object should be instantiated
Returns:
a list of the values of the nodes that are identified by this XPath expression. Elements are compared to the first term of the XPath expression null if root is not a recognized type, or one of elements is not a LegalType. (@link org.geotools.xml.XPath#isLegalNode(Object)}

nodePaths

public static java.util.List nodePaths(java.lang.String xpath,
                                       java.util.List elements,
                                       java.lang.Class root)
Returns a list of the node paths for all the solutions to the XPath expression In other words all the nodes from the root to the identified node are included in the nodepath

Parameters:
xpath - The string representation of the XPath
elements - The elements to be compared with the first term in the xpath
root - The class that the XPath will be used with. This class is used to determine which type of XPath object should be instantiated
Returns:
a list of the node paths for all the solutions to the XPath expression Elements are compared to the first term of the XPath expression null if root is not a recognized type, or one of elements is not a LegalType. (@link org.geotools.xml.XPath#isLegalNode(Object)}


Copyright © GeoTools. All Rights Reserved.