xml.dom
Class MyDomParser2

java.lang.Object
  extended by xml.dom.MyDomParser2

public class MyDomParser2
extends java.lang.Object

JAXP DomParser program. Demonstrates how to parse an xml file using the DOM api and JAXP. This program uses JAXP 1.2.

Author:
Thomas Rowland

Constructor Summary
MyDomParser2()
           
 
Method Summary
 void addItem(Item item)
          Adds a newly created Item object to the DOM Document
 Item createItem()
          Creates and returns a new Item object
 org.w3c.dom.Document parse(java.lang.String uri, java.io.OutputStream os)
          Parses an XML Document
 void toHtml(java.io.File xmlFile, java.io.File stylesheet)
          Writes a DOM Document to an OutputStream
 void toXml(java.io.OutputStream _out)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MyDomParser2

public MyDomParser2()
Method Detail

parse

public org.w3c.dom.Document parse(java.lang.String uri,
                                  java.io.OutputStream os)
                           throws java.lang.Exception
Parses an XML Document

Parameters:
uri - the uri of the xml source
os - the OutputStream to send the output to
Returns:
Document parsed by DOM
Throws:
java.lang.Exception - thrown during parse

createItem

public Item createItem()
Creates and returns a new Item object

Returns:
the new Item

addItem

public void addItem(Item item)
             throws java.lang.Exception
Adds a newly created Item object to the DOM Document

Parameters:
item - the Item object
Throws:
java.lang.Exception - during parse

toHtml

public void toHtml(java.io.File xmlFile,
                   java.io.File stylesheet)
            throws java.io.IOException
Writes a DOM Document to an OutputStream

Parameters:
xmlFile - the output file
stylesheet - the stylesheet input for xslt
Throws:
java.io.IOException - throws exceptions if parse error

toXml

public void toXml(java.io.OutputStream _out)
           throws java.lang.Exception
Throws:
java.lang.Exception