arcade.mod.model
Class XMLNode

java.lang.Object
  extended by arcade.mod.model.XMLNode
All Implemented Interfaces:
IResourceNode

public class XMLNode
extends java.lang.Object
implements IResourceNode

Adapter to make a Node from an XML Document act as a ResourceNode. The children are the nested elements, the attributes are the attributes, the Description is the text held in the child named "Description"


Field Summary
static java.lang.String DESCRIPTION_TAG
           
 
Constructor Summary
XMLNode(org.w3c.dom.Node node)
          Creates a new XMLNode object from a node in the XMLFile
XMLNode(org.w3c.dom.Node node, java.lang.String documentpath)
          Creates a new XMLNode object including the filepath of the XML document.
 
Method Summary
 java.lang.String getAttribute(java.lang.String attributeName)
          Get a specified attribute out of the XML
 java.util.Collection<java.lang.String> getAttributes()
          Get all of the attributes of this XMLNode
 java.util.List<IResourceNode> getChildren()
          Get this XMLNode's children
 java.lang.String getDescription()
          Get description of this XMLNode
 java.lang.String getModelPath()
           
 org.w3c.dom.Node getNode()
          Get this node in tree
 void setAttribute(java.lang.String attributeName, java.lang.String value)
          Set an attribute to a value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DESCRIPTION_TAG

public static final java.lang.String DESCRIPTION_TAG
See Also:
Constant Field Values
Constructor Detail

XMLNode

public XMLNode(org.w3c.dom.Node node)
Creates a new XMLNode object from a node in the XMLFile

Parameters:
node -

XMLNode

public XMLNode(org.w3c.dom.Node node,
               java.lang.String documentpath)
Creates a new XMLNode object including the filepath of the XML document. Used for relative/absolute filepath correction.

Method Detail

getChildren

public java.util.List<IResourceNode> getChildren()
Get this XMLNode's children

Specified by:
getChildren in interface IResourceNode
Returns:
a list of this XMLNode's children

getAttributes

public java.util.Collection<java.lang.String> getAttributes()
Get all of the attributes of this XMLNode

Specified by:
getAttributes in interface IResourceNode
Returns:
all of the attributes of this XMLNode

getAttribute

public java.lang.String getAttribute(java.lang.String attributeName)
Get a specified attribute out of the XML

Specified by:
getAttribute in interface IResourceNode
Parameters:
attributeName - the name of the desired Attribute
Returns:
string attribute

setAttribute

public void setAttribute(java.lang.String attributeName,
                         java.lang.String value)
Set an attribute to a value

Specified by:
setAttribute in interface IResourceNode
Parameters:
attribute - to set
value - to set attribute to

getDescription

public java.lang.String getDescription()
Get description of this XMLNode

Specified by:
getDescription in interface IResourceNode
Returns:
description of the element node

getModelPath

public java.lang.String getModelPath()
Specified by:
getModelPath in interface IResourceNode

getNode

public org.w3c.dom.Node getNode()
Get this node in tree

Specified by:
getNode in interface IResourceNode
Returns:
node