Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## glassfrog.model
Class XMLParser

    java.lang.Object
      glassfrog.model.XMLParser

    public class XMLParser

extends java.lang.Object

Author:
  jdavidso

Field Summary
`private javax.xml.parsers.DocumentBuilder` | `builder`
`private org.w3c.dom.Document` | `doc`

Constructor Summary
`XMLParser(java.lang.String file)` Set up the XMLParser for the specified file

Method Summary
`int[]` | `getArrayFromNode(org.w3c.dom.Node node, java.lang.String tag)` Used to get the value of the content at a given node and return it as a array of ints.
`boolean` | `getBooleanFromNode(org.w3c.dom.Node node, java.lang.String tag)` Used to get the value of the content at a given node and return it as a boolean
`int` | `getIntFromNode(org.w3c.dom.Node node, java.lang.String tag)` Used to get the value of the content at a given node and return it as a int
`java.lang.String` | `getStringFromNode(org.w3c.dom.Node node, java.lang.String tag)` Used to get the value of the content at a given node and return it as a String
`org.w3c.dom.NodeList` | `parseElements(java.lang.String tag)` Used to parse out the elements in the XML matching the specified tag

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### builder

    private javax.xml.parsers.DocumentBuilder builder

### doc

    private org.w3c.dom.Document doc

Constructor Detail

### XMLParser

    public XMLParser(java.lang.String file)
              throws javax.xml.parsers.ParserConfigurationException,
                     org.xml.sax.SAXParseException,
                     org.xml.sax.SAXException,
                     java.io.IOException

  Set up the XMLParser for the specified file

  Parameters:
    `file` - A string for the file to be parsed. Must be the full path
  Throws:
    `javax.xml.parsers.ParserConfigurationException`
    `org.xml.sax.SAXParseException`
    `java.io.IOException`
    `org.xml.sax.SAXException`

Method Detail

### parseElements

    public org.w3c.dom.NodeList parseElements(java.lang.String tag)

  Used to parse out the elements in the XML matching the specified tag

  Parameters:
    `tag` - The tag representing the tag of the element to parse out
  Returns:
    A NodeList of the elements in the document matching the given tag

### getStringFromNode

    public java.lang.String getStringFromNode(org.w3c.dom.Node node,
                                              java.lang.String tag)

  Used to get the value of the content at a given node and return it as a String

  Parameters:
    `node` - A Node in the XMLDocument
    `tag` - A tag representing the tag of the element to extract the value
  Returns:
    The value of the XML Element

### getIntFromNode

    public int getIntFromNode(org.w3c.dom.Node node,
                              java.lang.String tag)

  Used to get the value of the content at a given node and return it as a int

  Parameters:
    `node` - A Node in the XMLDocument
    `tag` - A tag representing the tag of the element to extract the value
  Returns:
    The value of the XML Element

### getArrayFromNode

    public int[] getArrayFromNode(org.w3c.dom.Node node,
                                  java.lang.String tag)

  Used to get the value of the content at a given node and return it as a array of ints. The string value must be a series of ints delimited by a '|'

  Parameters:
    `node` - A Node in the XMLDocument
    `tag` - A tag representing the tag of the element to extract the value
  Returns:
    The value of the XML Element

### getBooleanFromNode

    public boolean getBooleanFromNode(org.w3c.dom.Node node,
                                      java.lang.String tag)

  Used to get the value of the content at a given node and return it as a boolean

  Parameters:
    `node` - A Node in the XMLDocument
    `tag` - A tag representing the tag of the element to extract the value
  Returns:
    The value of the XML Element

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD