public class GMLFilterDocument extends XMLFilterImpl
This filter separates and passes GML events to a GMLHandlerGeometry. The main simplification that it performs is to pass along coordinates as an abstracted method call, regardless of their notation in the GML (Coord vs. Coordinates). This call turns the coordinates into doubles and makes sure that it distinguishes between 2 and 3 value coordinates.
The filter also handles some more subtle processing, including handling different delimiters (decimal, coordinate, tuple) that may be used by more outlandish GML generators.
Constructor and Description |
---|
GMLFilterDocument(GMLHandlerGeometry parent)
Constructor with parent.
|
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length)
Reads the only internal characters read by pure GML parsers, which are coordinates.
|
void |
endElement(String namespaceURI,
String localName,
String qName)
Checks for GML element end and - if not a coordinates element - sends it directly on down the
chain to the appropriate parent handler.
|
void |
startElement(String namespaceURI,
String localName,
String qName,
Attributes atts)
Checks for GML element start and - if not a coordinates element - sends it directly on down
the chain to the appropriate parent handler.
|
endDocument, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, parse, parse, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
public GMLFilterDocument(GMLHandlerGeometry parent)
parent
- Parent of the filter: must implement GMLHandlerGeometry.public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
Modified by Sean Geoghegan to create new StringBuffers when entering a coord or coordinate element.
startElement
in interface ContentHandler
startElement
in class XMLFilterImpl
namespaceURI
- The namespace of the element.localName
- The local name of the element.qName
- The full name of the element, including namespace prefix.atts
- The element attributes.SAXException
- Some parsing error occurred while reading coordinates.public void characters(char[] ch, int start, int length) throws SAXException
Modified by Sean Geoghegan to append character data to buffer when inside a coordinate or coord element. SAX doesn't guarentee that all the character data of an element will be passed to the character method in one call, it may be split up into chunks.
characters
in interface ContentHandler
characters
in class XMLFilterImpl
ch
- Raw coordinate string from the GML document.start
- Beginning character position of raw coordinate string.length
- Length of the character string.SAXException
- Some parsing error occurred while reading coordinates.public void endElement(String namespaceURI, String localName, String qName) throws SAXException
Modified by Sean Geoghegan. When we reach the end of a coord or coordinate element, then the buffer is passed to the handler for processing.
endElement
in interface ContentHandler
endElement
in class XMLFilterImpl
namespaceURI
- The namespace of the element.localName
- The local name of the element.qName
- The full name of the element, including namespace prefix.SAXException
- Some parsing error occurred while reading coordinates.Copyright © 1996–2023 Geotools. All rights reserved.