[xsd-users] Problem for parsing CityGML using xsd v4.1.0.a11

Miao Wang miaowang.tw at gmail.com
Thu Dec 9 02:44:45 EST 2021


Hello Boris,

Thank you for the reply.

Some information has to be corrected first:
1. The version of CityGML xsd is 2.0, downloaded from the OGC website.
2. The test gml file is downloaded from the OGC website too.
3. XSD versions for testing are 4.0.0 and 4.1.0.a11. Ver.4.0.0 generates
the working code but ver.4.1.0.a11 no.
    (The parameters for generating C++ code using XSD for both Ver.4.0 and
Ver.4.1 are the same)

The test CityGML files and the generated codes can be found from the
following link.
https://drive.google.com/file/d/1t-F3U14bLN3nQsfUGsyYksj8xwe6UM7P/view?usp=sharing

Step into the code of V4.1, the differences are found:
a. At line 532 of [feature.cxx], to create [_Feature].
b. Step into the create(), at line 274 of [type-factory-map.txx], and run
to line 304:

            if (i != element_map_.end ())
            {
              f = find_substitution (i->second, qn);
            }

here, qn.name = "Building", and the value of [f] is 0, which means the tag
"Building" can not be found?

[element_map_] has 4 elements:
Address
Appearance
FeatureCollection
Observation

But for V4.0, [element_map_] has 4 additional elements:
_CityObject
_Coverage
_FeatureCollection
_SurfaceData

so  [f] got something (substitution of "Building"?) and the code works.

Hope the information is enough to solve the problem.

BTW, XSD is amazing and wonderful, it helps my work on writing KML, DAE and
OpenDrive files.

BR
Miao

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
不含病毒。www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Boris Kolpackov <boris at codesynthesis.com> 於 2021年12月8日 週三 下午3:16寫道:

> Miao Wang <miaowang.tw at gmail.com> writes:
>
> > Using XSD 3.3.0 and following the instructions of the link, all works
> fine.
> > But when I  change to use XSD 4.1.0.a11 to generate c++ code, the
> > <bldg:Building> tag cannot be find correctly and thus got nothing in
> > <cityObjectMember>.
> > This maybe the same problem with the link:
> >
> https://www.codesynthesis.com/pipermail/xsd-users/2017-November/004946.html
>
> It does look similar but unfortunately the original reporter didn't
> try to get to the bottom of the issue.
>
> Seeing that you have both working and non-working builds available,
> can you try to step through the relevant parsing code with the debugger
> and see where things differ? My hunch is that this has something to
> do with polymorphism/substitution groups. One related thing worth
> checking is that the --generate-polymorphic and --polymorphic-type*
> options (and potentially --export-maps, if the generated code is
> split into DLLs) present and make sense.
>


More information about the xsd-users mailing list