g-Eclipse
Release 1.0.0

eu.geclipse.jsdl.xpath
Class XPathDocument

java.lang.Object
  extended by eu.geclipse.jsdl.xpath.XPathDocument

public class XPathDocument
extends java.lang.Object

Class simplifying querying of XML Document using XPath language. Handle such things like namespaces, caching compiled expressions etc.


Constructor Summary
XPathDocument(org.w3c.dom.Document document)
           
 
Method Summary
 org.w3c.dom.Document getDomDocument()
           
 org.w3c.dom.NodeList getNodes(org.w3c.dom.Node parentNode, java.lang.String xpathQuery)
          Get nodes selected by giving XPath
 org.w3c.dom.NodeList getNodes(java.lang.String xpathQuery)
          Makes the same as getNodes(Node, String) starting from document root
 java.lang.String getValue(org.w3c.dom.Node parentNode, java.lang.String xpathQuery)
          Get String value from node selected by query.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XPathDocument

public XPathDocument(org.w3c.dom.Document document)
Parameters:
document - on which XPath queries will be run
Method Detail

getNodes

public org.w3c.dom.NodeList getNodes(org.w3c.dom.Node parentNode,
                                     java.lang.String xpathQuery)
                              throws javax.xml.xpath.XPathExpressionException
Get nodes selected by giving XPath

Parameters:
parentNode - XML node, from which query will be executed.
xpathQuery -
Returns:
nodes selected by query
Throws:
javax.xml.xpath.XPathExpressionException

getNodes

public org.w3c.dom.NodeList getNodes(java.lang.String xpathQuery)
                              throws javax.xml.xpath.XPathExpressionException
Makes the same as getNodes(Node, String) starting from document root

Parameters:
xpathQuery -
Returns:
nodes selected by query
Throws:
javax.xml.xpath.XPathExpressionException

getValue

public java.lang.String getValue(org.w3c.dom.Node parentNode,
                                 java.lang.String xpathQuery)
                          throws javax.xml.xpath.XPathExpressionException
Get String value from node selected by query.

Parameters:
parentNode -
xpathQuery -
Returns:
text value from selected node
Throws:
javax.xml.xpath.XPathExpressionException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getDomDocument

public org.w3c.dom.Document getDomDocument()
Returns:
dom document, which is attached to this xpath document

g-Eclipse
Release 1.0.0