From boris at codesynthesis.com Tue May 3 05:20:27 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue May 3 05:01:56 2011 Subject: [xsde-users] See you at BoostCon 2011 Message-ID: Hi, Just a quick note to let you know I am giving two talks at this year's BoostCon[1] conference. The first is titled "Parsing C++ with GCC plugins". It is about the new GCC plugin architecture and how it can be used for parsing C++. The second talk is titled "Object-Relational Mapping with ODB and Boost". It covers the ODB[2] object-relational mapping (ORM) system for C++ and its integration with Boost. If any of you are attending the conference, please say Hi! [1] http://boostcon.boost.org/ [2] http://www.codesynthesis.com/products/odb/ Boris From Sebastian.Friebe at xfab.com Wed May 4 10:47:58 2011 From: Sebastian.Friebe at xfab.com (Sebastian Friebe) Date: Wed May 4 10:48:14 2011 Subject: [xsde-users] "invalid ID value" error Message-ID: <0LKO0040CEG4FM00@mail.drs.xfab.de> Hi all, While serializing my in-memory objects to XML, I always get the 'invalid ID value' error. Can anyone give me a hint what's behind that error? Is it a wrong type or a duplicate ID or something else? The XSDe compiler applied the standard string type to the attribute which got the ID-type in my schema. So I just pass a string value to it. Best regards and thanks in advance. Sebastian From Sebastian.Friebe at xfab.com Thu May 5 02:22:03 2011 From: Sebastian.Friebe at xfab.com (Sebastian Friebe) Date: Thu May 5 02:22:18 2011 Subject: AW: [xsde-users] "invalid ID value" error In-Reply-To: <0LKO0040CEG4FM00@mail.drs.xfab.de> Message-ID: <0LKP004A8LOVFM40@mail.drs.xfab.de> Hi all ... > While serializing my in-memory objects to XML, I always get the 'invalid > ID value' error. In the meantime I found the issue. It was related to a wrong parameter type while setting the attribute value. Cheers Sebastian From boris at codesynthesis.com Mon May 9 09:08:53 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon May 9 06:52:47 2011 Subject: [xsde-users] Overriding validation of empty elements In-Reply-To: References: <20110307131332.GA12368@onega.codesynthesis.com> Message-ID: Hi Klaus, [I've CC'ed the xsde-users mailing list in case someone else will have a similar question in the future.] Cinibulk, Klaus writes: > Consider the following simple schema definition (part of a sequence): > > > > some documentation > > > > Due to some weird project requirements it would be desireable to allow > the following XML fragment with schema validation turned ON: > > > > > > Currently the parser throws an exception because is empty, > which is perfectly correct according to the schema definition. Is it > possible to tell the code generator / runtime library to allow such > empty tags for integers or floats? There is no easy way to achieve this. The best approach would probably be to customize the integer (and float) parsers to detect empty content and return some special values (e.g., 0, -1, or MAX_INT) in this case. If you would like to go this route, then you will need to inherit from the xml_schema::integer_pimpl class (see libxsde/xsde/cxx/parser/validating/integer.hxx) and override all its callback functions. Here is how their new implementations might look: struct custom_integer_pimpl: xml_schema::integer_pimpl { virtual void _pre () { v_.clear (); integer_pimpl::_pre (); } virtual void _characters (const ro_string& s) { v_.append (s.value (), s.size ()); } virtual void _post () { if (!v_.empty ()) { integer_pimpl::_characters (v_); integer_pimpl::_post (); } } virtual long post_integer () { if (!v_.empty ()) return integer_pimpl::post_integer (); else return 0; // Return special value. } private: std::string v_; }; Then you will need to set this parser for the SomeValue element in the aggregate. Something along these lines: root_paggr root_p; custom_integer_pimpl int_p; catalog_p.container_p_.SomeValue_parser (int_p); You can also encapsulate all this by creating a class derived from root_paggr, adding the custom_integer_pimpl member to it, and then setting the parser in its constructor. Boris From matthias.maschek at uma.at Tue May 10 09:00:09 2011 From: matthias.maschek at uma.at (Matthias Maschek) Date: Tue May 10 09:00:19 2011 Subject: [xsde-users] paggr.post return value Message-ID: <4DC936D9.3040008@uma.at> Hello! I have a question regarding the .post() method of my root elements. All of them except one are returning a pointer to the data required. Only one of them is returning data directly. Any guesses why? In the XSD I cant see any difference between them. They have nearly the same structure. (XSD part below) My command: xsde cxx-hybrid --generate-parser --generate-aggregate --root-element visitor --include-prefix XML/ --hxx-suffix .h --cxx-suffix .cpp --show-sloc myXSD.xsd Any tipps? Thanks, Matthias Maschek -- uma - separating the signal from the noise DI Matthias Maschek . Software Engineer . matthias.maschek@uma.at uma information technology GmbH . Zollergasse 9-11 . A-1070 Vienna http://www.uma.at -- This message contains information which may be confidential and privileged. Unless you are the addressee (or authorized to receive for the addressee), you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received the message in error, please advise the sender by reply e-mail @uma.at, and delete the message. Thank you very much. From boris at codesynthesis.com Wed May 11 17:23:30 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed May 11 15:07:20 2011 Subject: [xsde-users] paggr.post return value In-Reply-To: <4DC936D9.3040008@uma.at> References: <4DC936D9.3040008@uma.at> Message-ID: Matthias, Matthias Maschek writes: > I have a question regarding the .post() method of my root elements. All > of them except one are returning a pointer to the data required. Only > one of them is returning data directly. Any guesses why? Yes, the ones that return pointers are of variable-length types. While the one that returns a value is of a fixed-length type. For more information about this distinction see Section 4.2, "Memory Management" in the C++/Hybrid getting started guide: http://www.codesynthesis.com/projects/xsde/documentation/cxx/hybrid/guide/#4.2 Boris From boris at codesynthesis.com Mon May 16 10:13:36 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon May 16 07:57:23 2011 Subject: [xsde-users] Re: Overriding validation of empty elements In-Reply-To: References: <20110307131332.GA12368@onega.codesynthesis.com> Message-ID: Hi Klaus, [I've CC'ed the xsde-users mailing list again in case someone else will have a similar question in the future.] Cinibulk, Klaus writes: > Does the XSD/e code generator support "nillable" for xs:integer and > xs:int and xs:float? No, XSD/e does not support the nillable feature. For reasons why we don't support it, see this post in the archives: http://www.codesynthesis.com/pipermail/xsde-users/2011-February/000332.html However, you can handle nil elements using the same approach as I outlines in my previous reply: http://www.codesynthesis.com/pipermail/xsde-users/2011-May/000380.html You will just need to override the _attribute() callback and check for the nil attribute there: virtual void _attribute (const ro_string& ns, const ro_string& name, const ro_string& value); Boris From boris at codesynthesis.com Tue May 17 01:36:15 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon May 16 23:20:01 2011 Subject: [xsde-users] Re: validation false error In-Reply-To: <17418715-5786-4C10-98F8-A9521F0A8E2E@jmsutton.co.uk> References: <17418715-5786-4C10-98F8-A9521F0A8E2E@jmsutton.co.uk> Message-ID: Hi James, Can you please from now on send technical questions like these to the xsde-users mailing list (CC'ed)? This way others who may have similar questions in the future will hopefully be able to find the answers. James Sutton writes: > 1. I've come across a problem in validation for the attached document. > It reports a decimal error for a valid element. It is perhaps a buffer > edge error as deleting a single space character before the element makes > it work! This seems to be a problem that has already been reported (by you) and fixed. Can you make sure that this patch is applied to your XSD/e build: http://scm.codesynthesis.com/?p=xsde/xsde.git;a=commit;h=f701e98418bd8e876173dbf5d6b91823c21e51d7 > 2. It would be helpful if the exception could return the actual XML > element text, if that's possible. No, there is no support for this. However, you can probably implement something like this yourself by using the line/column information that is part of the exception. > 3. I have serialisation working now, so I can read, modify and write > a document. I am using diff to find discrepances, and one of the most > numerous is because xsde always writes a full close tag eg: > > > > and never uses the shorthand for empty elements eg: > > > > A trivial point really, but is there any switch to allow it to use the > short form? The explicit closing tag is the canonical XML format and that's the only format that XSD/e supports at the moment. However, we do have an item on the TODO list for the next version to support the shorter notation. > 4. Nested sequence_type classes can be very confusing. Rather than > reuse sequence_type, sequence1_type, sequence2_type... for each level > of nesting it would be easier if you used unique numbers for every > sequence_type defined in an outer class. In a sense that's exactly what we do. What "uniquifiers" other than numbers would you suggest we use? Boris From boris at codesynthesis.com Wed May 18 02:45:19 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed May 18 00:29:03 2011 Subject: [xsde-users] Validation and exceptions In-Reply-To: References: <20110307131332.GA12368@onega.codesynthesis.com> Message-ID: Klaus, I am CC'ing the xsde-users mailing list again. In the future can you please send technical questions like these to the xsde-users list instead of to me directly? Cinibulk, Klaus writes: > Actually, what happens if validation is turned off globally but an > unknown tag, e.g. as part of a certain sequence, is handed over to > the parser? It is ignored. > Or, on the other hand if generation of exceptions is turned off, what > happens in this case, if an unknown tag arrives. If the validation is enabled but exceptions are disabled, the validation errors are reported via error codes. See the 'minimal' example for more information on how to handle this. > Is there still access to the rest of the object tree? No, the parser stops building the tree at the first error, regardless of whether you use exceptions or error codes. Boris From chandni.swarnkar at tcs.com Fri May 20 02:39:43 2011 From: chandni.swarnkar at tcs.com (Chandni Swarnkar) Date: Fri May 20 08:35:27 2011 Subject: [xsde-users] Query related using code synthesis for xcode Message-ID: Hi, I am trying to use the code synthesis in the Xcode ,I have successfully built the libxsde library and generated related .cxx and .hxx file of the xsd schema of my xml file.But know I don't find any way to proceed further and validate my xml with the xsd.Please help me out to validate my xml with xsd using code synthesis. Regards, Chandni Swarnkar Mailto:chandni.swarnkar@tcs.com ____________________________________________ Experience certainty. IT Services Business Solutions Outsourcing ____________________________________________ =====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you From boris at codesynthesis.com Sun May 22 16:41:19 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun May 22 14:24:56 2011 Subject: [xsde-users] Query related using code synthesis for xcode In-Reply-To: References: Message-ID: Hi Chandni, Chandni Swarnkar writes: > I am trying to use the code synthesis in the Xcode ,I have successfully > built the libxsde library and generated related .cxx and .hxx file of the > xsd schema of my xml file.But know I don't find any way to proceed further > and validate my xml with the xsd.Please help me out to validate my xml > with xsd using code synthesis. The "Hello World Example" chapter in the C++/Hybrid Getting Started Guide provides step-by-step instructions on how to do this: http://www.codesynthesis.com/projects/xsde/documentation/cxx/hybrid/guide/#2 There are also a number of examples in the examples/cxx/hybrid/ directory in the XSD/e distribution. The README file in this directory provides a short description of each example. Boris From boris at codesynthesis.com Sun May 22 16:50:59 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun May 22 14:34:36 2011 Subject: [xsde-users] Re: validation false error In-Reply-To: <8F2ADD26-72AC-418F-9268-FEC73E570616@jmsutton.co.uk> References: <17418715-5786-4C10-98F8-A9521F0A8E2E@jmsutton.co.uk> <8F2ADD26-72AC-418F-9268-FEC73E570616@jmsutton.co.uk> Message-ID: Hi James, James Sutton writes: > > Can you please from now on send technical questions like these to the > > xsde-users mailing list (CC'ed)? This way others who may have similar > > questions in the future will hopefully be able to find the answers. > > do you mean ? Yes. > >> 4. Nested sequence_type classes can be very confusing. Rather than > >> reuse sequence_type, sequence1_type, sequence2_type... for each level > >> of nesting it would be easier if you used unique numbers for every > >> sequence_type defined in an outer class. > > > > In a sense that's exactly what we do. What "uniquifiers" other than > > numbers would you suggest we use? > > numbers are fine - just don't reuse numbers (ie names) when nested in > a single outer class > > ie you generate: > > class outer > { > class sequence_type > { > .. > class sequence_type > { > ... > }; > const sequence_type sequence() const; > ... > class sequence1_type > { > ... > }; > const sequence1_type sequence1() const; > }; > > const sequence_type sequence() const; > > class sequence1_type > { > ... > }; > const sequence1_type sequence1() const; > ... > }; > > while I am suggesting something like: > > class outer > { > class sequence0_type > { > .. > class sequence2_type > { > ... > }; > const sequence2_type sequence2() const; > ... > class sequence3_type > { > ... > }; > const sequence3_type sequence3() const; > }; > > const sequence0_type sequence0() const; > > class sequence1_type > { > ... > }; > const sequence1_type sequence1() const; > ... > }; > > or alternatively: > > class outer > { > class sequence0_type > { > .. > class sequence1_1_type > { > ... > }; > const sequence1_1_type sequence1_1() const; > ... > class sequence1_2_type > { > ... > }; > const sequence1_2_type sequence1_2() const; > }; > > const sequence0_type sequence0() const; > > class sequence1_type > { > ... > }; > const sequence1_type sequence1() const; > ... > }; > > so you don't get the same class name recurring at different levels > of the hierarchy within the same class. Hm, I see the utility of your suggestion. However, it will be hard to do such numbering in the code generator since the outer counters will have to be passed around when generating classes for nested compositors. As a workaround, you can always assign custom names to the individual types using typedef. Something like this: typedef outer::sequence_type foo_seq; typedef outer::sequence1_type bar_seq; typedef foo_seq::sequence_type foo_x_seq; typedef foo_seq::sequence1_type foo_y_seq; Where 'foo', 'bar', 'x', and 'y' would be some meaningful names in your vocabulary. Boris From adrian.garcea at googlemail.com Mon May 30 03:46:21 2011 From: adrian.garcea at googlemail.com (Adrian Garcea) Date: Mon May 30 13:03:49 2011 Subject: [xsde-users] Segmentation fault for choice in large project Message-ID: Hi, I am currently evaluating XSDe for a project. I get a very curious runtime error. When using a choice with elements of variable length in a big xml schema (generating more than 115000 lines of code), I get a segmentation fault while trying to parse a valid xml file. No parser exception is thrown, but after evaluating the switch case for the choice, the code returns a segmentation fault in the basic_string class. If I reduce the schema to the relevant part, where the error occurs (generating only about 25000 lines of code), I don't get any errors. Also if I avoid the coice in the large schema, I also don't get any errors. I use XSDe on QNX and have compiled the code using gcc 4.4.2 with the GNU stdlib with exceptions. I generate c++ code, using the following command-line options: xsde cxx-hybrid --generate-parser --generate-serializer --generate-aggregate --generate-detach --root-element-all *.xsd Is this type of error familiar top you? What can be done to avoid it. Thank you very much in advance for your answer. Best regards, Adrian Garcea From boris at codesynthesis.com Mon May 30 15:28:24 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon May 30 13:11:57 2011 Subject: [xsde-users] Segmentation fault for choice in large project In-Reply-To: References: Message-ID: Hi Adrian, Adrian Garcea writes: > When using a choice with elements of variable length in a big xml schema > (generating more than 115000 lines of code), I get a segmentation fault > while trying to parse a valid xml file. No parser exception is thrown, but > after evaluating the switch case for the choice, the code returns a > segmentation fault in the basic_string class. > > [...] > > Is this type of error familiar top you? What can be done to avoid it. No, we haven't seen anything like this. Would it be possible for you to send me the schema and the test XML file so that I can try to figure out what's going on? You can send it to me directly instead of to the mailing list if you would like to keep your schema private. Thanks, Boris From matthias.maschek at uma.at Tue May 31 02:46:16 2011 From: matthias.maschek at uma.at (Matthias Maschek) Date: Tue May 31 02:46:26 2011 Subject: [xsde-users] No xml_schema::parser_exception thrown Message-ID: <4DE48EB8.2010903@uma.at> Hello! I have a problem with my parsing code. It's actally the same as the tutorial code. But some thing goes wrong (maybe I did something wrong in the XML) in all other codeblocks where i used XSDE until now i got an const xml_schema::parser_exception&. But in this case i get some other problem and he skips the the catch block. Only catching catch(...) helps. Any help what i am doing wrong? What other kind of exception can it throw? I am not aware of doing something fundamentally different then in my other code. Thanks, Matthias Maschek From boris at codesynthesis.com Tue May 31 13:41:31 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue May 31 11:25:04 2011 Subject: [xsde-users] No xml_schema::parser_exception thrown In-Reply-To: <4DE48EB8.2010903@uma.at> References: <4DE48EB8.2010903@uma.at> Message-ID: Hi Matthias, Matthias Maschek writes: > I have a problem with my parsing code. It's actally the same as the > tutorial code. But some thing goes wrong (maybe I did something wrong in > the XML) in all other codeblocks where i used XSDE until now i got an > const xml_schema::parser_exception&. But in this case i get some other > problem and he skips the the catch block. Only catching catch(...) helps. > > Any help what i am doing wrong? What other kind of exception can it > throw? I am not aware of doing something fundamentally different then in > my other code. The parsing code itself can only throw exceptions that are derived from xml_schema::parser_exception. Note that the serialization code throws xml_schema::serialization_exception. There could also be other exceptions that are thrown by code that the parsing/serialization code calls (e.g., iostream exceptions). So it is hard to say what's going on without seeing the relevant code fragment. Also, on some versions of VC++ the catch(...) block will also catch access violations. Boris