nl.itc.RIMapper
Class Utils

java.lang.Object
  extended by nl.itc.RIMapper.Utils

public class Utils
extends Object

Set of (static) utility classes for RIMapperWMS. Currently, mainl for XML file parsing and Error handling

Version:
1.0 [December 2006]
Author:
Barend Köbben - kobben@itc.nl

Field Summary
static String CAPABILITIES_MIME_TYPE
           
static String GML_MIME_TYPE
           
static String JPEG_MIME_TYPE
           
static String OGC_EXCEPTION_DOCTYPE
           
static String OGC_EXCEPTION_INIMAGE_MIME_TYPE
           
static String OGC_EXCEPTION_XML_MIME_TYPE
           
static String PLAINXML_MIME_TYPE
           
static String PNG_MIME_TYPE
           
static String RIM_NAMESPACE
           
static String SVG_MIME_TYPE
           
static String SVG_NAMESPACE
           
static String XHTML_DOCTYPE
           
static String XHTML_MIME_TYPE
           
static String XHTML_NAMESPACE
           
static String XLINK_NAMESPACE
           
static String XML_HEADER
           
static String XMLEVENTS_NAMESPACE
           
 
Constructor Summary
Utils()
           
 
Method Summary
static String getTagFromXML(Document myXML, String myTag)
          Gets the value (CDATA or Text node) of a Tag out of an XML document.
static Document getXMLtree(String XMLfile, boolean validate)
          Parses XML template file and returns the document tree.
static StringBuffer MakeError(String ErrorLocation, String ErrorMessage, String ResponseType, String ExceptionResponseType)
          Generates ErrorMessage as complete XHTML, SVG, or other file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XHTML_DOCTYPE

public static final String XHTML_DOCTYPE
See Also:
Constant Field Values

OGC_EXCEPTION_DOCTYPE

public static final String OGC_EXCEPTION_DOCTYPE
See Also:
Constant Field Values

XML_HEADER

public static final String XML_HEADER
See Also:
Constant Field Values

XHTML_NAMESPACE

public static final String XHTML_NAMESPACE
See Also:
Constant Field Values

XLINK_NAMESPACE

public static final String XLINK_NAMESPACE
See Also:
Constant Field Values

XMLEVENTS_NAMESPACE

public static final String XMLEVENTS_NAMESPACE
See Also:
Constant Field Values

SVG_NAMESPACE

public static final String SVG_NAMESPACE
See Also:
Constant Field Values

RIM_NAMESPACE

public static final String RIM_NAMESPACE
See Also:
Constant Field Values

XHTML_MIME_TYPE

public static final String XHTML_MIME_TYPE
See Also:
Constant Field Values

SVG_MIME_TYPE

public static final String SVG_MIME_TYPE
See Also:
Constant Field Values

PNG_MIME_TYPE

public static final String PNG_MIME_TYPE
See Also:
Constant Field Values

JPEG_MIME_TYPE

public static final String JPEG_MIME_TYPE
See Also:
Constant Field Values

CAPABILITIES_MIME_TYPE

public static final String CAPABILITIES_MIME_TYPE
See Also:
Constant Field Values

GML_MIME_TYPE

public static final String GML_MIME_TYPE
See Also:
Constant Field Values

OGC_EXCEPTION_XML_MIME_TYPE

public static final String OGC_EXCEPTION_XML_MIME_TYPE
See Also:
Constant Field Values

OGC_EXCEPTION_INIMAGE_MIME_TYPE

public static final String OGC_EXCEPTION_INIMAGE_MIME_TYPE
See Also:
Constant Field Values

PLAINXML_MIME_TYPE

public static final String PLAINXML_MIME_TYPE
See Also:
Constant Field Values
Constructor Detail

Utils

public Utils()
Method Detail

getXMLtree

public static Document getXMLtree(String XMLfile,
                                  boolean validate)
                           throws RIMapperException
Parses XML template file and returns the document tree.

Parameters:
XMLfile - the URL or file path
validate - sets DTD validation on/off returns the document tree
Throws:
RIMapperException

getTagFromXML

public static String getTagFromXML(Document myXML,
                                   String myTag)
                            throws RIMapperException
Gets the value (CDATA or Text node) of a Tag out of an XML document.

Parameters:
myXML - the XML Document object
myTag - the Tag whose value we want
Returns:
a String with the tag value
Throws:
RIMapperException

MakeError

public static StringBuffer MakeError(String ErrorLocation,
                                     String ErrorMessage,
                                     String ResponseType,
                                     String ExceptionResponseType)
Generates ErrorMessage as complete XHTML, SVG, or other file.

For SVG, fills screens with MonoTyped text in 25 char lines.
For X(HT)ML, lets browser do the textflow.

Parameters:
ErrorLocation - the class that the error occured in
ErrorMessage - the message to be displayed
ExceptionResponseType - the MIME type of exceptions
ResponseType - the MIME type of the WMS response:
Error output will be:
"application/vnd.ogc.se_xml" for output in OGC Error XML
"application/vnd.ogc.se_xml_inimage" for output in the ResponseType:
- if ResponseType = "image/svg+xml" => SVG output
- if ResponseType = "image/png" or if "image/jpeg" => image output
- else (eg. Capabilities XML) => HTML output
Returns:
a StringBuffer with the error output.