org.netbeans.modules.xml.xdm/1 1.19.0 1

org.netbeans.modules.xml.xdm.visitor
Class XPathFinder

java.lang.Object
  extended by org.netbeans.modules.xml.xdm.visitor.DefaultVisitor
      extended by org.netbeans.modules.xml.xdm.visitor.ChildVisitor
          extended by 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.


Field Summary
static String AT
           
static String BRACKET0
           
static String BRACKET1
           
static String COLON
           
static String SEP
           
static String XPNS
           
 
Constructor Summary
XPathFinder()
           
 
Method Summary
 Node findNode(Document root, String xpath)
           
 List<Node> findNodes(Document root, String xpathExpression)
           
 NamespaceContext getNamespaceContext()
           
static String getXpath(Document root, Node target)
           
 boolean isReadyForEvaluation()
           
protected  void visitNode(Node e)
           
 
Methods inherited from class org.netbeans.modules.xml.xdm.visitor.DefaultVisitor
visit, visit, visit, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

XPathFinder

public XPathFinder()
Method Detail

getXpath

public static String getXpath(Document root,
                              Node target)
Parameters:
root - root node
target - 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()

org.netbeans.modules.xml.xdm/1 1.19.0 1

Built on May 25 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.