Package org.jdom2.xpath.jaxen
Class JDOMXPath
- java.lang.Object
-
- org.jdom2.xpath.XPath
-
- org.jdom2.xpath.jaxen.JDOMXPath
-
- All Implemented Interfaces:
java.io.Serializable
@Deprecated public class JDOMXPath extends XPath
Deprecated.replaced by compiled version.A concrete XPath implementation for Jaxen. This class must be public because the main JDOM XPath class needs to access the class, and the constructor. The generic type of the returned values from this XPath instance.- Author:
- Laurent Bihanic
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.jdom2.xpath.XPath
JDOM_OBJECT_MODEL_URI
-
-
Constructor Summary
Constructors Constructor Description JDOMXPath(java.lang.String expr)
Deprecated.Creates a new XPath wrapper object, compiling the specified XPath expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addNamespace(Namespace namespace)
Deprecated.Adds a namespace definition to the list of namespaces known of this XPath expression.java.lang.String
getXPath()
Deprecated.Returns the wrapped XPath expression as a string.java.lang.Number
numberValueOf(java.lang.Object context)
Deprecated.Returns the number value of the first item selected by applying the wrapped XPath expression to the given context.java.util.List<?>
selectNodes(java.lang.Object context)
Deprecated.Evaluates the wrapped XPath expression and returns the list of selected items.java.lang.Object
selectSingleNode(java.lang.Object context)
Deprecated.Evaluates the wrapped XPath expression and returns the first entry in the list of selected nodes (or atomics).void
setVariable(java.lang.String name, java.lang.Object value)
Deprecated.Defines an XPath variable and sets its value.java.lang.String
toString()
Deprecated.java.lang.String
valueOf(java.lang.Object context)
Deprecated.Returns the string value of the first node selected by applying the wrapped XPath expression to the given context.-
Methods inherited from class org.jdom2.xpath.XPath
addNamespace, newInstance, selectNodes, selectSingleNode, setXPathClass, writeReplace
-
-
-
-
Constructor Detail
-
JDOMXPath
public JDOMXPath(java.lang.String expr) throws JDOMException
Deprecated.Creates a new XPath wrapper object, compiling the specified XPath expression.- Parameters:
expr
- the XPath expression to wrap.- Throws:
JDOMException
- if the XPath expression is invalid.
-
-
Method Detail
-
selectNodes
public java.util.List<?> selectNodes(java.lang.Object context) throws JDOMException
Deprecated.Evaluates the wrapped XPath expression and returns the list of selected items.- Specified by:
selectNodes
in classXPath
- Parameters:
context
- the node to use as context for evaluating the XPath expression.- Returns:
- the list of selected items, which may be of types:
Element
,Attribute
,Text
,CDATA
,Comment
,ProcessingInstruction
, Boolean, Double, or String. - Throws:
JDOMException
- if the evaluation of the XPath expression on the specified context failed.
-
selectSingleNode
public java.lang.Object selectSingleNode(java.lang.Object context) throws JDOMException
Deprecated.Evaluates the wrapped XPath expression and returns the first entry in the list of selected nodes (or atomics).- Specified by:
selectSingleNode
in classXPath
- Parameters:
context
- the node to use as context for evaluating the XPath expression.- Returns:
- the first selected item, which may be of types:
Element
,Attribute
,Text
,CDATA
,Comment
,ProcessingInstruction
, Boolean, Double, String, ornull
if no item was selected. - Throws:
JDOMException
- if the evaluation of the XPath expression on the specified context failed.
-
valueOf
public java.lang.String valueOf(java.lang.Object context) throws JDOMException
Deprecated.Returns the string value of the first node selected by applying the wrapped XPath expression to the given context.- Specified by:
valueOf
in classXPath
- Parameters:
context
- the element to use as context for evaluating the XPath expression.- Returns:
- the string value of the first node selected by applying the wrapped XPath expression to the given context.
- Throws:
JDOMException
- if the XPath expression is invalid or its evaluation on the specified context failed.
-
numberValueOf
public java.lang.Number numberValueOf(java.lang.Object context) throws JDOMException
Deprecated.Returns the number value of the first item selected by applying the wrapped XPath expression to the given context.- Specified by:
numberValueOf
in classXPath
- Parameters:
context
- the element to use as context for evaluating the XPath expression.- Returns:
- the number value of the first item selected by applying the
wrapped XPath expression to the given context,
null
if no node was selected or the special valueDouble.NaN
(Not-a-Number) if the selected value can not be converted into a number value. - Throws:
JDOMException
- if the XPath expression is invalid or its evaluation on the specified context failed.
-
setVariable
public void setVariable(java.lang.String name, java.lang.Object value) throws java.lang.IllegalArgumentException
Deprecated.Defines an XPath variable and sets its value.- Specified by:
setVariable
in classXPath
- Parameters:
name
- the variable name.value
- the variable value.- Throws:
java.lang.IllegalArgumentException
- ifname
is not a valid XPath variable name or if the value type is not supported by the underlying implementation
-
addNamespace
public void addNamespace(Namespace namespace)
Deprecated.Adds a namespace definition to the list of namespaces known of this XPath expression.Note: In XPath, there is no such thing as a 'default namespace'. The empty prefix always resolves to the empty namespace URI.
- Specified by:
addNamespace
in classXPath
- Parameters:
namespace
- the namespace.
-
getXPath
public java.lang.String getXPath()
Deprecated.Returns the wrapped XPath expression as a string.
-
toString
public java.lang.String toString()
Deprecated.- Overrides:
toString
in classjava.lang.Object
-
-