org.netbeans.modules.xml.xdm.visitor
Class XPathFinder
java.lang.Object
org.netbeans.modules.xml.xdm.visitor.DefaultVisitor
org.netbeans.modules.xml.xdm.visitor.ChildVisitor
org.netbeans.modules.xml.xdm.visitor.XPathFinder
- All Implemented Interfaces:
- XMLNodeVisitor
public class XPathFinder
- extends ChildVisitor
Finder for nodes from a document using arbitrary XPath expression.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SEP
public static final String SEP
- See Also:
- Constant Field Values
AT
public static final String AT
- See Also:
- Constant Field Values
COLON
public static final String COLON
- See Also:
- Constant Field Values
BRACKET0
public static final String BRACKET0
- See Also:
- Constant Field Values
BRACKET1
public static final String BRACKET1
- See Also:
- Constant Field Values
XPNS
public static final String XPNS
- See Also:
- Constant Field Values
XPathFinder
public XPathFinder()
getXpath
public static String getXpath(Document root,
Node target)
- Parameters:
root - root nodetarget - Element or Attribute node to generate the xpath for.
- Returns:
- an xpath that can be used to retrieve the given node using #findNode
findNode
public Node findNode(Document root,
String xpath)
- Parameters:
root - context in which to find the node.xpath - location path for the attribute or element.
- Returns:
- the node correspond to specified xpath, if provided xpath result
in more than one nodes, only the first on get returned.
findNodes
public List<Node> findNodes(Document root,
String xpathExpression)
- Parameters:
root - context in which to find the node.xpath - location path for the attribute or element.
- Returns:
- the nodes correspond to specified xpath.
visitNode
protected void visitNode(Node e)
- Overrides:
visitNode in class ChildVisitor
isReadyForEvaluation
public boolean isReadyForEvaluation()
getNamespaceContext
public NamespaceContext getNamespaceContext()