xml.dom
Class MyDomParser
java.lang.Object
xml.dom.MyDomParser
public class MyDomParser
- extends java.lang.Object
DomParser class.
Parses an xml file using the Xerces parser and the DOM api.
- Author:
- Thomas Rowland
Method Summary |
static void |
main(java.lang.String[] args)
|
static void |
parse(java.lang.String uri,
java.io.OutputStream os)
Parses an xml file |
static void |
traverse(org.w3c.dom.Node elem)
Recursive method which traverses the DOM Document
and outputs the content. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MyDomParser
public MyDomParser()
parse
public static void parse(java.lang.String uri,
java.io.OutputStream os)
throws java.io.IOException,
org.xml.sax.SAXException
- Parses an xml file
- Parameters:
uri
- the location of the xml fileos
- the OutputStream to write the output to
- Throws:
java.io.IOException
- from Dom parser
org.xml.sax.SAXException
- from traversal
traverse
public static void traverse(org.w3c.dom.Node elem)
- Recursive method which traverses the DOM Document
and outputs the content.
- Parameters:
elem
- the root element to begin recursion on
main
public static void main(java.lang.String[] args)
throws java.io.IOException,
java.net.URISyntaxException,
org.xml.sax.SAXException
- Throws:
java.io.IOException
java.net.URISyntaxException
org.xml.sax.SAXException