public class GMLHandler
extends org.xml.sax.helpers.DefaultHandler
DefaultHandler
which builds Geometry
s
from GML2-formatted geometries.
An XML parser can delegate SAX events to this handler
to parse and building Geometrys.
This handler currently ignores both namespaces and prefixes. Hints:
GeometryStrategies.findStrategy(String, String)
to help check for applicability
DefaultHandler
Constructor and Description |
---|
GMLHandler(GeometryFactory gf,
org.xml.sax.ErrorHandler delegate)
Creates a new handler.
|
Modifier and Type | Method and Description |
---|---|
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()
Gets the geometry parsed by this handler.
|
void |
ignorableWhitespace(char[] ch,
int start,
int length) |
boolean |
isGeometryComplete()
Tests whether this handler has completed parsing
a geometry.
|
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) |
public GMLHandler(GeometryFactory gf, org.xml.sax.ErrorHandler delegate)
gf
- Geometry Factorydelegate
- NullableErrorHandler
,
ContentHandler
,
ContentHandler.setDocumentLocator(org.xml.sax.Locator)
,
Locator
public boolean isGeometryComplete()
getGeometry()
can be called
to get the value of the parsed geometry.public Geometry getGeometry()
java.lang.IllegalStateException
- if called before the parse is completepublic void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
DefaultHandler.characters(char[], int, int)
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ignorableWhitespace
in interface org.xml.sax.ContentHandler
ignorableWhitespace
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
DefaultHandler.ignorableWhitespace(char[], int, int)
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
DefaultHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
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
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
DefaultHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
public void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator
in interface org.xml.sax.ContentHandler
setDocumentLocator
in class org.xml.sax.helpers.DefaultHandler
DefaultHandler.setDocumentLocator(org.xml.sax.Locator)
protected org.xml.sax.Locator getDocumentLocator()
public void fatalError(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
fatalError
in interface org.xml.sax.ErrorHandler
fatalError
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
DefaultHandler.fatalError(org.xml.sax.SAXParseException)
public void error(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
error
in interface org.xml.sax.ErrorHandler
error
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
DefaultHandler.error(org.xml.sax.SAXParseException)
public void warning(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
warning
in interface org.xml.sax.ErrorHandler
warning
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
DefaultHandler.warning(org.xml.sax.SAXParseException)