edu.wisc.trace.urcsdk.support
Class XmlUtil

java.lang.Object
  extended by edu.wisc.trace.urcsdk.support.XmlUtil

public final class XmlUtil
extends java.lang.Object

XmlUtil contains convenience methods for parsing XML documents.

Created on: Oct 21, 2004
Known bugs: None
Thread safe: Yes

Version:
$Revision: 1.21 $
Author:
Andrew Martin, Trace R&D Center

Method Summary
static org.w3c.dom.Document parseDocument(java.net.URI uri)
          parseDocument parses an XML file located at the URI specified and returns the DOM Document resulting from the parse.
static org.w3c.dom.Document parseString(java.lang.String xmlAsString)
          parseString parses an XML file from a java.lang.String and returns a DOM Document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parseDocument

public static org.w3c.dom.Document parseDocument(java.net.URI uri)
                                          throws UrcException
parseDocument parses an XML file located at the URI specified and returns the DOM Document resulting from the parse.

Parameters:
uri - an URI value; points to the location of the XML document to be parsed.
Returns:
a Document value; a DOM Document created from parsing the XML file.
Throws:
UrcException - whenever a parse error of any kind occurs, a UrcException will be thrown.

parseString

public static org.w3c.dom.Document parseString(java.lang.String xmlAsString)
                                        throws org.xml.sax.SAXException,
                                               java.io.IOException
parseString parses an XML file from a java.lang.String and returns a DOM Document.

Parameters:
xmlAsString - a String object; the XML document as a string.
Returns:
a Document value; a DOM Document created from parsing the given string.
Throws:
org.xml.sax.SAXException - if the document is invalid.
java.io.IOException - if the document is unable to be read.


Copyright © 2006 Trace R&D Center, University of Wisconsin-Madison. All Rights Reserved.