|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.vfny.geoserver.global.xml.ReaderUtils
ReaderUtils purpose.
This class is intended to be used as a library of XML relevant operation for the XMLConfigReader class.
XMLConfigReader
Method Summary | |
static java.io.File |
checkFile(java.io.File file,
boolean isDir)
Checks to ensure the file is valid. |
static java.lang.String |
getAttribute(org.w3c.dom.Element elem,
java.lang.String attName,
boolean mandatory)
getIntAttribute purpose. |
static boolean |
getBooleanAttribute(org.w3c.dom.Element elem,
java.lang.String attName,
boolean mandatory)
getBooleanAttribute purpose. |
static org.w3c.dom.Element |
getChildElement(org.w3c.dom.Element root,
java.lang.String name)
getChildElement purpose. |
static org.w3c.dom.Element |
getChildElement(org.w3c.dom.Element root,
java.lang.String name,
boolean mandatory)
getChildElement purpose. |
static java.lang.String |
getChildText(org.w3c.dom.Element root,
java.lang.String childName)
getChildText purpose. |
static java.lang.String |
getChildText(org.w3c.dom.Element root,
java.lang.String childName,
boolean mandatory)
getChildText purpose. |
static double |
getDoubleAttribute(org.w3c.dom.Element elem,
java.lang.String attName,
boolean mandatory)
getDoubleAttribute purpose. |
static java.lang.String |
getElementText(org.w3c.dom.Element elem)
getChildText purpose. |
static java.lang.String |
getElementText(org.w3c.dom.Element elem,
boolean mandatory)
getChildText purpose. |
static org.w3c.dom.Element |
getFirstChildElement(org.w3c.dom.Element root)
getFirstChildElement purpose. |
static int |
getIntAttribute(org.w3c.dom.Element elem,
java.lang.String attName,
boolean mandatory,
int defaultValue)
getIntAttribute purpose. |
static java.lang.String[] |
getKeyWords(org.w3c.dom.Element keywordsElem)
getKeyWords purpose. |
static org.w3c.dom.Element |
loadConfig(java.io.Reader configFile)
loadConfig purpose. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static org.w3c.dom.Element loadConfig(java.io.Reader configFile) throws ConfigurationException
Parses the specified file into a DOM tree.
configFile
- The file to parse int a DOM tree.
ConfigurationException
public static java.io.File checkFile(java.io.File file, boolean isDir) throws ConfigurationException
Returns the file passed in to allow this to wrap file creations.
file
- A file Handle to test.isDir
- true when the File passed in is expected to be a directory,
false when the handle is expected to be a file.
ConfigurationException
- When the file does not exist or is not
the type specified.public static org.w3c.dom.Element getChildElement(org.w3c.dom.Element root, java.lang.String name, boolean mandatory) throws ConfigurationException
Used to help with XML manipulations. Returns the first child element of the specified name. An exception occurs when the node is required and not found.
root
- The root element to look for children in.name
- The name of the child element to look for.mandatory
- true when an exception should be thrown if the child
element does not exist.
ConfigurationException
- When a child element is required and not
found.public static org.w3c.dom.Element getChildElement(org.w3c.dom.Element root, java.lang.String name)
Used to help with XML manipulations. Returns the first child element of the specified name.
root
- The root element to look for children in.name
- The name of the child element to look for.
getChildElement(Element,String,boolean)
public static int getIntAttribute(org.w3c.dom.Element elem, java.lang.String attName, boolean mandatory, int defaultValue) throws ConfigurationException
Used to help with XML manipulations. Returns the first child integer attribute of the specified name. An exception occurs when the node is required and not found.
elem
- The root element to look for children in.attName
- The name of the attribute to look for.mandatory
- true when an exception should be thrown if the
attribute element does not exist.defaultValue
- a default value to return incase the attribute was
not found. mutually exclusive with the ConfigurationException
thrown.
ConfigurationException
- When a attribute element is required and
not found.public static java.lang.String getAttribute(org.w3c.dom.Element elem, java.lang.String attName, boolean mandatory) throws ConfigurationException
Used to help with XML manipulations. Returns the first child integer attribute of the specified name. An exception occurs when the node is required and not found.
elem
- The root element to look for children in.attName
- The name of the attribute to look for.mandatory
- true when an exception should be thrown if the
attribute element does not exist.
ConfigurationException
- When a child attribute is required and
not found.public static boolean getBooleanAttribute(org.w3c.dom.Element elem, java.lang.String attName, boolean mandatory) throws ConfigurationException
Used to help with XML manipulations. Returns the first child integer attribute of the specified name. An exception occurs when the node is required and not found.
elem
- The root element to look for children in.attName
- The name of the attribute to look for.mandatory
- true when an exception should be thrown if the
attribute element does not exist.
ConfigurationException
- When a child attribute is required and
not found.public static java.lang.String getChildText(org.w3c.dom.Element root, java.lang.String childName)
Used to help with XML manipulations. Returns the first child text value of the specified element name.
root
- The root element to look for children in.childName
- The name of the attribute to look for.
public static java.lang.String getChildText(org.w3c.dom.Element root, java.lang.String childName, boolean mandatory) throws ConfigurationException
Used to help with XML manipulations. Returns the first child text value of the specified element name. An exception occurs when the node is required and not found.
root
- The root element to look for children in.childName
- The name of the attribute to look for.mandatory
- true when an exception should be thrown if the text
does not exist.
ConfigurationException
- When a child attribute is required and
not found.public static java.lang.String getElementText(org.w3c.dom.Element elem)
Used to help with XML manipulations. Returns the text value of the specified element name.
elem
- The root element to look for children in.
public static java.lang.String getElementText(org.w3c.dom.Element elem, boolean mandatory) throws ConfigurationException
Used to help with XML manipulations. Returns the text value of the specified element name. An exception occurs when the node is required and not found.
elem
- The root element to look for children in.mandatory
- true when an exception should be thrown if the text
does not exist.
ConfigurationException
- When text is required and not found.public static java.lang.String[] getKeyWords(org.w3c.dom.Element keywordsElem)
Used to help with XML manipulations. Returns a list of keywords that were found.
keywordsElem
- The root element to look for children in.
public static org.w3c.dom.Element getFirstChildElement(org.w3c.dom.Element root)
Used to help with XML manipulations. Returns the element which represents the first child.
root
- The root element to look for children in.
public static double getDoubleAttribute(org.w3c.dom.Element elem, java.lang.String attName, boolean mandatory) throws ConfigurationException
Used to help with XML manipulations. Returns the first child integer attribute of the specified name. An exception occurs when the node is required and not found.
elem
- The root element to look for children in.attName
- The name of the attribute to look for.mandatory
- true when an exception should be thrown if the
attribute element does not exist.
ConfigurationException
- When a attribute element is required and
not found.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |