Package org.h2gis.functions.io.gpx.model
Class AbstractGpxParserDefault
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.h2gis.functions.io.gpx.model.AbstractGpxParser
org.h2gis.functions.io.gpx.model.AbstractGpxParserDefault
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler
- Direct Known Subclasses:
GpxParser
Main class to parse the GPX file
- Author:
- Erwan Bocher
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractGpxParserDefault(Connection connection, File fileName, String encoding, boolean deleteTable) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Initialisation of all the indicators used to read the document.voidendElement(String uri, String localName, String qName) Fires whenever an XML end markup is encountered.Gives the name or URL of the software that created the GPX document.getDesc()Gives a description of the contents of the GPX file.Gives the name of person or organization who created the GPX file.Gives URLs associated with the location described in the file.Gives keywords associated with the file.doubleGives the maximum latitude given by bounds element.doubleGives the maximum longitude given by bounds element.doubleGives the minimum latitude given by bounds element.doubleGives the minimum longitude given by bounds element.getName()Gives the name of the document.Gives the parser used to parse routes.getTime()Gives the date when this file is created.Givers the parser used to parse the trackGives the version number of the GPX document.Gives the parser used to parse waypoint.String[]Reads the document and parses it.The other methods are called automatically when corresponding markup is found.voidsetAuthorLink(String authorLink) Set the link related to the author of the ducument.voidsetAuthorLinkText(String authorLinkText) Set the description of the link related to the author.voidsetAuthorName(String authorName) Set the name of the author of the document.voidSet the email of the author of the document.voidSet the link related to the document.voidsetLinkText(String linkText) Set the description of hte document link.voidSet the name of the document.voidsetRteParser(AbstractGpxParserRte rteParser) Set the parser used to parse routes.voidsetTrkParser(AbstractGpxParserTrk trkParser) Set the parser used to parse the trackvoidsetWptParser(AbstractGpxParserWpt wptParser) Set the parser used to parse waypoint.voidstartElement(String uri, String localName, String qName, Attributes attributes) Fires whenever an XML start markup is encountered.Methods inherited from class org.h2gis.functions.io.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, setWptPreparedStmtMethods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
STRINGSTACK_SIZE
public static final int STRINGSTACK_SIZE- See Also:
-
-
Constructor Details
-
AbstractGpxParserDefault
public AbstractGpxParserDefault(Connection connection, File fileName, String encoding, boolean deleteTable)
-
-
Method Details
-
clear
public void clear()Initialisation of all the indicators used to read the document. -
read
public String[] read(String tableName, org.h2gis.api.ProgressVisitor progress) throws SQLException, FileNotFoundException Reads the document and parses it.The other methods are called automatically when corresponding markup is found.- Parameters:
tableName- the table used to create all tablesprogress-- Returns:
- a boolean value if the parser ends successfully or not
- Throws:
SQLException- if the creation of the tables failedFileNotFoundException
-
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 wpt, rte or trk markup are found.- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Parameters:
uri- URI of the local elementlocalName- 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
Fires whenever an XML end markup is encountered. It catches attributes of the different elements and saves them in corresponding values[].- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Parameters:
uri- URI of the local elementlocalName- Name of the local element (without prefix)qName- qName of the local element (with prefix)
-
getTime
Gives the date when this file is created.- Returns:
-
getVersion
Gives the version number of the GPX document.- Returns:
-
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 bounds element.- Returns:
-
getMaxLon
public double getMaxLon()Gives the maximum longitude given by bounds element.- Returns:
-
getMinLat
public double getMinLat()Gives the minimum latitude given by bounds element.- Returns:
-
getMaxLat
public double getMaxLat()Gives the maximum latitude given by bounds element.- Returns:
-
getDesc
Gives a description of the contents of the GPX file.- Returns:
-
getKeywords
Gives keywords associated with the file. Search engines or databases can use this information to classify the data.- Returns:
-
getFullLink
Gives URLs associated with the location described in the file.- Returns:
-
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
Set the link related to the author of the ducument.- Parameters:
authorLink-
-
setAuthorLinkText
Set the description of the link related to the author.- Parameters:
authorLinkText-
-
setAuthorName
Set the name of the author of the document.- Parameters:
authorName-
-
setEmail
Set the email of the author of the document.- Parameters:
email-
-
setLink
Set the link related to the document.- Parameters:
link-
-
setLinkText
Set the description of hte document link.- Parameters:
linkText-
-
getName
Gives the name of the document.- Returns:
-
setName
Set the name of the document.- Parameters:
name-
-
getWptParser
Gives the parser used to parse waypoint.- Returns:
-
setWptParser
Set the parser used to parse waypoint.- Parameters:
wptParser-
-
setRteParser
Set the parser used to parse routes.- Parameters:
rteParser-
-
getRteParser
Gives the parser used to parse routes.- Returns:
-
setTrkParser
Set the parser used to parse the track- Parameters:
trkParser-
-
getTrkParser
Givers the parser used to parse the track- Returns:
-