com.vividsolutions.jts.io.gml2
Class GMLHandler

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended bycom.vividsolutions.jts.io.gml2.GMLHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class GMLHandler
extends org.xml.sax.helpers.DefaultHandler

When you encounter some GML Geometry elements, you may either delegate the events to this handler. This handler ignores both namespaces and prefixes. These mappings may be included at a later date, but for the moment are left as an exercise for the reader. Hints: If your parent handler is a DefaultHandler register the parent handler to receive the errors and locator calls. Use the @see com.vividsolutions.jts.io.gml2.GeometryStrategies#findStrategy(String, String) to help check for applicability

Author:
David Zwiers, Vivid Solutions.
See Also:
DefaultHandler

Constructor Summary
GMLHandler(GeometryFactory gf, org.xml.sax.ErrorHandler delegate)
          Allows the user to specify a delegate object for error / warning messages.
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
           
 void error(org.xml.sax.SAXParseException e)
           
 void fatalError(org.xml.sax.SAXParseException e)
           
protected  org.xml.sax.Locator getDocumentLocator()
           
 Geometry getGeometry()
          This method should only be called AFTER the parser has completed execution
 void ignorableWhitespace(char[] ch, int start, int length)
           
 void setDocumentLocator(org.xml.sax.Locator locator)
           
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
           
 void warning(org.xml.sax.SAXParseException e)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GMLHandler

public GMLHandler(GeometryFactory gf,
                  org.xml.sax.ErrorHandler delegate)
Allows the user to specify a delegate object for error / warning messages. If the delegate also implements ContentHandler then the document Locator will be passed on.

Parameters:
gf - Geometry Factory
delegate - Nullable
See Also:
ErrorHandler, ContentHandler, ContentHandler.setDocumentLocator(org.xml.sax.Locator), Locator
Method Detail

getGeometry

public Geometry getGeometry()
This method should only be called AFTER the parser has completed execution

Returns:
Last Geometry Parsed, or a collection when there is morethan one geometry

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException
See Also:
DefaultHandler.characters(char[], int, int)

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException
See Also:
DefaultHandler.ignorableWhitespace(char[], int, int)

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException
See Also:
DefaultHandler.endElement(java.lang.String, java.lang.String, java.lang.String)

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException
See Also:
DefaultHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
See Also:
DefaultHandler.setDocumentLocator(org.xml.sax.Locator)

getDocumentLocator

protected org.xml.sax.Locator getDocumentLocator()

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
                throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException
See Also:
DefaultHandler.fatalError(org.xml.sax.SAXParseException)

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException
See Also:
DefaultHandler.error(org.xml.sax.SAXParseException)

warning

public void warning(org.xml.sax.SAXParseException e)
             throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException
See Also:
DefaultHandler.warning(org.xml.sax.SAXParseException)