components
Class XMLReader

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by components.XMLReader
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class XMLReader
extends DefaultHandler

This class is used to read xml data and load it into a GameSpace. Given a string name this class can be used to parse the xml in that file, and load it into the gamespace. Defautl setings are used if parameters are missing. The XMLReader also supports any arbitary object property, but it will only be set if it actually used in the object being loaded.

This class has no specfields


Constructor Summary
XMLReader()
          Constructs a new XMLReader object
 
Method Summary
 GameSpace readXMLFile(String file)
          Given a valid XML file returns a GameSpace that contains everything.
 void startElement(String namespaceURI, String sName, String qName, Attributes attrs)
          Reads the title of an XMLtag and determines the appropiate objects to add to gamespace, or the appropriate settings to modify.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLReader

public XMLReader()
Constructs a new XMLReader object

Method Detail

readXMLFile

public GameSpace readXMLFile(String file)
                      throws SAXException,
                             ParserConfigurationException,
                             IOException
Given a valid XML file returns a GameSpace that contains everything.

Throws:
SAXException
ParserConfigurationException
IOException
Requires:
file is the location of a valid xml file

startElement

public void startElement(String namespaceURI,
                         String sName,
                         String qName,
                         Attributes attrs)
                  throws SAXException
Reads the title of an XMLtag and determines the appropiate objects to add to gamespace, or the appropriate settings to modify. This is based on the assumping that the filename follows the proper format, which was proved in readXML
This is an inherited method from DefaultHandler

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Throws:
SAXException