[xsd-users] cxx-parser: run time difficulties with KML21.xsd

David White dawhite32 at gmail.com
Wed Jun 2 03:24:45 EDT 2010


Hi Boris,

> Does that mean you still cannot parse your XML documents with the
> generated sample driver implementation? If that's the case can you
> provide one such document so that I can take a look?

No, and yes.  At the bottom of this email is a sample kml file.

If I generate cxx files via:

xsd cxx-parser --force-overwrite --generate-test-driver --generate-noop-impl --generate-polymorphic --root-element kml --namespace-map http://earth.google.com/kml/2.1=kml kml21.xsd

and run the app (using the sample below), it throws at the first catch with:

error: no declaration found for element 'kml'

I understand that this error is raised when the parser does not have or know the full path to the schema.  If I add to the xml_schema::flags::dont_validate to the parse function, the app doesn't throw, but doesn't do anything either, I presume, because of a lack of polymorphic-aware code - right?  Adding the path for the schema location  doesn't seem to make a difference either.

> The sample implementations (that print the data) are actually there.
> What you need to do is connect everything using parser maps.

A simple, kml21-pimpl example would be appreciated.

> No, the parser implementations normally have application-specific
> logic. All this makes me think you have selected the wrong mapping.
> What is the reason for you to use C++/Parser? Have you considered
> C++/Tree which is much easier to use?

The reason for using cxx-parser is due to the lightening speed it offers over cxx-tree for extremely large xml files.  I understand cxx-tree offers a more simple approach to parsing xml files, but the speed at which I can parse files using cxx-parser is second to none.

Many thanks in advance.

David.




[Sample.kml]

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Style id="obi-normal">

     <IconStyle>

     <scale>0.5</scale>

     <Icon><href>http://maps.google.com/mapfiles/kml/pal4/icon17.png</href></Icon>

     </IconStyle>

</Style>

<Placemark>
     <name>Jerilderie</name>
     <description>Town of Jerilderie</description>
     <styleUrl>#obi-normal</styleUrl>

	<Point>
     <coordinates>145.72925,-35.3565,16000.0</coordinates>
     </Point>
</Placemark>
</kml>



More information about the xsd-users mailing list