| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.dom4j.xpath.DefaultXPath
 Default implementation of XPathwhich uses the Jaxen  project.
 
| Constructor Summary | |
| DefaultXPath(String text)Construct an XPath | |
| Method Summary | |
|  boolean | booleanValueOf(Object context)Retrieve a boolean-value interpretation of this XPath expression when evaluated against a given context. | 
|  Object | evaluate(Object context)evaluateevaluates an XPath expression and returns the
 result as anObject. | 
| protected  Object | getCompareValue(Node node)DOCUMENT ME! | 
|  org.jaxen.FunctionContext | getFunctionContext()DOCUMENT ME! | 
|  org.jaxen.NamespaceContext | getNamespaceContext()DOCUMENT ME! | 
|  String | getText()Retrieve the textual XPath string used to initialize this Object | 
|  org.jaxen.VariableContext | getVariableContext()DOCUMENT ME! | 
| protected  void | handleJaxenException(org.jaxen.JaxenException exception) | 
|  boolean | matches(Node node)matchesreturns true if the given node matches the XPath
 expression. | 
|  Number | numberValueOf(Object context)numberValueOfevaluates an XPath expression and returns
 the numeric value of the XPath expression if the XPath expression results
 is a number, or null if the result is not a number. | 
| protected static org.jaxen.XPath | parse(String text) | 
| protected  void | removeDuplicates(List list,
                 Map sortValues)Removes items from the list which have duplicate values | 
|  List | selectNodes(Object context)selectNodesperforms this XPath expression on the givenNodeorListofNodes instances appending all
 the results together into a single list. | 
|  List | selectNodes(Object context,
            XPath sortXPath)selectNodesevaluates the XPath expression on the givenNodeorListofNodes and returns the result as
 aListofNodes sorted by the sort XPath
 expression. | 
|  List | selectNodes(Object context,
            XPath sortXPath,
            boolean distinct)selectNodesevaluates the XPath expression on the givenNodeorListofNodes and returns the result as
 aListofNodes sorted by the sort XPath
 expression. | 
|  Object | selectObject(Object context)selectObjectevaluates an XPath expression and returns the
 result as anObject. | 
|  Node | selectSingleNode(Object context)selectSingleNodeevaluates this XPath expression on the
 givenNodeorListofNodes and returns the
 result as a singleNodeinstance. | 
|  void | setFunctionContext(org.jaxen.FunctionContext functionContext)Sets the function context to be used when evaluating XPath expressions | 
|  void | setNamespaceContext(org.jaxen.NamespaceContext namespaceContext)Sets the namespace context to be used when evaluating XPath expressions | 
|  void | setNamespaceURIs(Map map)Sets the current NamespaceContext from a Map where the keys are the String namespace prefixes and the values are the namespace URIs. | 
| protected  void | setNSContext(Object context) | 
|  void | setVariableContext(org.jaxen.VariableContext variableContext)Sets the variable context to be used when evaluating XPath expressions | 
|  void | sort(List list)sortsorts the given List of Nodes using this XPath
 expression as aComparator. | 
|  void | sort(List list,
     boolean distinct)sortsorts the given List of Nodes using this XPath
 expression as aComparatorand optionally removing duplicates. | 
| protected  void | sort(List list,
     Map sortValues)Sorts the list based on the sortValues for each node | 
|  String | toString() | 
|  String | valueOf(Object context)valueOfevaluates this XPath expression and returns the
 textual representation of the results using the XPath string() function. | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
public DefaultXPath(String text)
             throws InvalidXPathException
text - DOCUMENT ME!
InvalidXPathException - DOCUMENT ME!| Method Detail | 
public String toString()
public String getText()
getText in interface XPathpublic org.jaxen.FunctionContext getFunctionContext()
XPath
getFunctionContext in interface XPathpublic void setFunctionContext(org.jaxen.FunctionContext functionContext)
XPath
setFunctionContext in interface XPathfunctionContext - DOCUMENT ME!public org.jaxen.NamespaceContext getNamespaceContext()
XPath
getNamespaceContext in interface XPathpublic void setNamespaceURIs(Map map)
XPathSets the current NamespaceContext from a Map where the keys are the String namespace prefixes and the values are the namespace URIs.
For example:
 Map uris = new HashMap();
 uris.put("SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/");
 uris.put("m", "urn:xmethodsBabelFish");
 XPath xpath = document
         .createXPath("SOAP-ENV:Envelope/SOAP-ENV:Body/m:BabelFish");
 xpath.setNamespaceURIs(uris);
 Node babelfish = xpath.selectSingleNode(document);
 
 
 
setNamespaceURIs in interface XPathmap - the map containing the namespace mappingspublic void setNamespaceContext(org.jaxen.NamespaceContext namespaceContext)
XPath
setNamespaceContext in interface XPathnamespaceContext - DOCUMENT ME!public org.jaxen.VariableContext getVariableContext()
XPath
getVariableContext in interface XPathpublic void setVariableContext(org.jaxen.VariableContext variableContext)
XPath
setVariableContext in interface XPathvariableContext - DOCUMENT ME!public Object evaluate(Object context)
XPath
 evaluate evaluates an XPath expression and returns the
 result as an Object. The object returned can either be a List of Nodeinstances, a Nodeinstance, a String or a Numberinstance depending on the XPath expression.
 
evaluate in interface XPathcontext - is either a node or a list of nodes on which to evalute the
            XPath
Listof Node instances, a Nodeinstance, a Stringor a
         Numberinstance depending on the XPath expression.public Object selectObject(Object context)
XPath
 selectObject evaluates an XPath expression and returns the
 result as an Object. The object returned can either be a List of Nodeinstances, a Nodeinstance, a String or a Numberinstance depending on the XPath expression.
 
selectObject in interface XPathcontext - is either a node or a list of nodes on which to evalute the
            XPath
Listof Node instances, a Nodeinstance, a Stringor a
         Numberinstance depending on the XPath expression.public List selectNodes(Object context)
XPath
 selectNodes performs this XPath expression on the given
 Nodeor Listof Nodes instances appending all
 the results together into a single list.
 
selectNodes in interface XPathcontext - is either a node or a list of nodes on which to evalute the
            XPath
public List selectNodes(Object context,
                        XPath sortXPath)
XPath
 selectNodes evaluates the XPath expression on the given
 Nodeor Listof Nodes and returns the result as
 a List of Node s sorted by the sort XPath
 expression.
 
selectNodes in interface XPathcontext - is either a node or a list of nodes on which to evalute the
            XPathsortXPath - is the XPath expression to sort by
Node instances
public List selectNodes(Object context,
                        XPath sortXPath,
                        boolean distinct)
XPath
 selectNodes evaluates the XPath expression on the given
 Nodeor Listof Nodes and returns the result as
 a List of Node s sorted by the sort XPath
 expression.
 
selectNodes in interface XPathcontext - is either a node or a list of nodes on which to evalute the
            XPathsortXPath - is the XPath expression to sort bydistinct - specifies whether or not duplicate values of the sort
            expression are allowed. If this parameter is true then only
            distinct sort expressions values are included in the result
Node instancespublic Node selectSingleNode(Object context)
XPath
 selectSingleNode evaluates this XPath expression on the
 given Nodeor Listof Nodes and returns the
 result as a single Node instance.
 
selectSingleNode in interface XPathcontext - is either a node or a list of nodes on which to evalute the
            XPath
Node instancepublic String valueOf(Object context)
XPath
 valueOf evaluates this XPath expression and returns the
 textual representation of the results using the XPath string() function.
 
valueOf in interface XPathcontext - is either a node or a list of nodes on which to evalute the
            XPath
public Number numberValueOf(Object context)
XPath
 numberValueOf evaluates an XPath expression and returns
 the numeric value of the XPath expression if the XPath expression results
 is a number, or null if the result is not a number.
 
numberValueOf in interface XPathcontext - is either a node or a list of nodes on which to evalute the
            XPath
public boolean booleanValueOf(Object context)
XPath
 The boolean-value of the expression is determined per the
 boolean(..) core function as defined in the XPath
 specification. This means that an expression that selects zero nodes will
 return false, while an expression that selects
 one-or-more nodes will return true.
 
booleanValueOf in interface XPathcontext - The node, nodeset or Context object for evaluation. This value
            can be null
public void sort(List list)
 sort sorts the given List of Nodes using this XPath
 expression as a Comparator.
 
sort in interface XPathlist - is the list of Nodes to sort
public void sort(List list,
                 boolean distinct)
 sort sorts the given List of Nodes using this XPath
 expression as a Comparatorand optionally removing duplicates.
 
sort in interface XPathlist - is the list of Nodes to sortdistinct - if true then duplicate values (using the sortXPath for
            comparisions) will be removed from the Listpublic boolean matches(Node node)
XPath
 matches returns true if the given node matches the XPath
 expression. To be more precise when evaluating this XPath expression on
 the given node the result set must include the node.
 
matches in interface XPathnode - DOCUMENT ME!
protected void sort(List list,
                    Map sortValues)
list - DOCUMENT ME!sortValues - DOCUMENT ME!
protected void removeDuplicates(List list,
                                Map sortValues)
list - DOCUMENT ME!sortValues - DOCUMENT ME!protected Object getCompareValue(Node node)
node - DOCUMENT ME!
protected static org.jaxen.XPath parse(String text)
protected void setNSContext(Object context)
protected void handleJaxenException(org.jaxen.JaxenException exception)
                             throws XPathException
XPathException| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||