nan.tools
Class XMLSerializer

java.lang.Object
  extended bynan.tools.XMLSerializer

public class XMLSerializer
extends java.lang.Object

A helper class to handle file serialization of XML Documents.

Version:
1.7, 12/31/03
Author:
John David Ratliff

Method Summary
static java.io.File getFilePath(java.lang.String directory, java.lang.String filename)
          Gets a File from a directory and filename.
static org.dom4j.Document readDocument(java.io.File file)
          Reads an XML Document from a file.
static java.lang.String readFile(java.io.File file)
          Reads a text file from the disk.
static void write(org.dom4j.Document document, java.io.File file)
          Writes an XML document to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFilePath

public static java.io.File getFilePath(java.lang.String directory,
                                       java.lang.String filename)
Gets a File from a directory and filename.

Parameters:
directory - The directory under the NaN directory.
filename - The filename of the file.
Returns:
The File with full path.

write

public static void write(org.dom4j.Document document,
                         java.io.File file)
Writes an XML document to a file.

Parameters:
document - The XML Document.
file - The file.

readFile

public static java.lang.String readFile(java.io.File file)
                                 throws java.io.IOException
Reads a text file from the disk.

Parameters:
file - The File to read.
Returns:
A String with all the files text.
Throws:
java.io.IOException - if an error occurs during reading.

readDocument

public static org.dom4j.Document readDocument(java.io.File file)
                                       throws XMLParseException
Reads an XML Document from a file.

Parameters:
file - The file.
Returns:
The XML Document.
Throws:
XMLParseException - if the file cannot be parsed.