From qi.gao2012 at gmail.com Tue Nov 6 03:31:56 2012 From: qi.gao2012 at gmail.com (Qi Gao) Date: Tue Nov 6 03:26:46 2012 Subject: [xsd-users] parsing multi-xsd files Message-ID: Hi Boris , I'm a newbie here and trying to parse the bpmn xsd files by xsdcxx. here is my compile cmd: xsdcxx cxx-parser --xml-parser expat --generate-polymorphic --generate-print-impl --generate-test-driver --root-element-first ../*.xsd Howerver , it seems that the test driver just print very top lines of the xml file. does it mean the test driver is not fully testable or something i did is wrong. hope you can shed some light on this. Thanks, --Qi From boris at codesynthesis.com Tue Nov 6 05:10:41 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Nov 6 04:36:57 2012 Subject: [xsd-users] parsing multi-xsd files In-Reply-To: References: Message-ID: Hi Qi, Qi Gao writes: > xsdcxx cxx-parser --xml-parser expat --generate-polymorphic > --generate-print-impl --generate-test-driver --root-element-first ../*.xsd > > Howerver, it seems that the test driver just print very top lines of the > xml file. I see you enabled support for polymorphism. The test driver and the sample implementation don't take this into account so what you most likely see is the data from the base type but not from derived. You can "improve" the sample implementation (it is a sample after all) to support polymorphism as shown in the 'polymorphism' example in the examples/cxx/parser/ directory. Boris From qi.gao2012 at gmail.com Tue Nov 6 21:56:32 2012 From: qi.gao2012 at gmail.com (Qi Gao) Date: Tue Nov 6 21:51:17 2012 Subject: [xsd-users] parsing multi-xsd files In-Reply-To: References: Message-ID: Boris, Thanks a lot , I'll try your tips. --Qi On Tue, Nov 6, 2012 at 6:10 PM, Boris Kolpackov wrote: > Hi Qi, > > Qi Gao writes: > > > xsdcxx cxx-parser --xml-parser expat --generate-polymorphic > > --generate-print-impl --generate-test-driver --root-element-first > ../*.xsd > > > > Howerver, it seems that the test driver just print very top lines of the > > xml file. > > I see you enabled support for polymorphism. The test driver and the > sample implementation don't take this into account so what you most > likely see is the data from the base type but not from derived. > > You can "improve" the sample implementation (it is a sample after all) > to support polymorphism as shown in the 'polymorphism' example in the > examples/cxx/parser/ directory. > > Boris > From Daniel.Johnston at nrc-cnrc.gc.ca Wed Nov 7 12:12:30 2012 From: Daniel.Johnston at nrc-cnrc.gc.ca (Johnston, Dan) Date: Wed Nov 7 13:35:42 2012 Subject: [xsd-users] Splitting a long schema with fails Message-ID: <9F9957734EB81F4D9E11834D98B9EA3561FED383A5@NRCCENMB1.nrc.ca> I wanted to split a long schema file into more manageable sub-sections. My platform is Win7-64, with Visual Studio 2009. This is general format of my top-level schema, and one of the included files. ++++++++++++++++++ Top Level +++++++++++++++++++++++++++++++++ <<<<<< Note the use of the 'include' ... +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++ included schema +++++++++++++++++++++++++ ... ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ The xsd.exe reads this set of file OK, and the 'sample driver' contains parser commands for all the sub-components in the 'included' schema (so it must be reading both parts). (Here is the batch file that I used to run xsd.exe) ++++++++++++++++++++++ "C:\Program Files (x86)\CodeSynthesis XSD 3.3\bin\xsd.exe" cxx-parser --prologue "// Copyright NRC" --generate-polymorphic --root-element-last --generate-print-impl --generate-test-driver --force-overwrite definitionschema.xsd ++++++++++++++++++++++ But... Code is not generated for the second file. I have a "definitionschema-pskel.hxx/cxx file, and the header has a line which includes a "parmeshschema-pskel.hxx" file (similarly for the pimpl files), but there are NO parmeshschema* files generated. Am I doing something wrong? Or, is this a bug? Thanks! Dan Johnston From boris at codesynthesis.com Thu Nov 8 09:37:48 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Nov 8 09:03:25 2012 Subject: [xsd-users] Splitting a long schema with fails In-Reply-To: <9F9957734EB81F4D9E11834D98B9EA3561FED383A5@NRCCENMB1.nrc.ca> References: <9F9957734EB81F4D9E11834D98B9EA3561FED383A5@NRCCENMB1.nrc.ca> Message-ID: Hi Dan, Johnston, Dan writes: > "C:\Program Files (x86)\CodeSynthesis XSD 3.3\bin\xsd.exe" cxx-parser > --prologue "// Copyright NRC" --generate-polymorphic --root-element-last > --generate-print-impl --generate-test-driver --force-overwrite \ > definitionschema.xsd > > Code is not generated for the second file. > I have a "definitionschema-pskel.hxx/cxx file, and the header has a > line which includes a "parmeshschema-pskel.hxx" file (similarly for > the pimpl files), but there are NO parmeshschema* files generated. You need to compile the second schema file as well (probably without --generate-test-driver). Also note that the generated test driver and the sample implementation don't take into account polymorphism. See this recent post for details: http://www.codesynthesis.com/pipermail/xsd-users/2012-November/003765.html Boris From boris at codesynthesis.com Fri Nov 9 08:52:07 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Nov 9 08:22:53 2012 Subject: [xsd-users] Splitting a long schema with fails In-Reply-To: <9F9957734EB81F4D9E11834D98B9EA3561FED383E6@NRCCENMB1.nrc.ca> References: <9F9957734EB81F4D9E11834D98B9EA3561FED383A5@NRCCENMB1.nrc.ca> <9F9957734EB81F4D9E11834D98B9EA3561FED383E6@NRCCENMB1.nrc.ca> Message-ID: Dan, In the future please keep your replies CC'ed to the xsd-users mailing list as discussed in the posting guidelines: http://www.codesynthesis.com/support/posting-guidelines.xhtml Johnston, Dan writes: > I tried xsd.exe with the root schema only > > "C:\Program Files (x86)\CodeSynthesis XSD 3.3\bin\xsd.exe" cxx-parser > --prologue "// Copyright NRC" --generate-polymorphic --root-element-last > --force-overwrite definitionschema.xsd > > It will generate code only for the elements defined in the root schema > (the header and sub-components: version, description, etc.) Right, in the file-per-schema mode each schema must be compiled separately. > I then tried with only the second (included) schema file > > "C:\Program Files (x86)\CodeSynthesis XSD 3.3\bin\xsd.exe" cxx-parser > --prologue "// Copyright NRC" --generate-polymorphic --root-element-last > --force-overwrite parmeshschema.xsd > > The error message was "base type 'DefinitionFile' was not found" Right, parmeshschema.xsd references DefinitionFile but does not include its definition. Note that including definitionschema.xsd in parmeshschema.xsd would create a circular dependency between the two. While valid in XML Schema and XSD can handle some cases (while for others you will need the file-per- type mode), this is, IMO, bad design and I wouldn't recommend it. > I then tried with both schema files on the command line > "C:\Program Files (x86)\CodeSynthesis XSD 3.3\bin\xsd.exe" cxx-parser > --prologue "// Copyright NRC" --generate-polymorphic --root-element-last > --force-overwrite definitionschema.xsd parmeshschema.xsd > > I got the same error message. Right, there is no difference. > I then tried with the option "--file-per-type". > "C:\Program Files (x86)\CodeSynthesis XSD 3.3\bin\xsd.exe" cxx-parser > --prologue "// Copyright NRC" --generate-polymorphic --root-element-last > --file-per-type --force-overwrite definitionschema.xsd > > This created skeleton header and cpp files for ALL the elements in the > root schema and in the included (parmesh, derived) schema. I just have > to deal with all those small files, but I will be using CMake to automate > this. Yes, the file-per-type mode will do what you want at the expense of all the files and compilation times. If you decide to go this route, you may find the --file-list* options useful. > B.T.W. I was generating the print implementations and sample driver > only to check against the application classes that are derived from > these skeleton classes. My application 'driver' is actually a base > class with a method that will call the document constructor with the > polymorphic third parameter set to 'true'. Calling the document constructor is only a small part of supporting polymorphism. You will also need to create parser maps, etc. See the 'polymorphism' example for details. > Any better suggestions? I would suggest that you get rid of the mutual dependency between your schemas and then use the file-per-schema mode. Boris From deepakjharodia at gmail.com Fri Nov 16 00:37:58 2012 From: deepakjharodia at gmail.com (Deepak Jharodia) Date: Fri Nov 16 05:36:26 2012 Subject: [xsd-users] Unable to parse XML file - "no declaration found for element* " Message-ID: Hello all, I'm new to XSD. I used it to generate mapping using "cxx-tree --generate-serialization" options. However, it throws "no declaration found for element *" error for each element. *My XSD file:* *My XML file:* Vandalur Zoo 12321 Lion Wild Dog Domestic White Tiger Wild *Errors:* * * zoo.xml:2:6 error: no declaration found for element 'zoo' zoo.xml:3:12 error: no declaration found for element 'zooName' zoo.xml:4:10 error: no declaration found for element 'zooId' zoo.xml:5:12 error: no declaration found for element 'animals' zoo.xml:6:13 error: no declaration found for element 'animal' zoo.xml:7:19 error: no declaration found for element 'animalName' zoo.xml:8:19 error: no declaration found for element 'animalType' zoo.xml:10:13 error: no declaration found for element 'animal' zoo.xml:11:19 error: no declaration found for element 'animalName' zoo.xml:12:19 error: no declaration found for element 'animalType' zoo.xml:14:13 error: no declaration found for element 'animal' zoo.xml:15:19 error: no declaration found for element 'animalName' zoo.xml:16:19 error: no declaration found for element 'animalType' Thanks in advance. From boris at codesynthesis.com Fri Nov 16 06:17:49 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Nov 16 05:41:02 2012 Subject: [xsd-users] Unable to parse XML file - "no declaration found for element* " In-Reply-To: References: Message-ID: Hi Deepak, Deepak Jharodia writes: > However, it throws "no declaration found for element *" error for > each element. FAQ entry 2.1: http://wiki.codesynthesis.com/Tree/FAQ Boris From deepakjharodia at gmail.com Sun Nov 18 23:29:00 2012 From: deepakjharodia at gmail.com (Deepak Jharodia) Date: Mon Nov 19 06:57:42 2012 Subject: [xsd-users] Unable to parse XML file - "no declaration found for element* " In-Reply-To: References: Message-ID: Hello Boris, Thanks a lot for prompt reply. I was able to solve the problem by adding this attributes to the root tag "zoo". xsi:noNamespaceSchemaLocation="zoo.xsd" xsi:schemaLocation="http://www.w3.org/XML/1998/namespace xml.xsd" I overlooked this part because, I was using the same XML on server side which is in Java. And it was being parsed correctly there. Regards, Deepak On Fri, Nov 16, 2012 at 4:47 PM, Boris Kolpackov wrote: > Hi Deepak, > > Deepak Jharodia writes: > > > However, it throws "no declaration found for element *" error for > > each element. > > FAQ entry 2.1: > > http://wiki.codesynthesis.com/Tree/FAQ > > Boris > From Arul.Prakash2 at rsa.com Tue Nov 27 00:40:52 2012 From: Arul.Prakash2 at rsa.com (Prakash, Arul) Date: Tue Nov 27 07:09:05 2012 Subject: [xsd-users] No c++ code generated for "anyAttribute" Message-ID: <0DB3CF5C512BBD4FA7E3A8ECD8FE7352147FF9D1D8@MX26A.corp.emc.com> Hi Boris, I am using the latest version of xsd(ie 3.3.0). I generated c++ code for my xml schemas using it.But it seems to be ignoring the "anyAttribute" But in release notes of CodeSynthesis XSD 3.0.0 it is mentioned that it ll support anyAttribute. Is this support removed in 3.3.0 ? Thanks Arul From boris at codesynthesis.com Tue Nov 27 07:52:15 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Nov 27 07:12:09 2012 Subject: [xsd-users] No c++ code generated for "anyAttribute" In-Reply-To: <0DB3CF5C512BBD4FA7E3A8ECD8FE7352147FF9D1D8@MX26A.corp.emc.com> References: <0DB3CF5C512BBD4FA7E3A8ECD8FE7352147FF9D1D8@MX26A.corp.emc.com> Message-ID: Hi Arul, Prakash, Arul writes: > I am using the latest version of xsd(ie 3.3.0). I generated c++ code > for my xml schemas using it.But it seems to be ignoring the "anyAttribute" > But in release notes of CodeSynthesis XSD 3.0.0 it is mentioned that it > ll support anyAttribute. Is this support removed in 3.3.0 ? The wildcard mapping needs to be explicitly enabled with the --generate-wildcard option. See Section 2.12, "Mapping for any and anyAttribute" in the C++/Tree Mapping User Manual for this and other requirements: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.12 Boris From Arul.Prakash2 at rsa.com Wed Nov 28 05:46:38 2012 From: Arul.Prakash2 at rsa.com (Prakash, Arul) Date: Wed Nov 28 08:12:01 2012 Subject: [xsd-users] equivalent of @XmlSeeAlso in code synthesis In-Reply-To: References: <0DB3CF5C512BBD4FA7E3A8ECD8FE7352147D70AA64@MX26A.corp.emc.com> Message-ID: <0DB3CF5C512BBD4FA7E3A8ECD8FE7352147FF9D30B@MX26A.corp.emc.com> Hi Boris, As you have mentioned I tried "dynamic_cast". But it didn't work,I also found this,it says whatever you have mentioned is not correct. http://www.cplusplus.com/doc/tutorial/typecasting/ pls check out "dynamic casting". I ll send another mail clearly explaining my scenario with an example. Thanks Arul -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Thursday, October 18, 2012 2:59 PM To: Prakash, Arul Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] equivalent of @XmlSeeAlso in code synthesis Hi Arul, Prakash, Arul writes: > Is there any equivalent for @XmlSeeAlso which is present in java files > generated by xjc in codesynthesis. No. I also don't see why we would need one. > I have a case in which I want to type cast a base class variable to > its derived class, which is possible in java due to the presence of > @XmlSeeAlso which lists the derivedclasses of the baseclass and thus > makes it known to the baseclass. It is possibly in C++ without @XmlSeeAlso: Base& b = ... Derived* d = dynamic_cast (&b); if (d != 0) { // b is Derived. } else { // b is not Derived. } Boris -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 7465 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20121128/2069f9ce/smime.bin From Arul.Prakash2 at rsa.com Wed Nov 28 09:59:45 2012 From: Arul.Prakash2 at rsa.com (Prakash, Arul) Date: Thu Nov 29 04:03:04 2012 Subject: [xsd-users] equivalent of @XmlSeeAlso in code synthesis References: <0DB3CF5C512BBD4FA7E3A8ECD8FE7352147D70AA64@MX26A.corp.emc.com> Message-ID: <0DB3CF5C512BBD4FA7E3A8ECD8FE7352147FF9D329@MX26A.corp.emc.com> Skipped content of type multipart/mixed-------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 7465 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20121128/dba9d26e/smime.bin