org.h2gis.drivers.gpx.model
Class AbstractGpxParserDefault

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.h2gis.drivers.gpx.model.AbstractGpxParser
          extended by org.h2gis.drivers.gpx.model.AbstractGpxParserDefault
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler
Direct Known Subclasses:
GpxParser

public abstract class AbstractGpxParserDefault
extends AbstractGpxParser

Main class to parse the GPX file

Author:
Erwan Bocher

Field Summary
static int STRINGSTACK_SIZE
           
 
Constructor Summary
AbstractGpxParserDefault()
           
 
Method Summary
 void clear()
          Initialisation of all the indicators used to read the document.
 void endElement(String uri, String localName, String qName)
          Fires whenever an XML end markup is encountered.
 String getCreator()
          Gives the name or URL of the software that created the GPX document.
 String getDesc()
          Gives a description of the contents of the GPX file.
 String getFullAuthor()
          Gives the name of person or organization who created the GPX file.
 String getFullLink()
          Gives URLs associated with the location described in the file.
 String getKeywords()
          Gives keywords associated with the file.
 double getMaxLat()
          Gives the maximum latitude given by element.
 double getMaxLon()
          Gives the maximum longitude given by element.
 double getMinLat()
          Gives the minimum latitude given by element.
 double getMinLon()
          Gives the minimum longitude given by element.
 String getName()
          Gives the name of the document.
 AbstractGpxParserRte getRteParser()
          Gives the parser used to parse routes.
 String getTime()
          Gives the date when this file is created.
 AbstractGpxParserTrk getTrkParser()
          Givers the parser used to parse the track
 String getVersion()
          Gives the version number of the GPX document.
 AbstractGpxParserWpt getWptParser()
          Gives the parser used to parse waypoint.
 boolean read(File inputFile, String tableName, Connection connection)
          Reads the document and parses it.
 void setAuthorLink(String authorLink)
          Set the link related to the author of the ducument.
 void setAuthorLinkText(String authorLinkText)
          Set the description of the link related to the author.
 void setAuthorName(String authorName)
          Set the name of the author of the document.
 void setEmail(String email)
          Set the email of the author of the document.
 void setLink(String link)
          Set the link related to the document.
 void setLinkText(String linkText)
          Set the description of hte document link.
 void setName(String name)
          Set the name of the document.
 void setRteParser(AbstractGpxParserRte rteParser)
          Set the parser used to parse routes.
 void setTrkParser(AbstractGpxParserTrk trkParser)
          Set the parser used to parse the track
 void setWptParser(AbstractGpxParserWpt wptParser)
          Set the parser used to parse waypoint.
 void startElement(String uri, String localName, String qName, Attributes attributes)
          Fires whenever an XML start markup is encountered.
 
Methods inherited from class org.h2gis.drivers.gpx.model.AbstractGpxParser
characters, getContentBuffer, getCurrentElement, getCurrentLine, getCurrentPoint, getCurrentSegment, getElementNames, getGeometryFactory, getReader, getRtePreparedStmt, getRteptPreparedStmt, getTrkPointsPreparedStmt, getTrkPreparedStmt, getTrkSegmentsPreparedStmt, getWptPreparedStmt, isSpecificElement, setContentBuffer, setCurrentElement, setCurrentLine, setCurrentPoint, setCurrentSegment, setElementNames, setReader, setRtePreparedStmt, setRteptPreparedStmt, setSpecificElement, setTrkPointsPreparedStmt, setTrkPreparedStmt, setTrkSegmentsPreparedStmt, setWptPreparedStmt
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STRINGSTACK_SIZE

public static final int STRINGSTACK_SIZE
See Also:
Constant Field Values
Constructor Detail

AbstractGpxParserDefault

public AbstractGpxParserDefault()
Method Detail

clear

public void clear()
Initialisation of all the indicators used to read the document.


read

public boolean read(File inputFile,
                    String tableName,
                    Connection connection)
             throws SQLException
Reads the document and parses it. The other methods are called automatically when corresponding markup is found.

Parameters:
inputFile - a File representing the gpx file to read
tableName - the table used to create all tables
connection - the connection to the database
Returns:
a boolean value if the parser ends successfully or not
Throws:
SQLException - if the creation of the tables failed

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes attributes)
                  throws SAXException
Fires whenever an XML start markup is encountered. It takes general information about the document. It change the ContentHandler to parse specific informations when , or markup are found.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Parameters:
uri - URI of the local element
localName - Name of the local element (without prefix)
qName - qName of the local element (with prefix)
attributes - Attributes of the local element (contained in the markup)
Throws:
SAXException - Any SAX exception, possibly wrapping another exception

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
Fires whenever an XML end markup is encountered. It catches attributes of the different elements and saves them in corresponding values[].

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultHandler
Parameters:
uri - URI of the local element
localName - Name of the local element (without prefix)
qName - qName of the local element (with prefix)

getTime

public String getTime()
Gives the date when this file is created.

Returns:

getVersion

public String getVersion()
Gives the version number of the GPX document.

Returns:

getCreator

public String getCreator()
Gives the name or URL of the software that created the GPX document.

Returns:

getMinLon

public double getMinLon()
Gives the minimum longitude given by element.

Returns:

getMaxLon

public double getMaxLon()
Gives the maximum longitude given by element.

Returns:

getMinLat

public double getMinLat()
Gives the minimum latitude given by element.

Returns:

getMaxLat

public double getMaxLat()
Gives the maximum latitude given by element.

Returns:

getDesc

public String getDesc()
Gives a description of the contents of the GPX file.

Returns:

getKeywords

public String getKeywords()
Gives keywords associated with the file. Search engines or databases can use this information to classify the data.

Returns:

getFullLink

public String getFullLink()
Gives URLs associated with the location described in the file.

Returns:

getFullAuthor

public String getFullAuthor()
Gives the name of person or organization who created the GPX file. Also gives an email address if exist. Also gives a link to Web site or other external information about person if exist.

Returns:

setAuthorLink

public void setAuthorLink(String authorLink)
Set the link related to the author of the ducument.

Parameters:
authorLink -

setAuthorLinkText

public void setAuthorLinkText(String authorLinkText)
Set the description of the link related to the author.

Parameters:
authorLinkText -

setAuthorName

public void setAuthorName(String authorName)
Set the name of the author of the document.

Parameters:
authorName -

setEmail

public void setEmail(String email)
Set the email of the author of the document.

Parameters:
email -

setLink

public void setLink(String link)
Set the link related to the document.

Parameters:
link -

setLinkText

public void setLinkText(String linkText)
Set the description of hte document link.

Parameters:
linkText -

getName

public String getName()
Gives the name of the document.

Returns:

setName

public void setName(String name)
Set the name of the document.

Parameters:
name -

getWptParser

public AbstractGpxParserWpt getWptParser()
Gives the parser used to parse waypoint.

Returns:

setWptParser

public void setWptParser(AbstractGpxParserWpt wptParser)
Set the parser used to parse waypoint.

Parameters:
wptParser -

setRteParser

public void setRteParser(AbstractGpxParserRte rteParser)
Set the parser used to parse routes.

Parameters:
rteParser -

getRteParser

public AbstractGpxParserRte getRteParser()
Gives the parser used to parse routes.

Returns:

setTrkParser

public void setTrkParser(AbstractGpxParserTrk trkParser)
Set the parser used to parse the track

Parameters:
trkParser -

getTrkParser

public AbstractGpxParserTrk getTrkParser()
Givers the parser used to parse the track

Returns:


Copyright © 2015 IRSTV CNRS-FR-2488. All Rights Reserved.