arcade.mod.model
Class XMLModel

java.lang.Object
  extended by arcade.mod.model.XMLModel
All Implemented Interfaces:
IModel

public class XMLModel
extends java.lang.Object
implements IModel

Model created from an XML file. The ResourceNodes are created from the Elements of the DOM parsed Document.


Constructor Summary
XMLModel(java.io.File file)
          Creates a new instance of XMLModel from a given file
XMLModel(java.lang.String pathName)
          Creates a new instance of XMLModel from a filePath
 
Method Summary
 java.util.Collection<java.lang.String> getCategories()
          Returns a collection of strings which are all available categories in the XML file
 java.util.List<IResourceNode> getResourcesFromCategory(java.lang.String category)
          Return the ResourceNodes that exist as children of a category
 void writeResources(java.io.File file)
          Write resources to a specified file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLModel

public XMLModel(java.lang.String pathName)
         throws javax.xml.parsers.ParserConfigurationException,
                org.xml.sax.SAXException,
                java.io.IOException
Creates a new instance of XMLModel from a filePath

Parameters:
pathName - of the file from which to create the new XMLModel
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

XMLModel

public XMLModel(java.io.File file)
         throws javax.xml.parsers.ParserConfigurationException,
                org.xml.sax.SAXException,
                java.io.IOException
Creates a new instance of XMLModel from a given file

Parameters:
file - from which to create the new XMLModel
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException
Method Detail

getCategories

public java.util.Collection<java.lang.String> getCategories()
Returns a collection of strings which are all available categories in the XML file

Specified by:
getCategories in interface IModel
Returns:
a collection of strings which are all available categories in the XML file

getResourcesFromCategory

public java.util.List<IResourceNode> getResourcesFromCategory(java.lang.String category)
Return the ResourceNodes that exist as children of a category

Specified by:
getResourcesFromCategory in interface IModel
Parameters:
string - category which is the category from which to draw children
Returns:
List children within a specified category

writeResources

public void writeResources(java.io.File file)
Write resources to a specified file

Specified by:
writeResources in interface IModel
Parameters:
File - on which to write resources