org.h2gis.functions.io.gpx.model

## Class AbstractGpxParser

- java.lang.Object
- - org.xml.sax.helpers.DefaultHandler
  - - org.h2gis.functions.io.gpx.model.AbstractGpxParser

All Implemented Interfaces:
  ContentHandler, DTDHandler, EntityResolver, ErrorHandler

Direct Known Subclasses:
  AbstractGpxParserDefault, AbstractGpxParserRte, AbstractGpxParserTrk, AbstractGpxParserWpt

    public abstract class AbstractGpxParser
    extends DefaultHandler

Abstract class of all Gpx-Parsers. It contains the more general attributes, setters and getters used in parsers. It also defines the method characters which is used in all other parsers.

Author:
  Erwan Bocher and Antonin Piasco

### Constructor Summary

Constructors
Constructor and Description
`AbstractGpxParser()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `characters(char[] ch, int start, int length)` Fires one or more times for each text node encountered.
`StringBuilder` `getContentBuffer()` Gives the actual contentBuffer
`String` `getCurrentElement()` Gives a string representing the value of the element which is being parsed.
`GPXLine` `getCurrentLine()` Gives the line which is being parsed.
`GPXPoint` `getCurrentPoint()` Gives the point which is being parsed.
`GPXLine` `getCurrentSegment()` Gives the segment which is being parsed.
`StringStack` `getElementNames()` Gives the actual StringStack elementNames
`org.locationtech.jts.geom.GeometryFactory` `getGeometryFactory()` Gives a geometryFactory to construct gpx geometries
`XMLReader` `getReader()` Gives the XMLReader used to parse the document.
`PreparedStatement` `getRtePreparedStmt()` Gives the preparedstatement used to store route data
`PreparedStatement` `getRteptPreparedStmt()` Gives the prepared statement used to store the route points.
`PreparedStatement` `getTrkPointsPreparedStmt()` Gives the prepared statement used to store the track points.
`PreparedStatement` `getTrkPreparedStmt()` Gives the prepared statement used to store the track.
`PreparedStatement` `getTrkSegmentsPreparedStmt()` Gives the prepared statement used to store the track segments.
`PreparedStatement` `getWptPreparedStmt()` Get the PreparedStatement of the waypoints table.
`boolean` `isSpecificElement()` Indicates if we are in a specific element (waypoint, route or track).
`void` `setContentBuffer(StringBuilder contentBuffer)` Set the contentBuffer.
`void` `setCurrentElement(String currentElement)` Set the string representing the value of the element which is being parsed.
`void` `setCurrentLine(GPXLine currentLine)` Set the line which will be parsed.
`void` `setCurrentPoint(GPXPoint currentPoint)` Set the point which will be parsed.
`void` `setCurrentSegment(GPXLine currentSegment)` Set the segment which will be parsed.
`void` `setElementNames(StringStack elementNames)` Set the actual StringStack elementNames
`void` `setReader(XMLReader reader)` Set the XMLReader used to parse the document.
`void` `setRtePreparedStmt(PreparedStatement rtePreparedStmt)` Set the PreparedStatement of the route table.
`void` `setRteptPreparedStmt(PreparedStatement rteptPreparedStmt)` Set the PreparedStatement of the route points table.
`void` `setSpecificElement(boolean specificElement)` Set the indicator to know if we are in a specific element.
`void` `setTrkPointsPreparedStmt(PreparedStatement trkPointsPreparedStmt)` Set the prepared statement used to store the track points.
`void` `setTrkPreparedStmt(PreparedStatement trkPreparedStmt)` Set the prepared statement used to store the track.
`void` `setTrkSegmentsPreparedStmt(PreparedStatement trkSegmentsPreparedStmt)` Set the prepared statement used to store the track segments.
`void` `setWptPreparedStmt(PreparedStatement wptPreparedStmt)` Set the PreparedStatement of the waypoints table.

### Methods inherited from class org.xml.sax.helpers.DefaultHandler

`endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### AbstractGpxParser

    public AbstractGpxParser()

### Method Detail

#### characters

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

Fires one or more times for each text node encountered. It saves text informations in contentBuffer.

Specified by:
  `characters` in interface `ContentHandler`
Overrides:
  `characters` in class `DefaultHandler`
Parameters:
  `ch` - The characters from the XML document
  `start` - The start position in the array
  `length` - The number of characters to read from the array
Throws:
  `SAXException` - Any SAX exception, possibly wrapping another exception

#### getContentBuffer

    public StringBuilder getContentBuffer()

Gives the actual contentBuffer

Returns:

#### setContentBuffer

    public void setContentBuffer(StringBuilder contentBuffer)

Set the contentBuffer.

Parameters:
  `contentBuffer` -

#### getCurrentElement

    public String getCurrentElement()

Gives a string representing the value of the element which is being parsed.

Returns:

#### setCurrentElement

    public void setCurrentElement(String currentElement)

Set the string representing the value of the element which is being parsed.

Parameters:
  `currentElement` -

#### getCurrentPoint

    public GPXPoint getCurrentPoint()

Gives the point which is being parsed.

Returns:

#### setCurrentPoint

    public void setCurrentPoint(GPXPoint currentPoint)

Set the point which will be parsed.

Parameters:
  `currentPoint` -

#### getReader

    public XMLReader getReader()

Gives the XMLReader used to parse the document.

Returns:

#### setReader

    public void setReader(XMLReader reader)

Set the XMLReader used to parse the document.

Parameters:
  `reader` -

#### getElementNames

    public StringStack getElementNames()

Gives the actual StringStack elementNames

Returns:

#### setElementNames

    public void setElementNames(StringStack elementNames)

Set the actual StringStack elementNames

Parameters:
  `elementNames` -

#### isSpecificElement

    public boolean isSpecificElement()

Indicates if we are in a specific element (waypoint, route or track).

Returns:
  true if we are in a specific element, false else

#### setSpecificElement

    public void setSpecificElement(boolean specificElement)

Set the indicator to know if we are in a specific element.

Parameters:
  `specificElement` -

#### getWptPreparedStmt

    public PreparedStatement getWptPreparedStmt()

Get the PreparedStatement of the waypoints table.

Returns:

#### setWptPreparedStmt

    public void setWptPreparedStmt(PreparedStatement wptPreparedStmt)

Set the PreparedStatement of the waypoints table.

Parameters:
  `wptPreparedStmt` -

#### setRtePreparedStmt

    public void setRtePreparedStmt(PreparedStatement rtePreparedStmt)

Set the PreparedStatement of the route table.

Parameters:
  `rtePreparedStmt` -

#### getRtePreparedStmt

    public PreparedStatement getRtePreparedStmt()

Gives the preparedstatement used to store route data

Returns:

#### setRteptPreparedStmt

    public void setRteptPreparedStmt(PreparedStatement rteptPreparedStmt)

Set the PreparedStatement of the route points table.

Parameters:
  `rteptPreparedStmt` -

#### getRteptPreparedStmt

    public PreparedStatement getRteptPreparedStmt()

Gives the prepared statement used to store the route points.

Returns:

#### getTrkPreparedStmt

    public PreparedStatement getTrkPreparedStmt()

Gives the prepared statement used to store the track.

Returns:

#### getTrkPointsPreparedStmt

    public PreparedStatement getTrkPointsPreparedStmt()

Gives the prepared statement used to store the track points.

Returns:

#### getTrkSegmentsPreparedStmt

    public PreparedStatement getTrkSegmentsPreparedStmt()

Gives the prepared statement used to store the track segments.

Returns:

#### setTrkPreparedStmt

    public void setTrkPreparedStmt(PreparedStatement trkPreparedStmt)

Set the prepared statement used to store the track.

Parameters:
  `trkPreparedStmt` -

#### setTrkSegmentsPreparedStmt

    public void setTrkSegmentsPreparedStmt(PreparedStatement trkSegmentsPreparedStmt)

Set the prepared statement used to store the track segments.

Parameters:
  `trkSegmentsPreparedStmt` -

#### setTrkPointsPreparedStmt

    public void setTrkPointsPreparedStmt(PreparedStatement trkPointsPreparedStmt)

Set the prepared statement used to store the track points.

Parameters:
  `trkPointsPreparedStmt` -

#### getCurrentSegment

    public GPXLine getCurrentSegment()

Gives the segment which is being parsed.

Returns:

#### setCurrentSegment

    public void setCurrentSegment(GPXLine currentSegment)

Set the segment which will be parsed.

Parameters:
  `currentSegment` -

#### getGeometryFactory

    public org.locationtech.jts.geom.GeometryFactory getGeometryFactory()

Gives a geometryFactory to construct gpx geometries

Returns:

#### getCurrentLine

    public GPXLine getCurrentLine()

Gives the line which is being parsed.

Returns:

#### setCurrentLine

    public void setCurrentLine(GPXLine currentLine)

Set the line which will be parsed.

Parameters:
  `currentLine` -