com.novell.xml.xpath
Class XPathUtil

java.lang.Object
  extended bycom.novell.xml.xpath.XPathUtil

public final class XPathUtil
extends Object

A utility class that gathers XPath functions together that don't fit under a real class.


Method Summary
static String describeNode(Node node)
          Provide a textual representation of a node, suitable for debugging.
static Class doGetClass(String className)
          Get a class object by name without worrying about a ClassNotFound exception.
static void dump(Object obj, PrintWriter writer, int indent)
          Print in a readable form for debugging.
static Node getNextSibling(Node node)
          Helper function to get next sibling of a Node, treating adjacent text nodes as a single text node.
static short getNodeType(Node node)
          Returns the DOM Node Type, except Node.CDATA_SECTION_NODE is returned as Node.TEXT_NODE.
static String getNodeValue(Node node)
          Return the XPath-defined node value for the passed node.
static Node getPreviousSibling(Node node)
          Helper function to get previous sibling of a Node, treating adjacent text nodes as a single text node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getNodeType

public static short getNodeType(Node node)
Returns the DOM Node Type, except Node.CDATA_SECTION_NODE is returned as Node.TEXT_NODE.

Parameters:
node - Node whose type is to be returned.
Returns:
node type

getNodeValue

public static String getNodeValue(Node node)
Return the XPath-defined node value for the passed node.

Parameters:
node - The node whose value is desired.
Returns:
A string containing the node value.

getNextSibling

public static Node getNextSibling(Node node)
Helper function to get next sibling of a Node, treating adjacent text nodes as a single text node.

Parameters:
node - Node whose next sibling is to be returned
Returns:
null or the next sibling in the XPath data model.

getPreviousSibling

public static Node getPreviousSibling(Node node)
Helper function to get previous sibling of a Node, treating adjacent text nodes as a single text node.

Parameters:
node - Node whose previous sibling is to be returned
Returns:
null or the previous sibling in the XPath data model.

doGetClass

public static Class doGetClass(String className)
Get a class object by name without worrying about a ClassNotFound exception.

Parameters:
className - The name of the Class object to get.
Returns:
The Class object.

describeNode

public static String describeNode(Node node)
Provide a textual representation of a node, suitable for debugging. This "overrides" the DOMUtil version so we can handle XPath-specific node types (namespace nodes).

Parameters:
node - The node to be described.
Returns:
A string containing a textual representation of the node.

dump

public static void dump(Object obj,
                        PrintWriter writer,
                        int indent)
Print in a readable form for debugging.

Parameters:
obj - The object to output.
writer - The output device.
indent - Number of tabs to indent the result.