Class OsmHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.openstreetmap.osmosis.xml.v0_6.impl.OsmHandler
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler
This class is a SAX default handler for processing OSM XML files. It utilises
a tree of element processors to extract the data from the xml structure.
-
Constructor Summary
ConstructorsConstructorDescriptionOsmHandler(org.openstreetmap.osmosis.core.task.v0_6.Sink osmSink, boolean enableDateParsing) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidendElement(String uri, String localName, String qName) Ends processing of the current element.voidCalled by the SAX parser when an error occurs.voidsetDocumentLocator(Locator documentLocator) Sets the document locator which is used to report the position in the file when errors occur.voidstartElement(String uri, String localName, String qName, Attributes attributes) Begins processing of a new element.Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, 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
-
Constructor Details
-
OsmHandler
public OsmHandler(org.openstreetmap.osmosis.core.task.v0_6.Sink osmSink, boolean enableDateParsing) Creates a new instance.- Parameters:
osmSink- The new osmSink to write data to.enableDateParsing- If true, dates will be parsed from xml data, else the current date will be used thus saving parsing time.
-
-
Method Details
-
startElement
Begins processing of a new element.- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Parameters:
uri- The uri.localName- The localName.qName- The qName.attributes- The attributes.
-
endElement
Ends processing of the current element.- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Parameters:
uri- The uri.localName- The localName.qName- The qName.
-
setDocumentLocator
Sets the document locator which is used to report the position in the file when errors occur.- Specified by:
setDocumentLocatorin interfaceContentHandler- Overrides:
setDocumentLocatorin classDefaultHandler- Parameters:
documentLocator- The document locator.
-
error
Called by the SAX parser when an error occurs. Used by this class to report the current position in the file.- Specified by:
errorin interfaceErrorHandler- Overrides:
errorin classDefaultHandler- Parameters:
e- The exception that occurred.- Throws:
SAXException- if the error reporting throws an exception.
-