|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jaxen.BaseXPath
org.jaxen.javabean.JavaBeanXPath
An XPath implementation for JavaBeans.
This is the main entry point for matching an XPath against a JavaBean
tree. You create a compiled XPath object, then match it against
one or more context nodes using the BaseXPath.selectNodes(Object)
method, as in the following example:
Node node = ...; XPath path = new JavaBeanXPath("a/b/c"); List results = path.selectNodes(node);
BaseXPath
,
Serialized FormConstructor Summary | |
JavaBeanXPath(java.lang.String xpathExpr)
Construct given an XPath expression string. |
Method Summary | |
java.lang.Object |
evaluate(java.lang.Object node)
Evaluate this XPath against a given context. |
protected Context |
getContext(java.lang.Object node)
Create a Context wrapper for the provided
implementation-specific object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public JavaBeanXPath(java.lang.String xpathExpr) throws JaxenException
xpathExpr
- The XPath expression.
JaxenException
- if there is a syntax error while
parsing the expressionMethod Detail |
protected Context getContext(java.lang.Object node)
BaseXPath
Context
wrapper for the provided
implementation-specific object.
getContext
in class BaseXPath
node
- the implementation-specific object
to be used as the context
Context
wrapper around the objectpublic java.lang.Object evaluate(java.lang.Object node) throws JaxenException
BaseXPath
The context of evaluation may be a document, an element, or a set of elements.
If the expression evaluates to a single primitive (String, Number or Boolean) type, it is returned directly. Otherwise, the returned value is a list (a node-set in the terms of the specification) of values.
When using this method, one must be careful to
test the class of the returned objects, and of
each of the composite members if a List
is returned. If the returned members are XML entities,
they will be the actual Document
,
Element
or Attribute
objects
as defined by the concrete XML object-model implementation,
directly from the context document. This does not
return copies of anything, but merely returns
references to entities within the source document.
evaluate
in interface XPath
evaluate
in class BaseXPath
node
- the node, node-set or Context object for evaluation. This value can be null.
JaxenException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |