@Deprecated public class JDOMXPath extends XPath
JDOM_OBJECT_MODEL_URI
Constructor and Description |
---|
JDOMXPath(java.lang.String expr)
Deprecated.
Creates a new XPath wrapper object, compiling the specified XPath
expression.
|
Modifier and Type | Method and 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.
|
addNamespace, newInstance, selectNodes, selectSingleNode, setXPathClass, writeReplace
public JDOMXPath(java.lang.String expr) throws JDOMException
expr
- the XPath expression to wrap.JDOMException
- if the XPath expression is invalid.public java.util.List<?> selectNodes(java.lang.Object context) throws JDOMException
selectNodes
in class XPath
context
- the node to use as context for evaluating the XPath expression.Element
, Attribute
, Text
, CDATA
, Comment
, ProcessingInstruction
, Boolean, Double, or String.JDOMException
- if the evaluation of the XPath expression on the specified
context failed.public java.lang.Object selectSingleNode(java.lang.Object context) throws JDOMException
selectSingleNode
in class XPath
context
- the node to use as context for evaluating the XPath expression.Element
,
Attribute
, Text
, CDATA
, Comment
,
ProcessingInstruction
, Boolean, Double, String, or
null
if no item was selected.JDOMException
- if the evaluation of the XPath expression on the specified
context failed.public java.lang.String valueOf(java.lang.Object context) throws JDOMException
valueOf
in class XPath
context
- the element to use as context for evaluating the XPath expression.JDOMException
- if the XPath expression is invalid or its evaluation on the
specified context failed.public java.lang.Number numberValueOf(java.lang.Object context) throws JDOMException
numberValueOf
in class XPath
context
- the element to use as context for evaluating the XPath expression.null
if no node was selected or the special value
Double.NaN
(Not-a-Number) if the selected value
can not be converted into a number value.JDOMException
- if the XPath expression is invalid or its evaluation on the
specified context failed.public void setVariable(java.lang.String name, java.lang.Object value) throws java.lang.IllegalArgumentException
setVariable
in class XPath
name
- the variable name.value
- the variable value.java.lang.IllegalArgumentException
- if name
is not a valid XPath variable name or if the
value type is not supported by the underlying implementationpublic void addNamespace(Namespace namespace)
Note: In XPath, there is no such thing as a 'default namespace'. The empty prefix always resolves to the empty namespace URI.
addNamespace
in class XPath
namespace
- the namespace.public java.lang.String getXPath()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2021 Jason Hunter, Brett McLaughlin. All Rights Reserved.