Deprecated
Use XPathFactory/XPathExpression/XPathBuilder instead.
setXPathClass or
the system property "org.jdom2.xpath.class".
| Modifier and Type | Class and Description |
|---|---|
| private static class | XPath.XPathString
The XPathString is dedicated to serialize instances of XPath subclasses in a implementation-independent manner. |
| Modifier and Type | Field and Description |
|---|---|
| private static Constructor | constructor
The constructor to instantiate a new XPath concrete implementation. |
| private static final String | DEFAULT_XPATH_CLASS
The default implementation class to use if none was configured. |
| public static final String | JDOM_OBJECT_MODEL_URI
The string passable to the JAXP 1.3 XPathFactory isObjectModelSupported() method to query an XPath engine regarding its support for JDOM. |
| private static final long | serialVersionUID
Standard JDOM2 Serialization. |
| private static final String | XPATH_CLASS_PROPERTY
The name of the system property from which to retrieve the name of the implementation class to use. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public abstract void | addNamespace(Namespace
the namespace. namespace)Adds a namespace definition to the list of namespaces known of this XPath expression. |
| public void | addNamespace(String
the namespace prefix. prefix, String the namespace URI. uri)Adds a namespace definition (prefix and URI) to the list of namespaces known of this XPath expression. |
| public abstract String | Returns: the wrapped XPath expression as a string.Returns the wrapped XPath expression as a string. |
| public static XPath | Returns: an XPath instance representing the input paththe XPath expression to wrap. path)
Deprecated
as a consequence of
Creates a new XPath wrapper object, compiling the specified
XPath expression.
XPath being deprecated.
|
| public abstract Number | Returns: the number value of the first node selected by applying the wrapped XPath expression to the given context,null if no node was selected or the
special value java.
(Not-a-Number) if the selected value can not be
converted into a number value.the element to use as context for evaluating
the XPath expression. context)Returns the number value of the first node selected by applying the wrapped XPath expression to the given context. |
| public abstract List | selectNodes(Object
the node to use as context for evaluating
the XPath expression. context)Evaluates the wrapped XPath expression and returns the list of selected items. |
| public static List | selectNodes(Object
the node to use as context for evaluating
the XPath expression. context, String the XPath expression to evaluate. path)Evaluates an XPath expression and returns the list of selected items. |
| public abstract Object | selectSingleNode(Object
the node to use as context for evaluating
the XPath expression. context)Evaluates the wrapped XPath expression and returns the first entry in the list of selected nodes (or atomics). |
| public static Object | selectSingleNode(Object
the element to use as context for evaluating
the XPath expression. context, String the XPath expression to evaluate. path)Evaluates the wrapped XPath expression and returns the first entry in the list of selected nodes (or atomics). |
| public abstract void | setVariable(String
the variable name. name, Object the variable value. value)Defines an XPath variable and sets its value. |
| public static void | setXPathClass(Class<? extends XPath>
the concrete subclass of XPath. aClass)Sets the concrete XPath subclass to use when allocating XPath instances. |
| public abstract String | Returns: the string value of the first node selected by applying the wrapped XPath expression to the given context.the element to use as context for evaluating
the XPath expression. context)Returns the string value of the first node selected by applying the wrapped XPath expression to the given context. |
| protected final Object | Returns: an XPathString instance configured with the wrapped XPath expression.[Serialization support] Returns the alternative object to write to the stream when serializing this object. |
| constructor | back to summary |
|---|---|
| private static Constructor<? extends XPath> constructor The constructor to instantiate a new XPath concrete implementation.
| |
| DEFAULT_XPATH_CLASS | back to summary |
|---|---|
| private static final String DEFAULT_XPATH_CLASS The default implementation class to use if none was configured. | |
| JDOM_OBJECT_MODEL_URI | back to summary |
|---|---|
| public static final String JDOM_OBJECT_MODEL_URI The string passable to the JAXP 1.3 XPathFactory isObjectModelSupported() method to query an XPath engine regarding its support for JDOM. Defined to be the well-known URI "http://jdom.org/jaxp/xpath/jdom". | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Standard JDOM2 Serialization. Default mechanism. | |
| XPATH_CLASS_PROPERTY | back to summary |
|---|---|
| private static final String XPATH_CLASS_PROPERTY The name of the system property from which to retrieve the name of the implementation class to use.
The property name is:
" | |
| XPath | back to summary |
|---|---|
| public XPath() | |
| addNamespace | back to summary |
|---|---|
| public abstract void addNamespace(Namespace namespace) 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.
| |
| addNamespace | back to summary |
|---|---|
| public void addNamespace(String prefix, String uri) Adds a namespace definition (prefix and URI) 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.
| |
| getXPath | back to summary |
|---|---|
| public abstract String getXPath() Returns the wrapped XPath expression as a string.
| |
| newInstance | back to summary |
|---|---|
| public static XPath newInstance(String path) throws JDOMException
Deprecated as a consequence of Creates a new XPath wrapper object, compiling the specified XPath expression.
| |
| numberValueOf | back to summary |
|---|---|
| public abstract Number numberValueOf(Object context) throws JDOMException Returns the number value of the first node selected by applying the wrapped XPath expression to the given context.
| |
| selectNodes | back to summary |
|---|---|
| public abstract List Evaluates the wrapped XPath expression and returns the list of selected items.
| |
| selectNodes | back to summary |
|---|---|
| public static List Evaluates an XPath expression and returns the list of selected items. Note This method should not be used when the
same XPath expression needs to be applied several times (on the
same or different contexts) as it requires the expression to be
compiled before being evaluated. In such cases,
| |
| selectSingleNode | back to summary |
|---|---|
| public abstract Object selectSingleNode(Object context) throws JDOMException Evaluates the wrapped XPath expression and returns the first entry in the list of selected nodes (or atomics).
| |
| selectSingleNode | back to summary |
|---|---|
| public static Object selectSingleNode(Object context, String path) throws JDOMException Evaluates the wrapped XPath expression and returns the first entry in the list of selected nodes (or atomics). Note This method should not be used when the
same XPath expression needs to be applied several times (on the
same or different contexts) as it requires the expression to be
compiled before being evaluated. In such cases,
| |
| setVariable | back to summary |
|---|---|
| public abstract void setVariable(String name, Object value) Defines an XPath variable and sets its value.
| |
| setXPathClass | back to summary |
|---|---|
| public static void setXPathClass(Class<? extends XPath> aClass) throws JDOMException Sets the concrete XPath subclass to use when allocating XPath instances.
| |
| valueOf | back to summary |
|---|---|
| public abstract String valueOf(Object context) throws JDOMException Returns the string value of the first node selected by applying the wrapped XPath expression to the given context.
| |
| writeReplace | back to summary |
|---|---|
| protected final Object writeReplace() throws ObjectStreamException [Serialization support] Returns the alternative object to write to the stream when serializing this object. This method returns an instance of a dedicated nested class to serialize XPath expressions independently of the concrete implementation being used. Note Subclasses are not allowed to override this method to ensure valid serialization of all implementations.
| |
XPathString ensures that only string data are serialized. Upon deserialization, XPathString relies on XPath factory method to to create instances of the concrete XPath wrapper currently configured.
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Standard JDOM2 Serialization. |
| private String | xPath
The XPath expression as a string. |
| Access | Constructor and Description |
|---|---|
| public | XPathString(String
the XPath expression. xpath)Creates a new XPathString instance from the specified XPath expression. |
| Modifier and Type | Method and Description |
|---|---|
| private Object | Returns: an instance of a concrete implementation of XPath.[Serialization support] Resolves the read XPathString objects into XPath implementations. |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Standard JDOM2 Serialization. Default mechanism. | |
| xPath | back to summary |
|---|---|
| private String xPath The XPath expression as a string. | |
| XPathString | back to summary |
|---|---|
| public XPathString(String xpath) Creates a new XPathString instance from the specified XPath expression.
| |
| readResolve | back to summary |
|---|---|
| private Object readResolve() throws ObjectStreamException [Serialization support] Resolves the read XPathString objects into XPath implementations.
| |