org.dom4j.xpath

Class DefaultXPath

public class DefaultXPath extends Object implements XPath, NodeFilter, Serializable

Default implementation of {@link org.dom4j.XPath}which uses the Jaxen project.

Author: bob mcwhirter James Strachan

Constructor Summary
DefaultXPath(String text)
Construct an XPath
Method Summary
booleanbooleanValueOf(Object context)
Objectevaluate(Object context)
protected ObjectgetCompareValue(Node node)
DOCUMENT ME!
FunctionContextgetFunctionContext()
NamespaceContextgetNamespaceContext()
StringgetText()
Retrieve the textual XPath string used to initialize this Object
VariableContextgetVariableContext()
protected voidhandleJaxenException(JaxenException exception)
booleanmatches(Node node)
NumbernumberValueOf(Object context)
protected static XPathparse(String text)
protected voidremoveDuplicates(List list, Map sortValues)
Removes items from the list which have duplicate values
ListselectNodes(Object context)
ListselectNodes(Object context, XPath sortXPath)
ListselectNodes(Object context, XPath sortXPath, boolean distinct)
ObjectselectObject(Object context)
NodeselectSingleNode(Object context)
voidsetFunctionContext(FunctionContext functionContext)
voidsetNamespaceContext(NamespaceContext namespaceContext)
voidsetNamespaceURIs(Map map)
protected voidsetNSContext(Object context)
voidsetVariableContext(VariableContext variableContext)
voidsort(List list)

sort sorts the given List of Nodes using this XPath expression as a {@link Comparator}.

voidsort(List list, boolean distinct)

sort sorts the given List of Nodes using this XPath expression as a {@link Comparator}and optionally removing duplicates.

protected voidsort(List list, Map sortValues)
Sorts the list based on the sortValues for each node
StringtoString()
StringvalueOf(Object context)

Constructor Detail

DefaultXPath

public DefaultXPath(String text)
Construct an XPath

Parameters: text DOCUMENT ME!

Throws: InvalidXPathException DOCUMENT ME!

Method Detail

booleanValueOf

public boolean booleanValueOf(Object context)

evaluate

public Object evaluate(Object context)

getCompareValue

protected Object getCompareValue(Node node)
DOCUMENT ME!

Parameters: node DOCUMENT ME!

Returns: the node expression used for sorting comparisons

getFunctionContext

public FunctionContext getFunctionContext()

getNamespaceContext

public NamespaceContext getNamespaceContext()

getText

public String getText()
Retrieve the textual XPath string used to initialize this Object

Returns: The XPath string

getVariableContext

public VariableContext getVariableContext()

handleJaxenException

protected void handleJaxenException(JaxenException exception)

matches

public boolean matches(Node node)

numberValueOf

public Number numberValueOf(Object context)

parse

protected static XPath parse(String text)

removeDuplicates

protected void removeDuplicates(List list, Map sortValues)
Removes items from the list which have duplicate values

Parameters: list DOCUMENT ME! sortValues DOCUMENT ME!

selectNodes

public List selectNodes(Object context)

selectNodes

public List selectNodes(Object context, XPath sortXPath)

selectNodes

public List selectNodes(Object context, XPath sortXPath, boolean distinct)

selectObject

public Object selectObject(Object context)

selectSingleNode

public Node selectSingleNode(Object context)

setFunctionContext

public void setFunctionContext(FunctionContext functionContext)

setNamespaceContext

public void setNamespaceContext(NamespaceContext namespaceContext)

setNamespaceURIs

public void setNamespaceURIs(Map map)

setNSContext

protected void setNSContext(Object context)

setVariableContext

public void setVariableContext(VariableContext variableContext)

sort

public void sort(List list)

sort sorts the given List of Nodes using this XPath expression as a {@link Comparator}.

Parameters: list is the list of Nodes to sort

sort

public void sort(List list, boolean distinct)

sort sorts the given List of Nodes using this XPath expression as a {@link Comparator}and optionally removing duplicates.

Parameters: list is the list of Nodes to sort distinct if true then duplicate values (using the sortXPath for comparisions) will be removed from the List

sort

protected void sort(List list, Map sortValues)
Sorts the list based on the sortValues for each node

Parameters: list DOCUMENT ME! sortValues DOCUMENT ME!

toString

public String toString()

valueOf

public String valueOf(Object context)
Copyright B) 2005 MetaStuff Ltd. All Rights Reserved. Hosted by

SourceForge