jitas.xml.parser
Class XMLParser

java.lang.Object
  extended by jitas.xml.parser.XMLParser
Direct Known Subclasses:
AllDomainsParser, DomainParser, ProblemParser, StudentModelParser, StudentParser

public abstract class XMLParser
extends java.lang.Object

The abstract class that provides the basic functions for users to parse the content of XML files.

Version:
04 July 2007
Author:
DeathMarch (c314g2)

Constructor Summary
XMLParser()
           
 
Method Summary
 boolean checkWeCanWriteToFile(java.lang.String pathName)
           
 boolean documentIsEmpty(org.w3c.dom.Document parsedDoc)
           
 boolean isFileEmpty(java.lang.String pathName)
           
 org.w3c.dom.Document loadXML(java.lang.String pathName)
          Load the XML file with given path name.
abstract  java.lang.Object processTree()
          Using DOM parser to parse the XML file and return the collections of needed object
 void writeToXML(org.w3c.dom.Document parsedDoc, java.lang.String pathName)
          Write the content to XML file with given document and path name If something goes wrong, and the file can't write, we don't write anything.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLParser

public XMLParser()
Method Detail

loadXML

public org.w3c.dom.Document loadXML(java.lang.String pathName)
                             throws java.io.IOException,
                                    org.xml.sax.SAXException
Load the XML file with given path name.

Parameters:
pathName -
Returns:
parsedDoc
Throws:
java.io.IOException
org.xml.sax.SAXException

processTree

public abstract java.lang.Object processTree()
                                      throws java.lang.Exception
Using DOM parser to parse the XML file and return the collections of needed object

Throws:
java.lang.Exception

documentIsEmpty

public boolean documentIsEmpty(org.w3c.dom.Document parsedDoc)

writeToXML

public void writeToXML(org.w3c.dom.Document parsedDoc,
                       java.lang.String pathName)
Write the content to XML file with given document and path name If something goes wrong, and the file can't write, we don't write anything.

Parameters:
parsedDoc -

checkWeCanWriteToFile

public boolean checkWeCanWriteToFile(java.lang.String pathName)

isFileEmpty

public boolean isFileEmpty(java.lang.String pathName)