From hing.liu at gmail.com Sun Jun 4 01:46:27 2017 From: hing.liu at gmail.com (Hing Liu) Date: Sun Jun 4 05:04:43 2017 Subject: [xsd-users] "expected identifier before numeric constant" error Message-ID: Hi Support, I got a problem when compiling the C file generated from XSD. The command to generate the C file from xsd: $xsd cxx-tree --generate-serialization --cxx-suffix .C --hxx-suffix .h --guard-prefix MY_XSD_GEN --generate-polymorphic --polymorphic-type-all --generate-ostream isocrstypes_v1.0.xsd The command to compile the C file: $gcc -c -o test.o isocrstypes_v1.0.C -I /proj/inferno/copyleft/s86/xsd-3.3.0/include/ -I /proj/inferno/copyleft/s86/xerces-c/include/ However, there is an error like below: isocrstypes_v1.0.h:487:7: error: expected identifier before numeric constant GS, After searching around, it seems like there is preprocessor conflict to the enum value "GS", but I cannot see the conflict even using gcc -E option. Attached please find the xsd file. The thing is working fine when I run it in Linux, it just happens in Solaris. Let me know what information you need. The gcc version used in Solaris is gcc 4.9.2, while in Linux it is gcc 4.4.7. Please help and thanks. BR, Hing -------------- next part -------------- A non-text attachment was scrubbed... Name: isocrstypes_v1.0.xsd Type: application/octet-stream Size: 74859 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20170604/b3f2380a/isocrstypes_v1.0-0001.obj From boris at codesynthesis.com Sun Jun 4 05:40:02 2017 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Jun 4 05:40:11 2017 Subject: [xsd-users] "expected identifier before numeric constant" error In-Reply-To: References: Message-ID: Hi Hing, Hing Liu writes: > isocrstypes_v1.0.h:487:7: error: expected identifier before numeric constant > GS, > > After searching around, it seems like there is preprocessor conflict to the > enum value "GS", but I cannot see the conflict even using gcc -E option. You can use XSD's --reserved-name option to rename it to something that doesn't conflict. Boris From hing.liu at gmail.com Sun Jun 4 08:58:49 2017 From: hing.liu at gmail.com (Hing Liu) Date: Sun Jun 4 08:59:01 2017 Subject: [xsd-users] "expected identifier before numeric constant" error In-Reply-To: References: Message-ID: Hi Boris, Cool. It works. Thanks for your suggestion. I just wonder why it works in Linux while it cause problem in Solaris, not important anyway with this option. Thanks, Hing On Sun, Jun 4, 2017 at 5:40 PM, Boris Kolpackov wrote: > Hi Hing, > > Hing Liu writes: > > > isocrstypes_v1.0.h:487:7: error: expected identifier before numeric > constant > > GS, > > > > After searching around, it seems like there is preprocessor conflict to > the > > enum value "GS", but I cannot see the conflict even using gcc -E option. > > You can use XSD's --reserved-name option to rename it to something that > doesn't conflict. > > Boris > From david.miller at torstonetechnology.com Thu Jun 8 13:16:40 2017 From: david.miller at torstonetechnology.com (David Miller) Date: Thu Jun 8 13:24:54 2017 Subject: [xsd-users] cxx-parser with string restrictions Message-ID: <50ca0c94a7845b3925730f9bb0afe0a8@mail.gmail.com> If the example hello.xsd is changed so greeting is a restriction e.g. Then the generated code becomes virtual void greeting (); rather than virtual void greeting (const ::std::string&); For tree mappings I believe ?greeting? would still map to a string. Is this a bug ? Or is there some workaround. -- The contents (including attachments) of this email are strictly confidential, intended for the addressee(s) only and may be legally privileged. If you are not the intended recipient, please contact the sender immediately and delete all copies of this email without distributing it further in any way. Torstone Technology Limited, its affiliates and staff do not accept any liability for the contents of the message, and the sending of this message is not intended to form a contract with the recipient. Torstone Technology Limited is registered in England and Wales with company number 07490275 and registered office at 8 Lloyd's Avenue, London EC3N 3EL, United Kingdom. From boris at codesynthesis.com Thu Jun 8 13:28:59 2017 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 8 13:29:08 2017 Subject: [xsd-users] cxx-parser with string restrictions In-Reply-To: <50ca0c94a7845b3925730f9bb0afe0a8@mail.gmail.com> References: <50ca0c94a7845b3925730f9bb0afe0a8@mail.gmail.com> Message-ID: Hi David, David Miller writes: > > > > > This is a new XML Schema type so you will have to map it to a C++ type, provide a parser implementation, etc. Dealing with restrictions in C++/Parser is painful so if you plan on having many of them, I would recommend C++/Tree. Boris From david.miller at torstonetech.com Thu Jun 8 13:37:18 2017 From: david.miller at torstonetech.com (David Miller) Date: Thu Jun 8 13:40:54 2017 Subject: [xsd-users] cxx-parser with string restrictions In-Reply-To: References: <50ca0c94a7845b3925730f9bb0afe0a8@mail.gmail.com> Message-ID: <9E8A8C52-41B1-4C38-9347-0D6A10ED74B4@torstonetech.com> Thanks for quick response. Because input file is enormous, parser is a better approach. I think I'll just edit the 3rd party schema :-) Sent from my iPad > On Jun 8, 2017, at 1:28 PM, Boris Kolpackov wrote: > > Hi David, > > David Miller writes: > >> >> >> >> >> > > This is a new XML Schema type so you will have to map it to a C++ type, > provide a parser implementation, etc. Dealing with restrictions in > C++/Parser is painful so if you plan on having many of them, I would > recommend C++/Tree. > > Boris -- The contents (including attachments) of this email are strictly confidential, intended for the addressee(s) only and may be legally privileged. If you are not the intended recipient, please contact the sender immediately and delete all copies of this email without distributing it further in any way. Torstone Technology Limited, its affiliates and staff do not accept any liability for the contents of the message, and the sending of this message is not intended to form a contract with the recipient. Torstone Technology Limited is registered in England and Wales with company number 07490275 and registered office at 8 Lloyd's Avenue, London EC3N 3EL, United Kingdom. From boris at codesynthesis.com Thu Jun 8 13:43:47 2017 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 8 13:43:55 2017 Subject: [xsd-users] cxx-parser with string restrictions In-Reply-To: <9E8A8C52-41B1-4C38-9347-0D6A10ED74B4@torstonetech.com> References: <50ca0c94a7845b3925730f9bb0afe0a8@mail.gmail.com> <9E8A8C52-41B1-4C38-9347-0D6A10ED74B4@torstonetech.com> Message-ID: Hi David, David Miller writes: > Because input file is enormous, parser is a better approach. You can parse things in chunks with C++/Tree and a bit of effort. See 'streaming' example for details. Boris From endight at gmail.com Fri Jun 16 15:27:00 2017 From: endight at gmail.com (endight .) Date: Fri Jun 16 15:27:13 2017 Subject: [xsd-users] Generated sources without xerces dependency Message-ID: Is it possible to generated such bindings that there will be no any other dependencies besides the generated files itself? To not link the xerces lib. From bernhard.rapp at student.tugraz.at Sat Jun 17 12:34:48 2017 From: bernhard.rapp at student.tugraz.at (Bernhard Rapp) Date: Sat Jun 17 12:35:11 2017 Subject: [xsd-users] Generated sources without xerces dependency In-Reply-To: References: Message-ID: Skipped content of type multipart/mixed-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: OpenPGP digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20170617/219fb380/signature.pgp From endight at gmail.com Mon Jun 19 08:59:46 2017 From: endight at gmail.com (endight .) Date: Mon Jun 19 08:59:59 2017 Subject: [xsd-users] Generated sources without xerces dependency In-Reply-To: References: Message-ID: Yes it seems it is what i need. But i getting error when trying to perform link step from tutorial: c++ -o driver driver.o hello-pskel.o .../libxsde/xsde/libxsde.a the output is in attached file. 2017-06-17 19:34 GMT+03:00 Bernhard Rapp : > Hey, > > did you already saw the XSD/e Project: > > http://www.codesynthesis.com/projects/xsde/ > > > Maybe this is what you looking for? > > > br, > > Bernhard > > On 16.06.2017 21:27, endight . wrote: > > Is it possible to generated such bindings that there will be no any other > > dependencies besides the generated files itself? To not link the xerces > lib. > > > -------------- next part -------------- Undefined symbols for architecture x86_64: "std::istream::read(char*, long)", referenced from: xsde::cxx::parser::expat::document_pimpl::parse(std::istream&) in libxsde.a(document.o) "std::ostream::write(char const*, long)", referenced from: xsde::cxx::operator<<(std::ostream&, xsde::cxx::ro_string const&) in libxsde.a(ro-string.o) "std::string::_M_leak_hard()", referenced from: xsde::cxx::parser::validating::string_common::validate_facets(std::string&, xsde::cxx::parser::validating::string_facets::facets const&, xsde::cxx::parser::context&) in libxsde.a(string-common.o) "std::string::_Rep::_M_destroy(std::allocator const&)", referenced from: xsde::cxx::parser::validating::string_pimpl::post_string() in libxsde.a(string-stl.o) xsde::cxx::parser::validating::string_pimpl::~string_pimpl() in libxsde.a(string-stl.o) xsde::cxx::parser::validating::string_pimpl::~string_pimpl() in libxsde.a(string-stl.o) "std::string::_Rep::_S_empty_rep_storage", referenced from: xsde::cxx::parser::validating::string_pimpl::post_string() in libxsde.a(string-stl.o) xsde::cxx::parser::validating::string_pimpl::~string_pimpl() in libxsde.a(string-stl.o) xsde::cxx::parser::validating::string_pimpl::~string_pimpl() in libxsde.a(string-stl.o) "std::string::swap(std::string&)", referenced from: xsde::cxx::parser::validating::string_pimpl::post_string() in libxsde.a(string-stl.o) "std::string::append(char const*, unsigned long)", referenced from: xsde::cxx::parser::validating::string_pimpl::_characters(xsde::cxx::ro_string const&) in libxsde.a(string-stl.o) "std::string::resize(unsigned long, char)", referenced from: xsde::cxx::parser::validating::string_common::validate_facets(std::string&, xsde::cxx::parser::validating::string_facets::facets const&, xsde::cxx::parser::context&) in libxsde.a(string-common.o) "std::string::_M_mutate(unsigned long, unsigned long, unsigned long)", referenced from: xsde::cxx::parser::validating::string_pimpl::_pre() in libxsde.a(string-stl.o) "std::__basic_file::~__basic_file()", referenced from: xsde::cxx::parser::expat::document_pimpl::parse(char const*) in libxsde.a(document.o) "std::basic_filebuf >::open(char const*, std::_Ios_Openmode)", referenced from: xsde::cxx::parser::expat::document_pimpl::parse(char const*) in libxsde.a(document.o) "std::basic_filebuf >::close()", referenced from: xsde::cxx::parser::expat::document_pimpl::parse(char const*) in libxsde.a(document.o) "std::basic_filebuf >::basic_filebuf()", referenced from: xsde::cxx::parser::expat::document_pimpl::parse(char const*) in libxsde.a(document.o) "std::basic_filebuf >::~basic_filebuf()", referenced from: xsde::cxx::parser::expat::document_pimpl::parse(char const*) in libxsde.a(document.o) "std::basic_ifstream >::~basic_ifstream()", referenced from: xsde::cxx::parser::expat::document_pimpl::parse(char const*) in libxsde.a(document.o) "std::locale::~locale()", referenced from: xsde::cxx::parser::expat::document_pimpl::parse(char const*) in libxsde.a(document.o) "std::ios_base::Init::Init()", referenced from: __GLOBAL__sub_I_document.cxx in libxsde.a(document.o) __GLOBAL__sub_I_ro_string.cxx in libxsde.a(ro-string.o) __GLOBAL__sub_I_exceptions.cxx in libxsde.a(exceptions.o) "std::ios_base::Init::~Init()", referenced from: __GLOBAL__sub_I_document.cxx in libxsde.a(document.o) __GLOBAL__sub_I_ro_string.cxx in libxsde.a(ro-string.o) __GLOBAL__sub_I_exceptions.cxx in libxsde.a(exceptions.o) "std::ios_base::ios_base()", referenced from: xsde::cxx::parser::expat::document_pimpl::parse(char const*) in libxsde.a(document.o) "std::ios_base::~ios_base()", referenced from: xsde::cxx::parser::expat::document_pimpl::parse(char const*) in libxsde.a(document.o) "std::basic_ios >::init(std::basic_streambuf >*)", referenced from: xsde::cxx::parser::expat::document_pimpl::parse(char const*) in libxsde.a(document.o) "std::basic_ios >::clear(std::_Ios_Iostate)", referenced from: xsde::cxx::parser::expat::document_pimpl::parse(std::istream&) in libxsde.a(document.o) xsde::cxx::parser::expat::document_pimpl::parse(char const*) in libxsde.a(document.o) xsde::cxx::parser::operator<<(std::ostream&, xsde::cxx::parser::exception const&) in libxsde.a(exceptions.o) "std::basic_ostream >& std::__ostream_insert >(std::basic_ostream >&, char const*, long)", referenced from: xsde::cxx::parser::operator<<(std::ostream&, xsde::cxx::parser::exception const&) in libxsde.a(exceptions.o) "VTT for std::basic_ifstream >", referenced from: xsde::cxx::parser::expat::document_pimpl::parse(char const*) in libxsde.a(document.o) "vtable for std::basic_filebuf >", referenced from: xsde::cxx::parser::expat::document_pimpl::parse(char const*) in libxsde.a(document.o) NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "vtable for std::basic_ifstream >", referenced from: xsde::cxx::parser::expat::document_pimpl::parse(char const*) in libxsde.a(document.o) NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "vtable for std::basic_streambuf >", referenced from: xsde::cxx::parser::expat::document_pimpl::parse(char const*) in libxsde.a(document.o) NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "vtable for std::basic_ios >", referenced from: xsde::cxx::parser::expat::document_pimpl::parse(char const*) in libxsde.a(document.o) NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. ld: symbol(s) not found for architecture x86_64 From endight at gmail.com Mon Jun 19 09:03:51 2017 From: endight at gmail.com (endight .) Date: Mon Jun 19 09:04:04 2017 Subject: [xsd-users] Generated sources without xerces dependency In-Reply-To: References: Message-ID: p.s. os x sierra 2017-06-19 15:59 GMT+03:00 endight . : > Yes it seems it is what i need. > But i getting error when trying to perform link step from tutorial: > > c++ -o driver driver.o hello-pskel.o .../libxsde/xsde/libxsde.a > > the output is in attached file. > > > 2017-06-17 19:34 GMT+03:00 Bernhard Rapp > : > >> Hey, >> >> did you already saw the XSD/e Project: >> >> http://www.codesynthesis.com/projects/xsde/ >> >> >> Maybe this is what you looking for? >> >> >> br, >> >> Bernhard >> >> On 16.06.2017 21:27, endight . wrote: >> > Is it possible to generated such bindings that there will be no any >> other >> > dependencies besides the generated files itself? To not link the xerces >> lib. >> >> >> > From isharp at atis.org Mon Jun 19 12:40:07 2017 From: isharp at atis.org (Iain Sharp) Date: Mon Jun 19 12:40:20 2017 Subject: [xsd-users] Serializing just the contents of an "any" element Message-ID: Hi Folks, I am working on a feasibility-study to use the C++ XSD tree tool to work on the XSDs defined for the oneM2M IoT standard (http://www.onem2m.org/). What I need to do is to just serialize the contents of an "any" - without its parent - in to the body of an HTTP request. I am really struggling to work out how to do this. Specifically the relevant XSD fragment is: I can write any object from the schema in to the 1st "any" of this element OK. I can serialize a "primitiveContent" or any parent of that element OK, but I can't seem to work out how to serialize just the contents of the "any" without also getting some of it's parent. If you could suggest the right direction that would be very helpful. What I get at the moment is: myAE myAE true What I want is: myAE myAE true I suppose I could just strip the 1st and last lines off the serialization of the parent, but that doesn't seem like a quality solution! Regards Iain From boris at codesynthesis.com Mon Jun 19 13:19:30 2017 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jun 19 13:19:39 2017 Subject: [xsd-users] Serializing just the contents of an "any" element In-Reply-To: References: Message-ID: Iain Sharp writes: > > > > > > > > [...] > > > > myAE > myAE > true > > > > What I want is: > > > myAE > myAE > true > Your schema allows for multiple elements in the wildcard content. That is, your could have something like this: ... ... ... I am not sure what you want to do with that. Serializing them all will create a "multi-root" document which is not a valid XML. In any case, what you need to do is serialize primitiveContent to DOM. Then you can iterate over its child elements and serialize them one at a time. Or, alternatively, you could iterate over the wildcard content and just serialize each element -- will probably be more efficient. Examples and the FAQ on the Wiki have some sample code for doing this. Boris From bernhard.rapp at student.tugraz.at Mon Jun 19 16:09:34 2017 From: bernhard.rapp at student.tugraz.at (Bernhard Rapp) Date: Mon Jun 19 16:10:05 2017 Subject: [xsd-users] Generated sources without xerces dependency In-Reply-To: References: Message-ID: <2093b0fb-474b-7a53-350b-5b63a5078569@student.tugraz.at> Skipped content of type multipart/mixed-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: OpenPGP digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20170619/abc39661/signature.pgp From isharp at atis.org Tue Jun 20 03:47:52 2017 From: isharp at atis.org (Iain Sharp) Date: Tue Jun 20 03:48:05 2017 Subject: [xsd-users] Serializing just the contents of an "any" element In-Reply-To: References: Message-ID: Thanks Boris, That is helpful. Your point about multiple root elements is a good one. As far as I can tell in reality, and certainly for the application I am working on, there is only ever one root element populated in the any wildcard. I suspected that I may have to work through the DOM using the techniques from the FAQ. At first glance this looks rather low-level and a little intimidating so I wanted to check that I wasn't missing a simpler, higher level approach before looking in detail at the DOM option. I am surprised that the code generator doesn't create a generic set of serialization methods for the ultimate base class of all the XML element classes. Regards Iain -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: 19 June 2017 18:20 To: Iain Sharp Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] Serializing just the contents of an "any" element Iain Sharp writes: > > > > > > > > [...] > > > > myAE > myAE > true > > > > What I want is: > > > myAE > myAE > true > Your schema allows for multiple elements in the wildcard content. That is, your could have something like this: ... ... ... I am not sure what you want to do with that. Serializing them all will create a "multi-root" document which is not a valid XML. In any case, what you need to do is serialize primitiveContent to DOM. Then you can iterate over its child elements and serialize them one at a time. Or, alternatively, you could iterate over the wildcard content and just serialize each element -- will probably be more efficient. Examples and the FAQ on the Wiki have some sample code for doing this. Boris From endight at gmail.com Tue Jun 20 10:42:41 2017 From: endight at gmail.com (endight .) Date: Tue Jun 20 10:42:53 2017 Subject: [xsd-users] --type-naming ucc for xsde Message-ID: What the analog of xsd --type-naming ucc for xsde? From mailme.harpinder at gmail.com Fri Jun 23 02:09:16 2017 From: mailme.harpinder at gmail.com (Harpinder Kaur) Date: Fri Jun 23 04:03:15 2017 Subject: [xsd-users] How can I parse time in milliseconds using xml_schema::time(hour, minute, second) Message-ID: Hi Boris, I am working with xsd but I am unable to figure out why I am unable to write milliseconds in final XML being generated. Thanks in advance. Harpinder -- Really appreciate your thoughtful attention to this. Harpinder Kaur | Organizer, GDG Jalandhar | mailme.harpinder@gmail.com | +91 99 88 124495 *LinkedIn* * | **Google+* ? From boris at codesynthesis.com Mon Jun 26 12:27:17 2017 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jun 26 12:27:25 2017 Subject: [xsd-users] How can I parse time in milliseconds using xml_schema::time(hour, minute, second) In-Reply-To: References: Message-ID: Harpinder Kaur writes: > I am working with xsd but I am unable to figure out why I am unable to > write milliseconds in final XML being generated. Can you be more specific? What exactly are you doing and what doesn't work? Seeing some concrete code is always helpful. Boris From mailme.harpinder at gmail.com Mon Jun 26 14:00:23 2017 From: mailme.harpinder at gmail.com (Harpinder Kaur) Date: Tue Jun 27 03:18:19 2017 Subject: [xsd-users] How can I parse time in milliseconds using xml_schema::time(hour, minute, second) In-Reply-To: References: Message-ID: Hi, thanks for prompt reply. I can't share code due to some restrictions. But to be specific, please consider below: I need to display time as "21:32:52.126" but I am unable to do so. I have read the code synthesis documentation and related stuff, there I cam to know that built-in time type has a constructor like time(int hour , int minutes , *double seconds*). I tried passing fractional time(combined seconds and milliseconds from an input boost::ptime object) to the constructor to write finally as an XML tag's value. However, XML tag is having only 21:32:52 as time value, milliseconds are getting truncated. Is there something with serialization or something else? Really appreciate your thoughtful attention to this. Harpinder Kaur | Organizer, GDG Jalandhar | mailme.harpinder@gmail.com | +91 99 88 124495 *LinkedIn | Google+ * ? On Mon, Jun 26, 2017 at 9:57 PM, Boris Kolpackov wrote: > Harpinder Kaur writes: > > > I am working with xsd but I am unable to figure out why I am unable to > > write milliseconds in final XML being generated. > > Can you be more specific? What exactly are you doing and what doesn't > work? Seeing some concrete code is always helpful. > > Boris > From boris at codesynthesis.com Wed Jun 28 08:39:42 2017 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 28 08:39:51 2017 Subject: [xsd-users] How can I parse time in milliseconds using xml_schema::time(hour, minute, second) In-Reply-To: References: Message-ID: Harpinder Kaur writes: > I need to display time as "21:32:52.126" but I am unable to do so. I have > read the code synthesis documentation and related stuff, there I cam to > know that built-in time type has a constructor like time(int hour , int > minutes , *double seconds*). I tried passing fractional time(combined > seconds and milliseconds from an input boost::ptime object) to the > constructor to write finally as an XML tag's value. However, XML tag is > having only 21:32:52 as time value, milliseconds are getting truncated. You must be initializing xml_schema::time incorrectly (and since you don't show how you do it, that's all I can say). Boris