com.strangelight.xml
Class XML_File

java.lang.Object
  |
  +--com.strangelight.xml.XML_File

public class XML_File
extends java.lang.Object

Cleaner interface to the most useful parts of javax.xml.parsers.* and org.w3c.dom.*. The XML_File object encapsulates both a DOM tree and the file from which that DOM was constructed.

Most of the time, DOM objects are constructed from XML files, and changes made to those objects are often written back to disk afterwards: but you'd never guess this fact from looking at Sun's APIs, which make these common tasks utterly tortu(r)ous.


Constructor Summary
XML_File(java.lang.String fileName)
          Constructs an XML_File object given a file name.
 
Method Summary
 void commit()
          Saves any changes made to the DOM back to the XML source file.
 void writeTo(java.io.Writer w)
          Writes the current contents of the DOM to a Writer object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XML_File

public XML_File(java.lang.String fileName)
         throws java.io.IOException,
                org.xml.sax.SAXException,
                javax.xml.parsers.ParserConfigurationException
Constructs an XML_File object given a file name.

Parameters:
fileName - The system-dependent filename.
Method Detail

writeTo

public void writeTo(java.io.Writer w)
             throws javax.xml.transform.TransformerException
Writes the current contents of the DOM to a Writer object.

javax.xml.transform.TransformerException

commit

public void commit()
            throws javax.xml.transform.TransformerException,
                   java.io.IOException
Saves any changes made to the DOM back to the XML source file.

javax.xml.transform.TransformerException
java.io.IOException