From mradziewicz at gmail.com Wed Jan 9 05:03:13 2013 From: mradziewicz at gmail.com (Marcin Radziewicz) Date: Wed Jan 9 07:31:40 2013 Subject: [xsde-users] Segmentation during object serialization Message-ID: Hello, I tried to serialize object which dd not have all its required fields filled. It is of course not correct, but i was sure it will cause an exception to be thrown. Instead i received segmentation... This is rather unexpected. Is this a typical behavior of XSD/tree or i am doing something wrong? Best regards, Marcin Radziewicz From boris at codesynthesis.com Wed Jan 9 08:26:41 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jan 9 07:36:00 2013 Subject: [xsde-users] Segmentation during object serialization In-Reply-To: References: Message-ID: Hi Marcin, Marcin Radziewicz writes: > I tried to serialize object which dd not have all its required fields > filled. It is of course not correct, but i was sure it will cause an > exception to be thrown. Adding a test that throws an exception if a required member is not present would bloat the generated code significantly. Also, this is a programming error, not a runtime error, and some (including myself) believe exceptions are not the correct mechanism to report this. Boris From mradziewicz at gmail.com Wed Jan 9 08:24:57 2013 From: mradziewicz at gmail.com (Marcin Radziewicz) Date: Wed Jan 9 08:13:41 2013 Subject: [xsde-users] Segmentation during object serialization In-Reply-To: References: Message-ID: Hello, Thanks for your response, it explains everything. I understand that control would require a lot of additional code. Best Regards, Marcin 2013/1/9 Boris Kolpackov > Hi Marcin, > > Marcin Radziewicz writes: > > > I tried to serialize object which dd not have all its required fields > > filled. It is of course not correct, but i was sure it will cause an > > exception to be thrown. > > Adding a test that throws an exception if a required member is not > present would bloat the generated code significantly. Also, this is > a programming error, not a runtime error, and some (including myself) > believe exceptions are not the correct mechanism to report this. > > Boris > From boris at codesynthesis.com Tue Jan 15 08:07:00 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jan 15 07:15:03 2013 Subject: [xsde-users] Re: error: unable to generate the test driver without a unique document root In-Reply-To: References: Message-ID: Hi Ted, In the future, please send questions about XSD/e to the xsde-users mailing list instead of xsd-users. Ted Quan writes: > I try the following command parser/serializer. I got the following error: > > xsde cxx-serializer > --generate-inline --generate-empty-impl --generate-test-driver > --force-overwrite ElectronicReceiptSubmit.xsd > > ElectronicReceiptSubmit.xsd: error: unable to generate the test driver > without a unique document root > ElectronicReceiptSubmit.xsd: info: use --root-element-* options to specify > the document root > > [...] > > Could you shred some light? Well, it is what the error message says. The --generate-test-driver option generates a test driver that parses/serializes a document with a specific root element. If the schema has only one global element, then it is assumed to be the root element. If the schema defines multiple global elements, then all of them are valid root elements and the above error is issued. To resolve it, you can pick a root element that you want the driver to use and specify it with the --root-element options. Boris