components
Class XMLWriter

java.lang.Object
  extended by components.XMLWriter

public class XMLWriter
extends Object

XMLWriter is used to take a gamespace and a file or filename, and write the gamespace information to that file. It then verfies that the information is a validate gb_level schema. It is muttable.

Our output follows this format:

... .... ... ...

Specification Fields :
filname : String //this is the file name of the output xml file

Constructor Summary
XMLWriter()
           
 
Method Summary
 void writeMap(Element parent, Map<String,String> m)
          This takes a map, and an element, and writes every key value pair in map as attributes in that element
 void writeObjects(Element parent, Set<GameObject> objs)
          Formats objs for writing to xml
 void writeXML(GameSpace g, File f)
          This overloads writeXML.
 void writeXML(GameSpace g, String name)
          Given a namespace, and a filename, will write the information g to name in XMLFormat and make sure its a valid gb_level schema.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLWriter

public XMLWriter()
Method Detail

writeXML

public void writeXML(GameSpace g,
                     File f)
              throws ParserConfigurationException,
                     SAXException,
                     IOException
This overloads writeXML. It is for convience. Takes File f, and uses its aboslute path to call writeXML(GameSpace,String);

Throws:
IOException
SAXException
ParserConfigurationException
Requires:
g and f != null

writeXML

public void writeXML(GameSpace g,
                     String name)
              throws ParserConfigurationException,
                     SAXException,
                     IOException
Given a namespace, and a filename, will write the information g to name in XMLFormat and make sure its a valid gb_level schema.

Throws:
ParserConfigurationException
SAXException
IOException
Requires:
g and name != null
Modifies:
xmlout, put not in anyway that will effect future uses of this object

writeObjects

public void writeObjects(Element parent,
                         Set<GameObject> objs)
Formats objs for writing to xml

Requires:
this.gameobjects is not null,a dn objs is not null
Modifies:
board

writeMap

public void writeMap(Element parent,
                     Map<String,String> m)
This takes a map, and an element, and writes every key value pair in map as attributes in that element

Requires:
parent and m not equal null