mavis.util
Class DocumentUtilities

java.lang.Object
  extended by mavis.util.DocumentUtilities

public class DocumentUtilities
extends java.lang.Object

Tools for reading and writing DOM documents.


Constructor Summary
DocumentUtilities()
           
 
Method Summary
static org.w3c.dom.Document loadFromXML(java.io.File file)
          Returns a DOM document represented by the XML document on the specified file.
static org.w3c.dom.Document loadFromXML(java.io.InputStream in)
          Returns a DOM document represented by the XML document on the specified input stream.
static boolean storeToXML(java.io.File file, org.w3c.dom.Document document)
          Emits an XML document representing the specified DOM document.
static boolean storeToXML(java.io.OutputStream out, org.w3c.dom.Document document)
          Emits an XML document representing the specified DOM document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentUtilities

public DocumentUtilities()
Method Detail

storeToXML

public static boolean storeToXML(java.io.File file,
                                 org.w3c.dom.Document document)
Emits an XML document representing the specified DOM document.

Parameters:
file - the file on which to emit the XML document.
document - the document to be emitted.
Returns:
true if the operation was successful, otherwise false.
Throws:
java.lang.NullPointerException - if any of the arguments is null.

storeToXML

public static boolean storeToXML(java.io.OutputStream out,
                                 org.w3c.dom.Document document)
Emits an XML document representing the specified DOM document.

Parameters:
out - the output stream on which to emit the XML document.
document - the document to be emitted.
Returns:
true if the operation was successful, otherwise false.
Throws:
java.lang.NullPointerException - if any of the arguments is null.

loadFromXML

public static org.w3c.dom.Document loadFromXML(java.io.File file)
Returns a DOM document represented by the XML document on the specified file.

Parameters:
file - the file from which to read the XML document.
Returns:
the loaded document, or null if there was an error in loading it.
Throws:
java.lang.NullPointerException - if any of the arguments is null.

loadFromXML

public static org.w3c.dom.Document loadFromXML(java.io.InputStream in)
Returns a DOM document represented by the XML document on the specified input stream.

Parameters:
in - the input stream from which to read the XML document.
Returns:
the loaded document, or null if there was an error in loading it.
Throws:
java.lang.NullPointerException - if any of the arguments is null.