From Nicolas.FLACHET at cstb.fr Wed Nov 22 09:59:34 2017 From: Nicolas.FLACHET at cstb.fr (FLACHET Nicolas) Date: Wed Nov 22 10:00:00 2017 Subject: [xsd-users] Message-ID: Hello xsd users, I'm trying to use xsd to generate classes for ade for cityGML and I'm bumping into a problem that I can't resolve. In cityGML, there is a lot of schemas and substituton elements, so I'll try to stay as simple as possible. My problem is with substitution group. For most of them it works find, but I found a problem with basic type (mostly integer and boolean). Here's the part sample of an xsd that failed : ... With abstract building roughly define as : ... Witch generate in the hxx file the following : typedef ::xml_schema::type _GenericApplicationPropertyOfAbstractBuilding_type; However, when I try to compile with this generated code, I've got an error : error C2440: 'initialisation' ; impossible de convert from 'initializer list' to 'xml_schema::integer' Any idea on the problem or when I should look at ? Regards, Nicolas From boris at codesynthesis.com Thu Nov 23 07:36:35 2017 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Nov 23 07:36:49 2017 Subject: [xsd-users] problem with using cityGML generated code In-Reply-To: References: Message-ID: Hi Nicolas, In the future please use a descriptive subject for your questions, as discussed in the posting guidelines: https://codesynthesis.com/support/posting-guidelines.xhtml FLACHET Nicolas writes: > However, when I try to compile with this generated code, I've got an error: > error C2440: 'initialisation' ; impossible de convert from 'initializer list' to 'xml_schema::integer' Can you show the code fragment that triggers this error? Also, there is quite a lot of information on GML and CityGML in the mailing list archives which you can search here: https://codesynthesis.com/pipermail/xsd-users/ Boris From Nicolas.FLACHET at cstb.fr Fri Nov 24 07:54:22 2017 From: Nicolas.FLACHET at cstb.fr (FLACHET Nicolas) Date: Fri Nov 24 07:54:43 2017 Subject: [xsd-users] In-Reply-To: References: Message-ID: <45546e7f4904468397a16d2b3144cc6d@Lizherel.cstb.local> I investigate a little deeper, and I found out that there is a substitution problem with xlink substitute elements (for example, ) If it's on any help, here's the options I used for xlink : --root-element-all --generate-inline --generate-default-ctor --generate-polymorphic --polymorphic-type-all --generate-forward --generate-comparison --generate-doxygen --omit-default-attributes --generate-serialization --generate-ostream --guard-prefix _ --disable-warning F001 --disable-warning F002 --std c++11 --export-symbol CITYGML_EXPORT --extern-xml-schema xs/xml-schema.xsd --hxx-prologue "#include "citygml_export.hpp"" --hxx-prologue "#include "CityGMLBaseVisitor.h"" I have the same options for gml, with 3 more : --root-element Array --root-element Bag --namespace-map http://www.opengis.net/gml=gml -----Message d'origine----- De?: xsd-users-bounces@codesynthesis.com [mailto:xsd-users-bounces@codesynthesis.com] De la part de FLACHET Nicolas Envoy??: mercredi 22 novembre 2017 16:00 ??: xsd-users@codesynthesis.com Objet?: [xsd-users] Hello xsd users, I'm trying to use xsd to generate classes for ade for cityGML and I'm bumping into a problem that I can't resolve. In cityGML, there is a lot of schemas and substituton elements, so I'll try to stay as simple as possible. My problem is with substitution group. For most of them it works find, but I found a problem with basic type (mostly integer and boolean). Here's the part sample of an xsd that failed : ... With abstract building roughly define as : ... Witch generate in the hxx file the following : typedef ::xml_schema::type _GenericApplicationPropertyOfAbstractBuilding_type; However, when I try to compile with this generated code, I've got an error : error C2440: 'initialisation' ; impossible de convert from 'initializer list' to 'xml_schema::integer' Any idea on the problem or when I should look at ? Regards, Nicolas From Nicolas.FLACHET at cstb.fr Mon Nov 27 09:39:28 2017 From: Nicolas.FLACHET at cstb.fr (FLACHET Nicolas) Date: Mon Nov 27 09:39:48 2017 Subject: [xsd-users] In-Reply-To: <45546e7f4904468397a16d2b3144cc6d@Lizherel.cstb.local> References: <45546e7f4904468397a16d2b3144cc6d@Lizherel.cstb.local> Message-ID: <81fc0b45335548889aa2a96e852d95f2@Lizherel.cstb.local> I investigate a bit further, and it seems the problem is on the new version of xsd. On the 3.3.0 version, it works, but with the same options on the "4.1.0.a11" version, it failed. I'll keep using the 3.3 version for know, and the next release version. Regards, Nicolas -----Message d'origine----- De?: FLACHET Nicolas Envoy??: vendredi 24 novembre 2017 13:54 ??: FLACHET Nicolas; xsd-users@codesynthesis.com Objet?: RE: [xsd-users] I investigate a little deeper, and I found out that there is a substitution problem with xlink substitute elements (for example, ) If it's on any help, here's the options I used for xlink : --root-element-all --generate-inline --generate-default-ctor --generate-polymorphic --polymorphic-type-all --generate-forward --generate-comparison --generate-doxygen --omit-default-attributes --generate-serialization --generate-ostream --guard-prefix _ --disable-warning F001 --disable-warning F002 --std c++11 --export-symbol CITYGML_EXPORT --extern-xml-schema xs/xml-schema.xsd --hxx-prologue "#include "citygml_export.hpp"" --hxx-prologue "#include "CityGMLBaseVisitor.h"" I have the same options for gml, with 3 more : --root-element Array --root-element Bag --namespace-map http://www.opengis.net/gml=gml -----Message d'origine----- De?: xsd-users-bounces@codesynthesis.com [mailto:xsd-users-bounces@codesynthesis.com] De la part de FLACHET Nicolas Envoy??: mercredi 22 novembre 2017 16:00 ??: xsd-users@codesynthesis.com Objet?: [xsd-users] Hello xsd users, I'm trying to use xsd to generate classes for ade for cityGML and I'm bumping into a problem that I can't resolve. In cityGML, there is a lot of schemas and substituton elements, so I'll try to stay as simple as possible. My problem is with substitution group. For most of them it works find, but I found a problem with basic type (mostly integer and boolean). Here's the part sample of an xsd that failed : ... With abstract building roughly define as : ... Witch generate in the hxx file the following : typedef ::xml_schema::type _GenericApplicationPropertyOfAbstractBuilding_type; However, when I try to compile with this generated code, I've got an error : error C2440: 'initialisation' ; impossible de convert from 'initializer list' to 'xml_schema::integer' Any idea on the problem or when I should look at ? Regards, Nicolas From Nicolas.FLACHET at cstb.fr Tue Nov 28 09:24:36 2017 From: Nicolas.FLACHET at cstb.fr (FLACHET Nicolas) Date: Tue Nov 28 09:24:47 2017 Subject: [xsd-users] Problem with substition groups Message-ID: <0a47d2a9fe2a4384842ec50585575912@Lizherel.cstb.local> Hello all, Sorry to bother you again, but I still have a problem with substitution groups and code generation. Following the discussions about generated cityGML classes with xsd (version 3.3, as I have a problem with 4.1.0.a11). I have this kind of simplified xsd schema (the element witch cause me problem is in bold): The parser works fine as a xml reader/writer, however there is no attribute generated with constructor and getter/setter for this element, so if in my code I can't do : ElementTest anElement = new ElementTest ; So my question is, is there a way to generate a class ElementTest or does it's impossible du to the xsd file definition ? Thank in advance to anyone that spend time reading this. Regards, Nicolas. From boris at codesynthesis.com Wed Nov 29 03:30:43 2017 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Nov 29 03:30:54 2017 Subject: [xsd-users] Problem with substition groups In-Reply-To: <0a47d2a9fe2a4384842ec50585575912@Lizherel.cstb.local> References: <0a47d2a9fe2a4384842ec50585575912@Lizherel.cstb.local> Message-ID: FLACHET Nicolas writes: > The parser works fine as a xml reader/writer, however there is no > attribute generated with constructor and getter/setter for this > element, so if in my code I can't do : > > ElementTest anElement = new ElementTest ; XSD does not generate classes (I assume you meant "class" not "attribute" above) for elements, only for types. So you need to use ElementTest's (potentially dynamic) type in the above code fragment. It is clear to me that you don't understand how XSD maps XML Schema constructs (types, elements) to C++ constructs (classes, functions). So I would suggest that you read carefully through the getting started guide: https://codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/ Boris From Nicolas.FLACHET at cstb.fr Thu Nov 30 05:02:09 2017 From: Nicolas.FLACHET at cstb.fr (FLACHET Nicolas) Date: Thu Nov 30 05:02:30 2017 Subject: [xsd-users] Problem with substition groups In-Reply-To: References: <0a47d2a9fe2a4384842ec50585575912@Lizherel.cstb.local> Message-ID: <290424950c734ae9bd777fbb67dac8f8@Lizherel.cstb.local> Hello Boris, Thank you, but I read and re-read the documentation and I understand that elements are not part of the generated code. However, in the generciApplicationOf substitution mecanism of cityGML, I have no choice on the xsd file. for exemple with the previous xsd samplecode : I've got a generated building with a list type of xml_schema::type for _GenericApplicationPropertyOfAbstractBuilding(). >From there, I can extract the namespace and the type of the variable Truitos, but I can only get the data by switching back to the dom element... My main problem is that I cant get do that : Truitos test = dynamic_cast( building-> GenericApplicationPropertyOfAbstractBuilding().at(0) ); (or even replace Truitos by xml_schema::integer) Regards, Nicolas -----Message d'origine----- De?: Boris Kolpackov [mailto:boris@codesynthesis.com] Envoy??: mercredi 29 novembre 2017 09:31 ??: FLACHET Nicolas Cc?: xsd-users@codesynthesis.com Objet?: Re: [xsd-users] Problem with substition groups FLACHET Nicolas writes: > The parser works fine as a xml reader/writer, however there is no > attribute generated with constructor and getter/setter for this > element, so if in my code I can't do : > > ElementTest anElement = new ElementTest ; XSD does not generate classes (I assume you meant "class" not "attribute" above) for elements, only for types. So you need to use ElementTest's (potentially dynamic) type in the above code fragment. It is clear to me that you don't understand how XSD maps XML Schema constructs (types, elements) to C++ constructs (classes, functions). So I would suggest that you read carefully through the getting started guide: https://codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/ Boris From boris at codesynthesis.com Thu Nov 30 11:42:40 2017 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Nov 30 11:42:53 2017 Subject: [xsd-users] Problem with substition groups In-Reply-To: <290424950c734ae9bd777fbb67dac8f8@Lizherel.cstb.local> References: <0a47d2a9fe2a4384842ec50585575912@Lizherel.cstb.local> <290424950c734ae9bd777fbb67dac8f8@Lizherel.cstb.local> Message-ID: FLACHET Nicolas writes: > My main problem is that I cant get do that : > > Truitos test = dynamic_cast( building->GenericApplicationPropertyOfAbstractBuilding().at(0) ); Why can't you do that? Do you get an compile/runtime error? > (or even replace Truitos by xml_schema::integer) Of course this is not going to work. Boris From Nicolas.FLACHET at cstb.fr Thu Nov 30 13:19:13 2017 From: Nicolas.FLACHET at cstb.fr (FLACHET Nicolas) Date: Thu Nov 30 13:19:23 2017 Subject: [xsd-users] Problem with substition groups In-Reply-To: References: <0a47d2a9fe2a4384842ec50585575912@Lizherel.cstb.local> <290424950c734ae9bd777fbb67dac8f8@Lizherel.cstb.local> Message-ID: > My main problem is that I cant get do that : > > Truitos test = dynamic_cast( building->GenericApplicationPropertyOfAbstractBuilding().at(0) ); > > Why can't you do that? Do you get an compile/runtime error? No, but the type "Truitos" doesn't exist in my generated classes. Also, I Think there is a problem on the substitution mecanisms for cityGML ADE. For exemple, when I have multiple with the same type (another integer in this case) , the parser choose the last one on the substitution mechanism. I'm trying to create a really simple case to let you see the problem. Regards, Nicolas