umich.cac.queryengine
Class DOMUtil

java.lang.Object
  extended byumich.cac.queryengine.DOMUtil

public class DOMUtil
extends java.lang.Object

Sample Utility class to work with DOM document


Constructor Summary
DOMUtil()
           
 
Method Summary
static int countByTagName(java.lang.String tag, org.w3c.dom.Document document)
          Count Elements in Document by Tag Name
static org.w3c.dom.Document parse(java.lang.String fileName)
          Parse the XML file and create Document
static void printDOM(org.w3c.dom.Node node)
          Prints the specified node, then prints all of its children.
static void writeXmlFile(org.w3c.dom.Document doc, java.lang.String filename)
           
static void writeXmlToFile(java.lang.String filename, org.w3c.dom.Document document)
          This method writes a DOM document to a file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMUtil

public DOMUtil()
Method Detail

writeXmlFile

public static void writeXmlFile(org.w3c.dom.Document doc,
                                java.lang.String filename)

printDOM

public static void printDOM(org.w3c.dom.Node node)
Prints the specified node, then prints all of its children.


parse

public static org.w3c.dom.Document parse(java.lang.String fileName)
Parse the XML file and create Document

Parameters:
fileName -
Returns:
Document

writeXmlToFile

public static void writeXmlToFile(java.lang.String filename,
                                  org.w3c.dom.Document document)
This method writes a DOM document to a file

Parameters:
filename -
document -

countByTagName

public static int countByTagName(java.lang.String tag,
                                 org.w3c.dom.Document document)
Count Elements in Document by Tag Name

Parameters:
tag -
document -
Returns:
number elements by Tag Name