[xsd-users] Help on parsing GML

Boris Kolpackov boris at codesynthesis.com
Tue Jan 22 02:12:16 EST 2008


Hi Olivier,

Olivier Tournaire <olivier.tournaire at gmail.com> writes:

> First, as I am not familiar with GML, I would like to have a small
> sample with, for example, only points. Could you help me ?

A better place to look for GML document samples would be on the GML
publisher's website:

http://www.opengeospatial.org/

They also have a forum dedicated to GML where you can ask GML-related
questions.


> Then, xsd cxx-tree generated a lot of C++ classes, and I do not know
> where to begin. What object do I have to declare in order to parse a GML
> file?

First, I strongly recommend that you read through the C++/Tree Mapping
Getting Started Guide:

http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/

This should give you an idea on how to parser and access GML documents.
Generally, you would first identify the document's root element by
looking at your sample documents (let's say it is called 'root'). Then
you would look for a declaration of this element in the schema and
determine its type (let's say it is 'type'). Based on this information
you can then write:

auto_ptr<type> r = root ("sample.xml");

Boris




More information about the xsd-users mailing list