util
Class XMLFile

java.lang.Object
  |
  +--util.XMLFile
All Implemented Interfaces:
Serializable

public class XMLFile
extends Object
implements Serializable

This is a simple wrapper class around JDOM's XML package.

See Also:
Serializable, Serialized Form

Field Summary
protected  org.jdom.Document dSource
          The JDOM Document object representing the XML file.
protected  org.jdom.input.SAXBuilder sBuilder
          The utility to build a JDOM document from an XML file.
 
Constructor Summary
XMLFile()
          Creates a new XMLFile instance.
XMLFile(File fFile)
          Creates a new XMLFile instance.
XMLFile(String sFileLocation)
          Creates a new XMLFile instance.
 
Method Summary
 org.jdom.Document getDocument()
          Returns the JDOM document representing this XML file.
 org.jdom.Element getRootElement()
          Gets the root element of this XML document.
 void load(File fFile)
          Loads the contents of the given XML file into this object.
 void load(String sFileLocation)
          Loads the contents of the given XML file into this object.
 String toString()
          Returns a string representation of this.
 void write(String sFile)
          Write out the contents of this XML object to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dSource

protected org.jdom.Document dSource
The JDOM Document object representing the XML file.

sBuilder

protected org.jdom.input.SAXBuilder sBuilder
The utility to build a JDOM document from an XML file.
Constructor Detail

XMLFile

public XMLFile()
Creates a new XMLFile instance.

XMLFile

public XMLFile(File fFile)
Creates a new XMLFile instance.
Parameters:
fFile - a File value

XMLFile

public XMLFile(String sFileLocation)
Creates a new XMLFile instance.
Parameters:
sFileLocation - a String value
Method Detail

load

public void load(String sFileLocation)
Loads the contents of the given XML file into this object.
Parameters:
sFileLocation - a String value

load

public void load(File fFile)
Loads the contents of the given XML file into this object.
Parameters:
fFile - a File value

getDocument

public org.jdom.Document getDocument()
Returns the JDOM document representing this XML file.
Returns:
a Document value

toString

public String toString()
Returns a string representation of this.
Overrides:
toString in class Object
Returns:
a String value

getRootElement

public org.jdom.Element getRootElement()
Gets the root element of this XML document. Using this method, you can gain access to all the child elements.
Returns:
an Element value

write

public void write(String sFile)
Write out the contents of this XML object to a file.
Parameters:
sFile - a String value