daoc.editor
Class UIParser

java.lang.Object
  extended bydaoc.editor.UIParser

public class UIParser
extends java.lang.Object

Parses the dom tree created by a DAoC user interface xml file.


Constructor Summary
UIParser(java.lang.String rootDir, java.lang.String customDir)
           
 
Method Summary
static boolean checkFile(java.lang.String filename, boolean writable)
          Returns true if the given file exists
static java.lang.String formatXMLOutput(java.lang.String s)
          Removes unsafe XML characters
static java.lang.String getCharData(org.w3c.dom.Element e)
          Returns the character data string from an element.
static org.w3c.dom.Element getChild(org.w3c.dom.Element e, java.lang.String name)
          Returns a single child element which matches the given name.
static org.w3c.dom.Element loadElement(java.lang.String str)
          Reads an element from the given string.
static ElementNode loadNode(org.w3c.dom.Element e)
          Dynamically loads a node based on node name.
 org.w3c.dom.Element parseCustom(java.lang.String filename)
          Parses the file and creates a new tree of nodes.
 org.w3c.dom.Element parseRoot(java.lang.String rootfile)
          Parses the file and creates a new tree of nodes.
static org.w3c.dom.Element takeChild(org.w3c.dom.Element e, java.lang.String name)
          Removes and returns a single child element which matches the given name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UIParser

public UIParser(java.lang.String rootDir,
                java.lang.String customDir)
Method Detail

parseCustom

public org.w3c.dom.Element parseCustom(java.lang.String filename)
                                throws java.io.IOException,
                                       org.xml.sax.SAXException
Parses the file and creates a new tree of nodes.

Throws:
java.io.IOException
org.xml.sax.SAXException

parseRoot

public org.w3c.dom.Element parseRoot(java.lang.String rootfile)
                              throws java.io.IOException,
                                     org.xml.sax.SAXException
Parses the file and creates a new tree of nodes.

Throws:
java.io.IOException
org.xml.sax.SAXException

checkFile

public static boolean checkFile(java.lang.String filename,
                                boolean writable)
Returns true if the given file exists


loadNode

public static ElementNode loadNode(org.w3c.dom.Element e)
Dynamically loads a node based on node name.


getChild

public static org.w3c.dom.Element getChild(org.w3c.dom.Element e,
                                           java.lang.String name)
Returns a single child element which matches the given name. If no child is found, null is returned.


takeChild

public static org.w3c.dom.Element takeChild(org.w3c.dom.Element e,
                                            java.lang.String name)
Removes and returns a single child element which matches the given name. If no child is found, null is returned.


getCharData

public static java.lang.String getCharData(org.w3c.dom.Element e)
Returns the character data string from an element.


loadElement

public static org.w3c.dom.Element loadElement(java.lang.String str)
                                       throws java.io.IOException,
                                              org.xml.sax.SAXException,
                                              javax.xml.parsers.ParserConfigurationException
Reads an element from the given string.

Throws:
java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

formatXMLOutput

public static java.lang.String formatXMLOutput(java.lang.String s)
Removes unsafe XML characters