ix.util.xml
Class XMLLoader

java.lang.Object
  |
  +--ix.util.xml.XMLLoader
Direct Known Subclasses:
PlanLoader

public class XMLLoader
extends java.lang.Object

A utility for obtaining XML documents from files, conducting dialogs as required.


Field Summary
protected  java.awt.Component frame
           
protected  java.io.File libDir
           
protected  XMLTranslator xmlt
           
 
Constructor Summary
XMLLoader(java.awt.Component frame)
           
 
Method Summary
static java.io.File chooseFileToRead(java.awt.Component frame, java.io.File directory)
           
 XMLTranslator getXMLTranslator()
          Returns the XMLTranslator that is used by the loadObject method to convert a JDOM document to an object.
 org.jdom.Document loadDocument()
          Reads a JDOM Document from a file selected by the user, conducting all necessary dialogs along the way.
 java.lang.Object loadObject()
          Reads a JDOM Document from a file by calling the loadDocument method then converts it to an object.
 org.jdom.Document readFrom(java.io.File file)
          Converts the contents of the specified file to a JDOM Document.
 org.jdom.Document readLTF(java.io.File file)
           
 void setXMLTranslator(XMLTranslator xmlt)
          Sets the XMLTranslator that is used by the loadObject method to convert a JDOM document to an object.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

libDir

protected java.io.File libDir

xmlt

protected XMLTranslator xmlt

frame

protected java.awt.Component frame
Constructor Detail

XMLLoader

public XMLLoader(java.awt.Component frame)
Method Detail

getXMLTranslator

public XMLTranslator getXMLTranslator()
Returns the XMLTranslator that is used by the loadObject method to convert a JDOM document to an object.

setXMLTranslator

public void setXMLTranslator(XMLTranslator xmlt)
Sets the XMLTranslator that is used by the loadObject method to convert a JDOM document to an object.

loadObject

public java.lang.Object loadObject()
Reads a JDOM Document from a file by calling the loadDocument method then converts it to an object. It repeatedly askes the user to select a file until the file's contents have been successfully both read as an XML document and converted to an object, or until the user cancels.
See Also:
setXMLTranslator(XMLTranslator), loadDocument()

loadDocument

public org.jdom.Document loadDocument()
Reads a JDOM Document from a file selected by the user, conducting all necessary dialogs along the way. It repeatedly asks the user to select a file until either the Document has been successfully read or the user decides to cancel the operation. The user is informed of any exceptions thrown while attempting to read, and "success" means that no exceptions were thrown.

readFrom

public org.jdom.Document readFrom(java.io.File file)
Converts the contents of the specified file to a JDOM Document. In addition to .xml files, it is possible to read .lsp files that contain domain definitions in LTF syntax.
See Also:
LTF_Parser

readLTF

public org.jdom.Document readLTF(java.io.File file)
                          throws java.io.FileNotFoundException

chooseFileToRead

public static java.io.File chooseFileToRead(java.awt.Component frame,
                                            java.io.File directory)