org.jafer.query.converter
Class Converter

java.lang.Object
  extended by org.jafer.query.converter.Converter
Direct Known Subclasses:
CQLQueryConverter, JaferQueryConverter, RPNQueryConverter

public abstract class Converter
extends java.lang.Object

Abstract base class that provides basic XML routines and Jafer Node processing


Field Summary
private static org.w3c.dom.Node contextNode
          Stores a reference to the node last queried by XPath
private static org.apache.xpath.CachedXPathAPI xPathAPI
          Stores a reference to the xpathAPI last used
 
Constructor Summary
Converter()
           
 
Method Summary
protected static int findNotChild(org.w3c.dom.Node node)
          Finds the position of the NOT node from the specified node
protected static org.w3c.dom.Node getFirstChild(org.w3c.dom.Node sourceNode)
          Utility method to get the first c for the supplied node
protected static java.lang.String getNodeValue(org.w3c.dom.Node node)
          Utility method to get the value of the node
protected static org.w3c.dom.Node getSecondChild(org.w3c.dom.Node sourceNode)
          Utility method to get the second child for the supplied node
protected static org.w3c.dom.Node selectNode(org.w3c.dom.Node sourceNode, java.lang.String XPath)
          This method selects the node specified by the xpath from the source node
protected static org.w3c.dom.NodeList selectNodeList(org.w3c.dom.Node sourceNode, java.lang.String XPath)
          This method selects the nodes specified by the xpath from the source node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xPathAPI

private static org.apache.xpath.CachedXPathAPI xPathAPI
Stores a reference to the xpathAPI last used


contextNode

private static org.w3c.dom.Node contextNode
Stores a reference to the node last queried by XPath

Constructor Detail

Converter

public Converter()
Method Detail

getFirstChild

protected static org.w3c.dom.Node getFirstChild(org.w3c.dom.Node sourceNode)
                                         throws QueryException
Utility method to get the first c for the supplied node

Parameters:
sourceNode - The node to process
Returns:
The first node found
Throws:
QueryException

getSecondChild

protected static org.w3c.dom.Node getSecondChild(org.w3c.dom.Node sourceNode)
                                          throws QueryException
Utility method to get the second child for the supplied node

Parameters:
sourceNode - The node to process
Returns:
The second node found
Throws:
QueryException

selectNode

protected static org.w3c.dom.Node selectNode(org.w3c.dom.Node sourceNode,
                                             java.lang.String XPath)
                                      throws QueryException
This method selects the node specified by the xpath from the source node

Parameters:
sourceNode - The node to select form
XPath - The XPath consition used to select the node
Returns:
The node selected
Throws:
QueryException

selectNodeList

protected static org.w3c.dom.NodeList selectNodeList(org.w3c.dom.Node sourceNode,
                                                     java.lang.String XPath)
                                              throws QueryException
This method selects the nodes specified by the xpath from the source node

Parameters:
sourceNode - The node to select form
XPath - The XPath consition used to select the nodes
Returns:
The nodes selected
Throws:
QueryException

getNodeValue

protected static java.lang.String getNodeValue(org.w3c.dom.Node node)
                                        throws QueryException
Utility method to get the value of the node

Parameters:
node - The node to extracy the value from
Returns:
The string representation of the value
Throws:
QueryException

findNotChild

protected static int findNotChild(org.w3c.dom.Node node)
                           throws QueryException
Finds the position of the NOT node from the specified node

Parameters:
node - The node to process
Returns:
The position of the NOT node - 0 if not found
Throws:
QueryException