| java.lang.Object org.geotools.validation.xml.ReaderUtils
ReaderUtils | class ReaderUtils (Code) | | ReaderUtils purpose.
This class is intended to be used as a library of XML relevant operation for
the XMLConfigReader class.
author: dzwiers, Refractions Research, Inc. version: $Id: ReaderUtils.java 27862 2007-11-12 19:51:19Z desruisseaux $ See Also: XMLConfigReader |
Method Summary | |
public static String | getAttribute(Element elem, String attName, boolean mandatory) getIntAttribute purpose.
Used to help with XML manipulations. | public static boolean | getBooleanAttribute(Element elem, String attName, boolean mandatory) getBooleanAttribute purpose.
Used to help with XML manipulations. | public static Element | getChildElement(Element root, String name, boolean mandatory) getChildElement purpose.
Used to help with XML manipulations. | public static Element | getChildElement(Element root, String name) getChildElement purpose.
Used to help with XML manipulations. | public static String | getChildText(Element root, String childName) getChildText purpose.
Used to help with XML manipulations. | public static String | getChildText(Element root, String childName, boolean mandatory) getChildText purpose.
Used to help with XML manipulations. | public static double | getDoubleAttribute(Element elem, String attName, boolean mandatory) getDoubleAttribute purpose.
Used to help with XML manipulations. | public static String | getElementText(Element elem) getChildText purpose.
Used to help with XML manipulations. | public static String | getElementText(Element elem, boolean mandatory) getChildText purpose.
Used to help with XML manipulations. | public static Element | getFirstChildElement(Element root) getFirstChildElement purpose.
Used to help with XML manipulations. | public static int | getIntAttribute(Element elem, String attName, boolean mandatory, int defaultValue) getIntAttribute purpose.
Used to help with XML manipulations. | public static String[] | getKeyWords(Element keywordsElem) getKeyWords purpose.
Used to help with XML manipulations. | public static File | initFile(File f, boolean isDir) initFile purpose.
Checks to ensure the file is valid. | public static Element | loadConfig(Reader configFile) loadConfig purpose.
Parses the specified file into a DOM tree.
Parameters: configFile - The file to parse int a DOM tree. |
getAttribute | public static String getAttribute(Element elem, String attName, boolean mandatory) throws SAXException(Code) | | getIntAttribute purpose.
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.
Parameters: elem - The root element to look for children in. Parameters: attName - The name of the attribute to look for. Parameters: mandatory - true when an exception should be thrown if theattribute element does not exist. The value if the attribute was found, the null otherwise. throws: SAXException - When a child attribute is required and not found. |
getBooleanAttribute | public static boolean getBooleanAttribute(Element elem, String attName, boolean mandatory) throws SAXException(Code) | | getBooleanAttribute purpose.
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.
Parameters: elem - The root element to look for children in. Parameters: attName - The name of the attribute to look for. Parameters: mandatory - true when an exception should be thrown if theattribute element does not exist. The value if the attribute was found, the false otherwise. throws: SAXException - When a child attribute is required and not found. |
getChildElement | public static Element getChildElement(Element root, String name, boolean mandatory) throws SAXException(Code) | | getChildElement purpose.
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.
Parameters: root - The root element to look for children in. Parameters: name - The name of the child element to look for. Parameters: mandatory - true when an exception should be thrown if the childelement does not exist. The child element found, null if not found. throws: SAXException - When a child element is required and not found. |
getChildElement | public static Element getChildElement(Element root, String name)(Code) | | getChildElement purpose.
Used to help with XML manipulations. Returns the first child element of
the specified name.
Parameters: root - The root element to look for children in. Parameters: name - The name of the child element to look for. The child element found, null if not found. See Also: getChildElement(Element,String,boolean) |
getChildText | public static String getChildText(Element root, String childName)(Code) | | getChildText purpose.
Used to help with XML manipulations. Returns the first child text value
of the specified element name.
Parameters: root - The root element to look for children in. Parameters: childName - The name of the attribute to look for. The value if the child was found, the null otherwise. |
getChildText | public static String getChildText(Element root, String childName, boolean mandatory) throws SAXException(Code) | | getChildText purpose.
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.
Parameters: root - The root element to look for children in. Parameters: childName - The name of the attribute to look for. Parameters: mandatory - true when an exception should be thrown if the textdoes not exist. The value if the child was found, the null otherwise. throws: SAXException - When a child attribute is required and not found. |
getDoubleAttribute | public static double getDoubleAttribute(Element elem, String attName, boolean mandatory) throws SAXException(Code) | | getDoubleAttribute purpose.
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.
Parameters: elem - The root element to look for children in. Parameters: attName - The name of the attribute to look for. Parameters: mandatory - true when an exception should be thrown if theattribute element does not exist. The double value if the attribute was found, the NaN otherwise. throws: SAXException - When a attribute element is required and not found. |
getElementText | public static String getElementText(Element elem)(Code) | | getChildText purpose.
Used to help with XML manipulations. Returns the text value of the
specified element name.
Parameters: elem - The root element to look for children in. The value if the text was found, the null otherwise. |
getElementText | public static String getElementText(Element elem, boolean mandatory) throws SAXException(Code) | | getChildText purpose.
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.
Parameters: elem - The root element to look for children in. Parameters: mandatory - true when an exception should be thrown if the textdoes not exist. The value if the text was found, the null otherwise. throws: SAXException - When text is required and not found. |
getFirstChildElement | public static Element getFirstChildElement(Element root)(Code) | | getFirstChildElement purpose.
Used to help with XML manipulations. Returns the element which
represents the first child.
Parameters: root - The root element to look for children in. The element if a child was found, the null otherwise. |
getIntAttribute | public static int getIntAttribute(Element elem, String attName, boolean mandatory, int defaultValue) throws SAXException(Code) | | getIntAttribute purpose.
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.
Parameters: elem - The root element to look for children in. Parameters: attName - The name of the attribute to look for. Parameters: mandatory - true when an exception should be thrown if theattribute element does not exist. Parameters: defaultValue - a default value to return incase the attribute wasnot found. mutually exclusive with the ConfigurationExceptionthrown. The int value if the attribute was found, the default otherwise. throws: SAXException - When a attribute element is required and not found. |
getKeyWords | public static String[] getKeyWords(Element keywordsElem)(Code) | | getKeyWords purpose.
Used to help with XML manipulations. Returns a list of keywords that
were found.
Parameters: keywordsElem - The root element to look for children in. The list of keywords that were found. |
initFile | public static File initFile(File f, boolean isDir) throws IOException(Code) | | initFile purpose.
Checks to ensure the file is valid. Returns the file passed in to allow
this to wrap file creations.
Parameters: f - A file Handle to test. Parameters: isDir - true when the File passed in is expected to be a directory,false when the handle is expected to be a file. the File handle passed in throws: IOException - When the file does not exist or is not the typespecified. |
|
|