From p.s.tilma at knid.nl Wed Apr 8 13:37:16 2020 From: p.s.tilma at knid.nl (p.s.tilma@knid.nl) Date: Thu Apr 9 10:17:19 2020 Subject: [xsd-users] Where to find more (complicated) examples Message-ID: <7598c98e-0e10-bf5a-cf29-aee49abe8016@knid.nl> Anjum (Netherlands), april 8th 2020, Hello, After a couple of weeks experimenting with xsd (c++/tree) I find it difficult to get data from the in memory object model. (I am not an highly experienced C++ programmer). Is there any documentation about how this works. In your documentation I only see some very simple examples. Can I find somewhere more complicated examples ? Regards from Pier Simon Tilma The Netherlands From boris at codesynthesis.com Thu Apr 9 10:20:44 2020 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Apr 9 10:30:01 2020 Subject: [xsd-users] Where to find more (complicated) examples In-Reply-To: <7598c98e-0e10-bf5a-cf29-aee49abe8016@knid.nl> References: <7598c98e-0e10-bf5a-cf29-aee49abe8016@knid.nl> Message-ID: p.s.tilma@knid.nl writes: > After a couple of weeks experimenting with xsd (c++/tree) > I find it difficult to get data from the in memory > object model. (I am not an highly experienced C++ > programmer). > > Is there any documentation about how this works. If you got the C++/Tree mapping page and scroll down a bit, you should see the Documentation section which lists all the relevant resources: https://codesynthesis.com/products/xsd/c++/tree/ The two top items on your list should be the Getting Started Guide which provides the more introductory information as well as the User Manual which covers more advanced topics. I believe that if you read through the entire Getting Started Guide you shouldn't have difficulty working with most object models. > In your documentation I only see some very > simple examples. Can I find somewhere more > complicated examples ? There is a bunch of examples in the examples/cxx/tree/ subdirectory of the XSD distribution with some of them pretty advanced. You can also browse them here: https://git.codesynthesis.com/cgit/xsd/xsd/tree/examples/cxx/tree From Renfu.Shiao at navcanada.ca Tue Apr 21 03:11:49 2020 From: Renfu.Shiao at navcanada.ca (Shiao, Renfu) Date: Tue Apr 21 06:23:17 2020 Subject: [xsd-users] Messages and its sub types in the message body Message-ID: Hi all, I have a general message definition which has a header and a body, within the body, it could be any one of the sub message types: ... (Could be a different message type ...) I used xsd cxx-tree to generated C++ data structures. I can access Message.body(), but how can I access the flight or weather object within the message body? Your help is much appreciated. Best regards, Renfu Shiao NAV Canada 280 Hunt Club Road ON K1V 1C1 613-8849170 ________________________________ This electronic message, as well as any transmitted files included in the electronic message, may contain privileged or confidential information and is intended solely for the use of the individual(s) or entity to which it is addressed. If you have received this electronic message in error please notify the sender immediately and delete the electronic message. Any unauthorized copying, disclosure or distribution of the electronic message is strictly forbidden. NAV CANADA accepts no liability for any damage caused by any virus and/or other malicious code transmitted by this electronic communication. Le pr?sent message ?lectronique et tout fichier qui peut y ?tre joint peuvent contenir des renseignements privil?gi?s ou confidentiels destin?s ? l'usage exclusif des personnes ou des organismes ? qui ils s'adressent. Si vous avez re?u ce message ?lectronique par erreur, veuillez en informer l'exp?diteur imm?diatement et supprimez le. Toute reproduction, divulgation ou distribution du pr?sent message ?lectronique est strictement interdite. NAV CANADA n'assume aucune responsabilit? en cas de dommage caus? par tout virus ou autre programme malveillant transmis par ce message ?lectronique. From boris at codesynthesis.com Tue Apr 21 09:32:24 2020 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Apr 21 09:42:31 2020 Subject: [xsd-users] Messages and its sub types in the message body In-Reply-To: References: Message-ID: Shiao, Renfu writes: > I have a general message definition which has a header and a body, within > the body, it could be any one of the sub message types: > > > > > ... (Could be a different message type ...) > > > > I can access Message.body(), but how can I access the flight or weather > object within the message body? You didn't say how this is arranged in your schema (as xs:any, polymorphism, etc). If it's done with wildcards (xs:any), see the `wildcard` example for how handle this. If it's via polymorphism, then see the `polymorphism` example. There is also an ad hoc approach that can be used with either as shown in the `messaging` example. From Renfu.Shiao at navcanada.ca Tue Apr 21 18:46:22 2020 From: Renfu.Shiao at navcanada.ca (Shiao, Renfu) Date: Thu Apr 23 08:02:06 2020 Subject: [xsd-users] Messages and its sub types in the message body In-Reply-To: References: , Message-ID: Thanks Boris! Here is another question, I took a sample XML from W3Schools, generated .xsd file from it, and feed the xsd file to "xsd cxx-tree". I have an error message of "Invalid element name 'f:table'". I must missed something:) The XSD file is as the following: Sample XML data: Best regards, Renfu Shiao ________________________________ From: Boris Kolpackov Sent: Tuesday, April 21, 2020 9:32 AM To: Shiao, Renfu Cc: xsd-users@codesynthesis.com Subject: [EXT] Re: [xsd-users] Messages and its sub types in the message body Shiao, Renfu writes: > I have a general message definition which has a header and a body, within > the body, it could be any one of the sub message types: > > > > > ... (Could be a different message type ...) > > > > I can access Message.body(), but how can I access the flight or weather > object within the message body? You didn't say how this is arranged in your schema (as xs:any, polymorphism, etc). If it's done with wildcards (xs:any), see the `wildcard` example for how handle this. If it's via polymorphism, then see the `polymorphism` example. There is also an ad hoc approach that can be used with either as shown in the `messaging` example. ________________________________ This electronic message, as well as any transmitted files included in the electronic message, may contain privileged or confidential information and is intended solely for the use of the individual(s) or entity to which it is addressed. If you have received this electronic message in error please notify the sender immediately and delete the electronic message. Any unauthorized copying, disclosure or distribution of the electronic message is strictly forbidden. NAV CANADA accepts no liability for any damage caused by any virus and/or other malicious code transmitted by this electronic communication. Le pr?sent message ?lectronique et tout fichier qui peut y ?tre joint peuvent contenir des renseignements privil?gi?s ou confidentiels destin?s ? l'usage exclusif des personnes ou des organismes ? qui ils s'adressent. Si vous avez re?u ce message ?lectronique par erreur, veuillez en informer l'exp?diteur imm?diatement et supprimez le. Toute reproduction, divulgation ou distribution du pr?sent message ?lectronique est strictement interdite. NAV CANADA n'assume aucune responsabilit? en cas de dommage caus? par tout virus ou autre programme malveillant transmis par ce message ?lectronique. From badari.hp at gmail.com Wed Apr 22 21:13:09 2020 From: badari.hp at gmail.com (Badari Prasad) Date: Thu Apr 23 08:02:06 2020 Subject: [xsd-users] Require info on using the CodeSynthesis to generate CPP code using multiple XSD files. Message-ID: Hi We have a use case to generate CPP code from multiple XSD files: XSD files can be found in link : https://www.etsi.org/deliver/etsi_ts/103200_103299/10322101/01.06.01_60/ts_10322101v010601p0.zip and this depends on XSD in link https://www.etsi.org/deliver/etsi_ts/103200_103299/103280/02.04.01_60/ts_103280v020401p0.zip I am are not sure of the proper commands to use to generate the CPP code and Driver code for cxx-tree option. Commands I used : 1) xsd cxx-tree --generate-default-ctor --namespace-map http://uri.etsi.org/03280/common/2017/07=CommonData --namespace-map http://uri.etsi.org/03221/X1/2017/10=LIX1 --location-map http://uri.etsi.org/03280/common/2017/07/TS_103_280_v020401.xsd=TS_103_280_v020401.xsd --generate-forward --generate-serialization --generate-ostream --generate-comparison --generate-polymorphic --std c++11 TS_103_280_v020401.xsd TS_103_221_01_v010601.xsd With this command XSD complains about schemaLocation TS_103_221_01_v010601.xsd: error: unable to guess which schema to open TS_103_221_01_v010601.xsd: info: did you forget to specify schemaLocation for import/include? To fix this I had to edit TS_103_221_01_v010601.xsd to add schemaLocation. 2) I did follow the steps out lined in http://wiki.codesynthesis.com/Schemas/RailML , my use case is similar to the problem in the mail thread https://www.codesynthesis.com/pipermail/xsd-users/2010-May/002807.html. xsd cxx-tree --generate-xml-schema --output-dir gen TS_103_280_v020401.xsd xsd cxx-tree --file-per-type --options-file options --output-dir gen/280 --extern-xml-schema TS_103_280_v020401.xsd xsd cxx-tree --options-file options --output-dir gen --extern-xml-schema TS_103_280_v020401.xsd TS_103_221_01_v010601.xsd Options file content : --generate-default-ctor --location-map http://uri.etsi.org/03280/common/2017/07/TS_103_280_v020401.xsd=TS_103_280_v020401.xsd --namespace-map http://uri.etsi.org/03280/common/2017/07=CommonData --namespace-map http://uri.etsi.org/03221/X1/2017/10=LIX1 --generate-forward --generate-serialization --generate-ostream --generate-comparison --generate-polymorphic --std c++11 In this procedure step 2 complains about "error: no input file specified" Kindly let me know proper procedure to generate the C++ code from these 2 XSD files. I have attached XSD files and example xml files with this mail as well. Thanks badari -------------- next part -------------- A non-text attachment was scrubbed... Name: ActivateTaskRequest_example.xml Type: text/xml Size: 990 bytes Desc: not available Url : https://codesynthesis.com/pipermail/xsd-users/attachments/20200423/8fbe01d6/ActivateTaskRequest_example-0001.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: TS_103_280_v020401.xsd Type: text/xml Size: 9431 bytes Desc: not available Url : https://codesynthesis.com/pipermail/xsd-users/attachments/20200423/8fbe01d6/TS_103_280_v020401-0001.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: TS_103_221_01_v010601.xsd Type: text/xml Size: 28409 bytes Desc: not available Url : https://codesynthesis.com/pipermail/xsd-users/attachments/20200423/8fbe01d6/TS_103_221_01_v010601-0001.bin From boris at codesynthesis.com Thu Apr 23 07:59:50 2020 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Apr 23 08:09:51 2020 Subject: [xsd-users] Messages and its sub types in the message body In-Reply-To: References: Message-ID: Shiao, Renfu writes: > Thanks Boris! Here is another question, [...] Please do not send an unrelated question by replying to an existing thread. See Posting Guidelines, specifically item #2, for details: https://codesynthesis.com/support/posting-guidelines.xhtml > I took a sample XML from W3Schools, generated .xsd file from it, and > feed the xsd file to "xsd cxx-tree". I have an error message of > "Invalid element name 'f:table'". You schema is missing a namespace mapping for the `f` prefix. Please note that this mailing list is for questions about the XSD compiler, not for general XML/Schema help (there are other places/forums for that). From boris at codesynthesis.com Thu Apr 23 08:19:11 2020 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Apr 23 08:29:11 2020 Subject: [xsd-users] Require info on using the CodeSynthesis to generate CPP code using multiple XSD files. In-Reply-To: References: Message-ID: Badari Prasad writes: > 1) xsd cxx-tree [...] TS_103_280_v020401.xsd TS_103_221_01_v010601.xsd > > With this command XSD complains about schemaLocation > > TS_103_221_01_v010601.xsd: error: unable to guess which schema to open > TS_103_221_01_v010601.xsd: info: did you forget to specify schemaLocation > for import/include? > > To fix this I had to edit TS_103_221_01_v010601.xsd to add schemaLocation. Yes, traditionally schemas include schemaLocation attributes in their imports/includes. If it's missing, then fixing the schema to include it is the only way to overcome this issue. So this is the approach I would recommend. > 2) xsd cxx-tree --file-per-type [...] I would not recommend using the file-per-type mode unless you have no other choice.