[xsd-users] Some difficulties with GML/CityGML Tree
Parser generation : a bug?
Erwann HOUZAY
erwann.houzay at ign.fr
Thu Oct 22 09:36:16 EDT 2009
Data are not correcly written. I looked also inside the C++ object
through Visual debugger (very helpful..) and the object associated to
the cityObjectMemeber seems to contain nothing...
I'm doing my tests using the first dataset available on the ressource
data page of the CityGML website...
The input is looking like this
<cityObjectMember>
<grp:CityObjectGroup gml:id="g_12529">
<gml:description>Gebäude und Freifläche
Wohnen(1300)</gml:description>
<gml:name> g_12529</gml:name>
<creationDate>2009-01-11</creationDate>
<externalReference>
<informationSystem>WB3 Project</informationSystem>
<externalObject>
<uri>http://www.wb3-project.de/wb_g_id.html?db=waldbruecke&id=12529</uri>
</externalObject>
</externalReference>
<grp:groupMember>
etc....
The output
<cityObjectMember/>
Child node are not decoded ("constructors" are not even called)
I follow the Makefile and translate it to use it with Visual without any
change...
Maybe it's not enough or there's a side effect...
Thank you for your help...
Boris Kolpackov a écrit :
> Hi Erwann,
>
> Erwann HOUZAY <erwann.houzay at ign.fr> writes:
>
>
>> I've tried your solution (well I have very few knowledge about
>> codesynthesis, so I don't understand all...)
>>
>> Well, is works now but sub-element under cityObjectMember are not
>> detected...
>>
>> I've tried the sample on cityGML website (http://www.citygml.org/1539/)
>> and it doesn't work.
>>
>> cityObjectMember if exported correctly in the output file...
>>
>
> You mean that your application doesn't "see" them but they are in the
> output file, right? If that's the case then it is most likely because
> of the polymorphism. You need to figure out the actual element type
> and cast the pointer to it, for example:
>
> for(gml::AbstractFeatureCollectionType::featureMember_iterator
> itFeature=model->featureMember().begin();
> itFeature!=model->featureMember().end();
> itFeature++)
> {
> // Note the use of references!
> //
> gml::FeaturePropertyType& feature = (*itFeature);
> gml::AbstractFeatureType& af = feature._Feature().get();
>
> if (CityObjectGroupType* cog = dynamic_cast<CityObjectGroupType*> (&af))
> {
> // Handle cog.
> }
> else if (BuildingType* b = dynamic_cast<BuildingType*> (&af))
> {
> // Handle building.
> }
>
> ...
> }
>
> See Section 2.11, "Mapping for xsi:type and Substitution Groups" in the
> C++/Tree Mapping User Manual for more information:
>
> http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.11
>
> Boris
>
>
More information about the xsd-users
mailing list