geo.google.utils
Class XmlUtils

java.lang.Object
  extended by geo.google.utils.XmlUtils

public class XmlUtils
extends Object


Constructor Summary
XmlUtils()
           
 
Method Summary
static XPath newXPath()
           
static Document parse(String xml)
          Parse an xml string into document.
static Node selectNode(Node context, String xpath)
          Selects a single node using the specified XPath.
static String selectValue(Node context, String xpath)
          Selects a single value using the specified XPath.
static InputSource stringToInputSource(String xml)
           
static void traverseTreeDepthFirst(Node node, NodeProcessor processor)
          Depth first traversal preProcess() function in NodeProcessor is called before visiting children postProcess() function in NodeProcessor is called before visiting children
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlUtils

public XmlUtils()
Method Detail

newXPath

public static XPath newXPath()

parse

public static Document parse(String xml)
                      throws ParserConfigurationException,
                             SAXException,
                             IOException
Parse an xml string into document.

Throws:
ParserConfigurationException
SAXException
IOException

stringToInputSource

public static InputSource stringToInputSource(String xml)
Returns:
an InputSource based on the given string of xml

selectValue

public static String selectValue(Node context,
                                 String xpath)
                          throws XPathExpressionException
Selects a single value using the specified XPath.

Throws:
XPathExpressionException

selectNode

public static Node selectNode(Node context,
                              String xpath)
                       throws XPathExpressionException
Selects a single node using the specified XPath.

Throws:
XPathExpressionException

traverseTreeDepthFirst

public static void traverseTreeDepthFirst(Node node,
                                          NodeProcessor processor)
Depth first traversal preProcess() function in NodeProcessor is called before visiting children postProcess() function in NodeProcessor is called before visiting children

Parameters:
node - - the root of the tree for traversal
processor - - process function to called when visit the node


Copyright © 2008. All Rights Reserved.