com.extrememessaging.ResponseMaster
Class CXMLHelper

java.lang.Object
  extended by com.extrememessaging.ResponseMaster.CXMLHelper

public class CXMLHelper
extends java.lang.Object

A class that helps with reading configuration information from XML files


Field Summary
static int NO_DATA_DEFAULT_INTEGER
          A crazy integer to use as a default if you don't really want a default
static java.lang.String NO_DATA_DEFAULT_STRING
          A crazy string to use as a default if you don't really want a default
 
Constructor Summary
CXMLHelper()
           
 
Method Summary
static int getChildElementValue(org.w3c.dom.Element oParent, java.lang.String sChildName, int nDefault)
          Gets the value of a single child element from an Element(string)
static java.lang.String getChildElementValue(org.w3c.dom.Element oParent, java.lang.String sChildName, java.lang.String sDefault)
           
static java.lang.String getChildElementValue(org.w3c.dom.Element oParent, java.lang.String sChildName, java.lang.String sDefault, boolean bAllowEmptyString)
          Gets the value of a single child element from an Element(string)
static java.lang.String[] getChildElementValueList(org.w3c.dom.Element oParent, java.lang.String sChildName, java.lang.String sDefault)
          Gets the value of a list of child elements from an Element(string)
static int getNthChildElementValue(org.w3c.dom.Element oParent, java.lang.String sChildName, int n, int nDefault)
          Gets the value of a single child element from an Element(string)
static java.lang.String getNthChildElementValue(org.w3c.dom.Element oParent, java.lang.String sChildName, int n, java.lang.String sDefault)
          Gets the value of a single child element from an Element(string)
static org.w3c.dom.Document LoadFileIntoDOM(java.lang.String sFileName)
          Load a file into a DOM
static org.w3c.dom.Document LoadStringIntoDOM(java.lang.String sInput)
          Load a string into a DOM
static java.lang.String NodeToString(org.w3c.dom.Node node)
           
static void SaveDocumentToDisk(org.w3c.dom.Document doc, java.lang.String fileName)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_DATA_DEFAULT_STRING

public static final java.lang.String NO_DATA_DEFAULT_STRING
A crazy string to use as a default if you don't really want a default

See Also:
Constant Field Values

NO_DATA_DEFAULT_INTEGER

public static final int NO_DATA_DEFAULT_INTEGER
A crazy integer to use as a default if you don't really want a default

See Also:
Constant Field Values
Constructor Detail

CXMLHelper

public CXMLHelper()
Method Detail

getChildElementValue

public static java.lang.String getChildElementValue(org.w3c.dom.Element oParent,
                                                    java.lang.String sChildName,
                                                    java.lang.String sDefault)

getChildElementValue

public static java.lang.String getChildElementValue(org.w3c.dom.Element oParent,
                                                    java.lang.String sChildName,
                                                    java.lang.String sDefault,
                                                    boolean bAllowEmptyString)
Gets the value of a single child element from an Element(string)

Parameters:
oParent - The parent node to read from
sChildName - The name of the tag that you want the value of
sDefault - The default value to return if the value is missing
bAllowEmptyString - If false, an empty node will return sDefault rather than an empty string.

getChildElementValue

public static int getChildElementValue(org.w3c.dom.Element oParent,
                                       java.lang.String sChildName,
                                       int nDefault)
Gets the value of a single child element from an Element(string)

Parameters:
oParent - The parent node to read from
sChildName - The name of the tag that you want the value of
nDefault - The default value to return if the value is missing

getNthChildElementValue

public static java.lang.String getNthChildElementValue(org.w3c.dom.Element oParent,
                                                       java.lang.String sChildName,
                                                       int n,
                                                       java.lang.String sDefault)
Gets the value of a single child element from an Element(string)

Parameters:
oParent - The parent node to read from
sChildName - The name of the tag that you want the value of
n - The 1-based index of the child to read (eg 2 means to return the value of the second child element with that name
sDefault - The default value to return if the value is missing

getNthChildElementValue

public static int getNthChildElementValue(org.w3c.dom.Element oParent,
                                          java.lang.String sChildName,
                                          int n,
                                          int nDefault)
Gets the value of a single child element from an Element(string)

Parameters:
oParent - The parent node to read from
sChildName - The name of the tag that you want the value of
n - The 1-based index of the child to read (eg 2 means to return the value of the second child element with that name
nDefault - The default value to return if the value is missing

getChildElementValueList

public static java.lang.String[] getChildElementValueList(org.w3c.dom.Element oParent,
                                                          java.lang.String sChildName,
                                                          java.lang.String sDefault)
                                                   throws ResponseMasterException
Gets the value of a list of child elements from an Element(string)

Parameters:
oParent - The parent node to read from
sChildName - The name of the tag that you want the value of
sDefault - The default value to return if the value is missing
Throws:
ResponseMasterException

LoadFileIntoDOM

public static org.w3c.dom.Document LoadFileIntoDOM(java.lang.String sFileName)
                                            throws ResponseMasterException
Load a file into a DOM

Throws:
ResponseMasterException - is thrown if there is a problem

LoadStringIntoDOM

public static org.w3c.dom.Document LoadStringIntoDOM(java.lang.String sInput)
                                              throws ResponseMasterException
Load a string into a DOM

Throws:
ResponseMasterException - is thrown if there is a problem

SaveDocumentToDisk

public static void SaveDocumentToDisk(org.w3c.dom.Document doc,
                                      java.lang.String fileName)
                               throws ResponseMasterException
Throws:
ResponseMasterException

NodeToString

public static java.lang.String NodeToString(org.w3c.dom.Node node)
                                     throws ResponseMasterException
Throws:
ResponseMasterException