|
|
Line 1: |
Line 1: |
| == Parsing GeoData ==
| | {{ Moved To Community }} |
| The {{class|GeoParser|kdeedu|4.2}} is a framework to parse xml files based on the {{qt|QXMLStreamReader}} class in Qt (more info [http://doc.qtsoftware.com/4.5/qtxml.html here]).
| |
| | |
| It is specialised in {{class|GeoDataParser|kdeedu|4.2}} to handle KML, GPX, GeoRSS and OSM formats and populate the data model. The parser relies on
| |
| | |
| * {{class|GeoTagHandler|kdeedu|4.2}} classes which define how a node in the file is to be processed and should populate the data model.
| |
| * A {{class|GeoStackItem|kdeedu|4.2}} class that implements the Structural parts of the XML document
| |
| * The collection class where the results of the XML parsing will be placed
| |
| * An element dictionary that prevents the need for string comparison everywere
| |
| | |
| To implement a new XML parser you need to
| |
| #compile an element dictionary of all of the available tags in the namespace
| |
| #implement a tag handler for each of these elements
| |
| #register that tag handler with the GeoParser
| |
| | |
| ==== Implementing a tag handler ====
| |
| Each tag handler is called when the relevant XML tag is reached by the GeoParser ( which knows what tags to call by its registered tag list ). Each tag can access the stack data structure of the GeoParser as well as the Collection Data Structure of the GeoParser. This allows the tag handler to access items from the stack and allows root elements of the XML to add themselves to the collection data structure.
| |
Latest revision as of 17:43, 25 October 2016