be.saltwater.jaqel.maze.loaders
Class XMLMazeLoader

java.lang.Object
  extended bybe.saltwater.jaqel.maze.loaders.XMLMazeLoader
All Implemented Interfaces:
MazeLoader

public class XMLMazeLoader
extends java.lang.Object
implements MazeLoader

Provides support for loading a maze from an xml file. The DOM (org.w3c.dom) is used for parsing the XML file. XMLTileSetLoader is used for loading the tileset. The XML file must have the following format:

<maze name="shortname" description="longer description" tileset="relative/path/to/tileset/xml/file.xml">
        <row>
                <tile type="tiletypename"/>
        </row>
</maze>

The type attribute of the tile element must match the name attribute in the corresponding XML tileset file.

Author:
Bruno Windels
See Also:
MazeLoader, TileSetLoader, XMLTileSetLoader

Constructor Summary
XMLMazeLoader()
           
 
Method Summary
 Maze load(java.lang.String filename)
          Implementation of MazeLoader.load for this format (XML)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLMazeLoader

public XMLMazeLoader()
              throws javax.xml.parsers.ParserConfigurationException
Method Detail

load

public Maze load(java.lang.String filename)
          throws TileSetLoadException,
                 java.io.IOException,
                 java.text.ParseException
Implementation of MazeLoader.load for this format (XML)

Specified by:
load in interface MazeLoader
Parameters:
filename - The filename of the file that is to be loaded.
Throws:
java.text.ParseException - When the file has the wrong format.
TileSetLoadException - When the used TileSetLoader couldn't load the tileset completly or another problem arose when trying to load the tileset.
java.io.IOException - When some file could not be read.
See Also:
MazeLoader.load(String)