java.lang.Object
org.codice.ddf.transformer.xml.streaming.AbstractSaxEventHandler
org.codice.ddf.transformer.xml.streaming.impl.GmlHandler
All Implemented Interfaces:
org.codice.ddf.transformer.xml.streaming.SaxEventHandler, ContentHandler

public class GmlHandler extends org.codice.ddf.transformer.xml.streaming.AbstractSaxEventHandler
A sax event handler to handle GML sax events and stores the data as a WKT. Delegates GML events to GMLHandler. Uses WKTWriter to write the Geometries to WKT. Note: ONLY CAN PARSE GML2 points. Will throw hard-to-debug Null Pointer Exceptions if used with GML3 or other GML2 geometries.
  • Constructor Details

    • GmlHandler

      public GmlHandler(org.locationtech.jts.io.gml2.GMLHandler gmlHandler, org.codice.ddf.transformer.xml.streaming.Gml3ToWkt gml3Converter)
  • Method Details

    • getAttributes

      public List<ddf.catalog.data.Attribute> getAttributes()
      Returns:
      list of Attribute (should be all <Metacard.GEOGRAPHY, WKT strings>)
    • getSupportedAttributeDescriptors

      public Set<ddf.catalog.data.AttributeDescriptor> getSupportedAttributeDescriptors()
    • startPrefixMapping

      public void startPrefixMapping(String prefix, String uri) throws SAXException
      Specified by:
      startPrefixMapping in interface ContentHandler
      Overrides:
      startPrefixMapping in class org.codice.ddf.transformer.xml.streaming.AbstractSaxEventHandler
      Throws:
      SAXException
    • startElement

      public void startElement(String uri, String localName, String qName, Attributes attributes)
      Takes in a sax event from SaxEventHandlerDelegate, and if it is a gml:Point or a sub-element of a gml:Point, it will hand the event off to the GML handler for further parsing.
      Parameters:
      uri - the URI that is passed in by SaxEventHandlerDelegate
      localName - the localName that is passed in by SaxEventHandlerDelegate
      qName - the qName that is passed in by SaxEventHandlerDelegate
      attributes - the attributes that are passed in by SaxEventHandlerDelegate
    • endElement

      public void endElement(String namespaceURI, String localName, String qName)
      Takes in a sax event from SaxEventHandlerDelegate, and if it is a gml:Point or a sub-element of a gml:Point, it will * hand the event off to the GML handler for further parsing. If it is a gml:Point, the point is stored as a WKT in the attributes list
      Parameters:
      namespaceURI - the namespaceURI that is passed in by SaxEventHandlerDelegate
      localName - the localName that is passed in by SaxEventHandlerDelegate
      qName - the qName that is passed in by SaxEventHandlerDelegate
    • characters

      public void characters(char[] ch, int start, int length)
      Takes in a sax event from SaxEventHandlerDelegate, and if it is a gml:Point or a sub-element of a gml:Point, it will * hand the event off to the GML handler for further parsing.
      Parameters:
      ch - the ch that is passed in by SaxEventHandlerDelegate
      start - the start that is passed in by SaxEventHandlerDelegate
      length - the length that is passed in by SaxEventHandlerDelegate