public class

KMLContentHandler

extends DefaultHandler
java.lang.Object
   ↳ org.xml.sax.helpers.DefaultHandler
     ↳ com.microstrategy.web.app.maps.kml.KMLContentHandler

Summary

Fields
protected Locator locator
protected int validationErrorCount
Public Constructors
KMLContentHandler()
Default constructor which takes a "location" string (may be null) and a MessageRouter object.
Public Methods
void characters(char[] ch, int start, int length)
Callback to indicate that characters have been found.
void endDocument()
What to do when the end of document is encountered.
void endElement(String uri, String localName, String qName)
Callback to indicate the end of an XML element.
String generateErrorMessage(String message)
Formats an error message supplied by the user.
ArrayList<KMLObject> getMapObjects()
Get the array of map objects from parsed KML file
void incrementValidationErrorCount()
Increment the number of validation errors.
void resetData()
Reset the data variables to initial status.
void setDocumentLocator(Locator locator)
Callback method to record the document locator.
void setPath(Map<String, String> pathin)
void startDocument()
void startElement(String uri, String localName, String qName, Attributes attributes)
Callback invoked when a new element is encountered.
Protected Methods
void clearChars()
Resets the characters collected.
String getCharacters()
Returns the last text area that was encountered.
int getCurrentLineNumber()
Returns the current line number (if we can determine it) or -1.
void internalError(String message)
Throws an internal SAXException error formatted with the supplied error message.
void validationError(String message)
Reports a validation error.
[Expand]
Inherited Methods
From class org.xml.sax.helpers.DefaultHandler
From class java.lang.Object
From interface org.xml.sax.ContentHandler
From interface org.xml.sax.DTDHandler
From interface org.xml.sax.EntityResolver
From interface org.xml.sax.ErrorHandler

Fields

protected Locator locator

protected int validationErrorCount

Public Constructors

public KMLContentHandler ()

Default constructor which takes a "location" string (may be null) and a MessageRouter object.

Public Methods

public void characters (char[] ch, int start, int length)

Callback to indicate that characters have been found.

Parameters
ch The character array.
start The starting index of the character encountered.
length The number of characters seen in this particular callback.
Throws
SAXException If the characters encountered were unexpected or some other internal error.

public void endDocument ()

What to do when the end of document is encountered. By default, it will check whether any validation errors have occurred. If so, it throws an exception.

Throws
SAXException If validation errors have occurred.

public void endElement (String uri, String localName, String qName)

Callback to indicate the end of an XML element.

Parameters
uri The URI of the element.
localName The local name of the element.
qName The qualified name of the element.
Throws
SAXException If an unexpected element was encountered.

public String generateErrorMessage (String message)

Formats an error message supplied by the user. The error message includes file name and line number information.

Parameters
message The underlying message to display
Returns
  • A String containing the full, displayable error message.

public ArrayList<KMLObject> getMapObjects ()

Get the array of map objects from parsed KML file

Returns

public void incrementValidationErrorCount ()

Increment the number of validation errors. This is only to be used by the org.xml.sax.ErrorHandler object (which reports DTD validation errors).

public void resetData ()

Reset the data variables to initial status.

public void setDocumentLocator (Locator locator)

Callback method to record the document locator.

Parameters
locator The Locator object created by the XML Reader.

public void setPath (Map<String, String> pathin)

public void startDocument ()

Throws
SAXException

public void startElement (String uri, String localName, String qName, Attributes attributes)

Callback invoked when a new element is encountered.

Parameters
uri The URI of the element.
localName The local name of the element.
qName The qualified name of the element.
attributes The attributes associated with the element.
Throws
SAXException If an unexpected element appears in the configuration file.

Protected Methods

protected void clearChars ()

Resets the characters collected. This is normally done when a new element is started.

protected String getCharacters ()

Returns the last text area that was encountered. This includes all characters encountered between the most previous startElement and invocation of endElement.

Returns
  • The String representation of last text (character) area encountered.

protected int getCurrentLineNumber ()

Returns the current line number (if we can determine it) or -1.

Returns
  • The current line number that we are at in the input stream.

protected void internalError (String message)

Throws an internal SAXException error formatted with the supplied error message.

Parameters
message The message that contains the internal error.
Throws
SAXException This is used to get out of the current SAX parsing call.

protected void validationError (String message)

Reports a validation error. The supplied string is formatted and logged (as an error) with the associated MessageRouter.

Parameters
message The validation error message (used in a call to generateErrorMessage(String)).