From boris at codesynthesis.com Thu Dec 1 07:43:59 2005 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] First revision of C++/Tree Mapping User Manual available for preview Message-ID: <20051201124359.GA6047@karelia> Good day, The first revision of the XML Schema C++/Tree Mapping User Manual is available for preview at http://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/ You feedback is very much appreciated. If you report any mistake, typo, etc., we will acknowledge your contribution in the document ;-). have fun, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051201/b1ce0809/attachment.pgp From lucasmagder at rogers.com Sat Dec 3 15:08:28 2005 From: lucasmagder at rogers.com (Lucas Magder) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] Parsing the Collada 1.3.1 XSD Message-ID: <000001c5f845$53f4ef40$6802a8c0@lucas> Hi, I just downloaded the win32 build of 1.6.0 off the XSD site (I'm also using the xerces build from there) I'm attempting to create a tree mapping based on the collada 1.3.1 schema which is available here http://www.collada.org/2005/COLLADASchema.xsd. xsd generates the following output COLLADASchema.xsd:1238:65: warning: element 'h' is implicitly of anyType COLLADASchema.xsd:1238:65: info: did you forget to specify 'type' attribute? COLLADASchema.xsd:3079:29: ice: element 'node' is in unexpected condition This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. Can anybody point me in the right direction towards getting this to work? Thanks, Lucas -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codesynthesis.com/pipermail/xsd-users/attachments/20051203/d4e70800/attachment.htm From boris at codesynthesis.com Sat Dec 3 16:41:46 2005 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] Parsing the Collada 1.3.1 XSD In-Reply-To: <000001c5f845$53f4ef40$6802a8c0@lucas> References: <000001c5f845$53f4ef40$6802a8c0@lucas> Message-ID: <20051203214146.GA23035@karelia> Lucas, Lucas Magder writes: > COLLADASchema.xsd:3079:29: ice: element 'node' is in unexpected condition This appears to be a bug in xsd. The 'node' element was recursively referencing itself and xsd was not prepared to handle such a case. After fixing this bug I could compile the schema though there was one more problem. Here is the relevant fragment (line 870): ... As you can see, there are two definitions of the 'source' element. I am not sure if this is intentional or a typo. While it is valid per XML Schema (though a questionable design), xsd does not yet support such constructs. If I comment the second reference to 'source' out, I can compile the schema and then compile the generated code without any problems. BTW, the schema uses a lot of anonymous types and is heavily recursive so to avoid code bloat I used --morph-anonymous options: $ xsd cxx-tree --morph-anonymous COLLADASchema.xsd We are planning to release xsd 1.7.0 (which will include the fix for the bug you found) in a couple of days. If you would like, I can also send you a pre-release (just let me know if it is ok to send the .zip via email). hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051203/7ec852ee/attachment.pgp From lucasmagder at rogers.com Sat Dec 3 17:21:07 2005 From: lucasmagder at rogers.com (Lucas Magder) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] Parsing the Collada 1.3.1 XSD In-Reply-To: <20051203214146.GA23035@karelia> Message-ID: <000701c5f857$dbbe9270$6802a8c0@lucas> Thanks for the practically instant and helpful response! If you can send the prerelease version that would be great, since I could get started with my importer while I wait for 1.7.0. As for the duplicate source element, the spec states that there must be at least one source before any number of sources and vertices entries. I can easily remove the second one as you did since it will still accept all correct files. Also, thanks for the --morph-anonymous tip. -Lucas -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Saturday, December 03, 2005 4:42 PM To: Lucas Magder Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] Parsing the Collada 1.3.1 XSD Lucas, Lucas Magder writes: > COLLADASchema.xsd:3079:29: ice: element 'node' is in unexpected condition This appears to be a bug in xsd. The 'node' element was recursively referencing itself and xsd was not prepared to handle such a case. After fixing this bug I could compile the schema though there was one more problem. Here is the relevant fragment (line 870): ... As you can see, there are two definitions of the 'source' element. I am not sure if this is intentional or a typo. While it is valid per XML Schema (though a questionable design), xsd does not yet support such constructs. If I comment the second reference to 'source' out, I can compile the schema and then compile the generated code without any problems. BTW, the schema uses a lot of anonymous types and is heavily recursive so to avoid code bloat I used --morph-anonymous options: $ xsd cxx-tree --morph-anonymous COLLADASchema.xsd We are planning to release xsd 1.7.0 (which will include the fix for the bug you found) in a couple of days. If you would like, I can also send you a pre-release (just let me know if it is ok to send the .zip via email). hth, -boris From boris at codesynthesis.com Mon Dec 5 05:57:11 2005 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] xsd 1.7.0 released Message-ID: <20051205105711.GB7036@karelia> Good day, We've released xsd 1.7.0. The NEWS file entries for this version are as follows: * Number of bug fixes in libxsd and the generated code. cxx-tree * Comprehensive XML Schema C++/Tree Mapping User Manual: http://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/ * Basic support for union. A simple type that is defined using derivation by union is mapped to a C++ class that derives from string. * The _clone function has its arguments default-initialized. * The invalid_instance exception has been renamed to parsing. * Generic error_handler interface has been added in addition to Xerces-C++-specific DOMErrorHandler. It allows you to handle parsing/serialization errors and warnings without having to deal with Xerces-C++ specifics. See the user manual for more information. * The default error handling behavior has changed in parsing and serialization functions. Instead of printing errors and warnings to STDERR, the errors are now collected and thrown as part of the parsing/serialization exception. See the user manual for more information. * The optional and sequence containers now support operators ==, !=, <, >, <=, and >=. * Flags argument has been added to serialization functions. The only flag that is currently supported is dont_initialize. * Generated code cleanups. cxx-parser * Basic support for union. A simple type that is defined using derivation by union is mapped to a C++ class template that is just an alias for the generic parser. You are expected to override the _characters function in your implementation. * Properties argument to parsing functions which allows to programmatically specify schemas for instance document validation. * Flags argument to parsing functions. The following flags are supported: dont_validate - do not validate instance documents dont_initialize - do not initialize the Xerces-C++ runtime Precompiled binary distributions for various platforms are available from the product's web page: http://codesynthesis.com/products/xsd/ Source code for this release is available from the project's web page: http://codesynthesis.com/projects/xsd/ SHA1 checksums for the files: e6be1a8e0b87209112839581f2a3c15291fabbd8 xsd-1.7.0.tar.bz2 094d5cb27393e3993262a820c67c83809fe3aab7 xsd_1.7.0-1_i386.deb e7d9d7c7c6b0d83c5f752c84f9ac91a376e16b98 xsd-1.7.0-1.i686.rpm 166408cad7a260e04584d09a070a24ad5ac8f307 xsd-1.7.0-i686-linux-gnu.tar.bz2 b60b0560244988d05e0e8c4772f42540961fa01c xsd_1.7.0-1_amd64.deb 62a550a399f236f8438c880c8cf6e91c6da09510 xsd-1.7.0-1.x86_64.rpm a4e4dbaac0f6bd8e8902d87509b58923de86cf57 xsd-1.7.0-x86_64-linux-gnu.tar.bz2 8af6b0e83c4bb9ad619b3b7d25cb38f7157dc46c xsd-1.7.0-powerpc-macosx.tar.bz2 ea4abb29309da7fd7c2b4b043f8800d42a761366 xsd-1.7.0-sparc-solaris.tar.bz2 cbb042faa92bb2cf63894753946d125df7542f87 xsd-1.7.0-i686-windows.zip have fun, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051205/cac34aee/attachment.pgp From boris at codesynthesis.com Mon Dec 5 06:41:40 2005 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] splitting generated code into several files In-Reply-To: <20051125061928.77472.qmail@web30601.mail.mud.yahoo.com> References: <20051125061928.77472.qmail@web30601.mail.mud.yahoo.com> Message-ID: <20051205114140.GA7199@karelia> Chang, Chang Chen writes: > Ideally, I think we should not read the code which generated by xsd > and only focus on the xsd, but the reality is not, we should read the > code: > > 1) When we begin to study this facility, we should read code for > understanding what xsd can do. While you certainly can and are welcome to read the generated code, there are easier ways to understand the mapping, for example by reading the manual: http://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/ > 2) When we debug the code, we should read the code. I agree, you may end up in the generated code while debugging your application. > If xsd generates a huge source file, and many classes in it, we can > not focus the class well which we should understand, and it is a > heavy overhead for IDE (such as vs.net) to load it into memory. I think those are valid points. However the task of splitting the generated code into several source files is fairly complex (remember, that types refer to each other which should result in proper #include directives) and in some cases it is simply not possible (e.g., when types inter-dependencies form a cyclic graph). So for now your best bet is to split the schema manually using XML Schema include/import facilities. hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051205/a164c670/attachment.pgp From boris at codesynthesis.com Wed Dec 7 08:44:35 2005 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] xsd 1.7.0-1 for i686-windows released Message-ID: <20051207134435.GA5267@karelia> Good day, We've released xsd 1.7.0-1 for the i686-windows platform. It includes a small update to libxsd which allows the code to compile cleanly with Microsoft Visual C++ 8 (Visual Studio 2005). This update does not affect other platforms or compilers. This version can be downloaded from: http://codesynthesis.com/download/xsd/1.7/windows/i686/ SHA1 checksums for the file: f5083891667b961f44173c9e46e772d39f7bc86a xsd-1.7.0-1-i686-windows.zip have fun, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051207/f530e9d2/attachment.pgp From Sima.SHAH at rbos.com Tue Dec 13 08:41:25 2005 From: Sima.SHAH at rbos.com (SHAH, Sima, FM) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] Extracting Message-ID: <5BABED549FA0374BBBC0F5CC4DF9DB69DA4DB5@lon0355xns.fm.rbsgrp.net> Hi, I have an element defined as an xsi:type. To extract it, I need to do a dynamic cast which throws if not the correct type. Is there a way I can work out what the type is or a visitor pattern to allow me to call a function given the correct type. Thanks, Sima Shah tel: +44 (0)20 7085 6319 email: sima.shah@rbos.com *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: http://www.rbs.co.uk/CBFM http://www.rbsmarkets.com ******************************************************************************** From boris at codesynthesis.com Tue Dec 13 10:56:59 2005 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] Extracting In-Reply-To: <5BABED549FA0374BBBC0F5CC4DF9DB69DA4DB5@lon0355xns.fm.rbsgrp.net> References: <5BABED549FA0374BBBC0F5CC4DF9DB69DA4DB5@lon0355xns.fm.rbsgrp.net> Message-ID: <20051213155659.GA9665@karelia> Hi, SHAH, Sima, FM writes: > I have an element defined as an xsi:type. To extract it, I need to do a > dynamic cast which throws if not the correct type. > > Is there a way I can work out what the type is or a visitor pattern to allow > me to call a function given the correct type. You can use dynamic_cast on a pointer instead of a reference. In that case it will return 0 instead of throwing std::bad_cast. This is an effective way to test if SomeType is-a SomeOtherType. One extension that we are thinking about implementing is to allow you to specify native C++ base classes for XML Schema types. For example, suppose you have the following schema: And the person_base C++ class: struct person_base { ~person_base (); virtual ~print () = 0; }; The generated code for the above schema fragment could look like this: struct person: xml_schema::type, person_base { string name () const; }; struct superman: person { bool can_fly () const; }; Now, since print is pure virtual, you will need to implement those types: struct person_impl: person { virtual ~print () { cout << "person " << name (); } }; struct superman_impl: superman { virtual ~print () { cout << (can_fly () ? "flying superman " : "superman ") << name (); } }; There would also be a factory mechanism that will allow one to instruct parsing code to use person_impl and superman_impl for person and superman. Is anybody interested in such a feature? hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051213/60b81d9b/attachment.pgp From Sima.SHAH at rbos.com Tue Dec 13 11:22:35 2005 From: Sima.SHAH at rbos.com (SHAH, Sima, FM) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] Extracting Message-ID: <5BABED549FA0374BBBC0F5CC4DF9DB69DA4DB6@lon0355xns.fm.rbsgrp.net> We don't have access to the auto_pointer. The contents of the iterator return a reference. Is there a way to get to the pointer? Thanks, Sima P.S. Your new feature and factory mechanism idea is an excellent idea but we'd like to be able to do this for all classes not just subclasses. -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: 13 December 2005 15:57 To: SHAH, Sima, FM Cc: 'xsd-users@codesynthesis.com' Subject: Re: [xsd-users] Extracting Hi, SHAH, Sima, FM writes: > I have an element defined as an xsi:type. To extract it, I need to do > a dynamic cast which throws if not the correct type. > > Is there a way I can work out what the type is or a visitor pattern to > allow me to call a function given the correct type. You can use dynamic_cast on a pointer instead of a reference. In that case it will return 0 instead of throwing std::bad_cast. This is an effective way to test if SomeType is-a SomeOtherType. One extension that we are thinking about implementing is to allow you to specify native C++ base classes for XML Schema types. For example, suppose you have the following schema: And the person_base C++ class: struct person_base { ~person_base (); virtual ~print () = 0; }; The generated code for the above schema fragment could look like this: struct person: xml_schema::type, person_base { string name () const; }; struct superman: person { bool can_fly () const; }; Now, since print is pure virtual, you will need to implement those types: struct person_impl: person { virtual ~print () { cout << "person " << name (); } }; struct superman_impl: superman { virtual ~print () { cout << (can_fly () ? "flying superman " : "superman ") << name (); } }; There would also be a factory mechanism that will allow one to instruct parsing code to use person_impl and superman_impl for person and superman. Is anybody interested in such a feature? hth, -boris *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: http://www.rbs.co.uk/CBFM http://www.rbsmarkets.com ******************************************************************************** From boris at codesynthesis.com Tue Dec 13 11:42:01 2005 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] Extracting In-Reply-To: <5BABED549FA0374BBBC0F5CC4DF9DB69DA4DB6@lon0355xns.fm.rbsgrp.net> References: <5BABED549FA0374BBBC0F5CC4DF9DB69DA4DB6@lon0355xns.fm.rbsgrp.net> Message-ID: <20051213164201.GA10500@karelia> SHAH, Sima, FM writes: > We don't have access to the auto_pointer. The contents of the iterator > return a reference. Is there a way to get to the pointer? Sure, just do &. Here is the code snippet: for (...::iterator i = ...; ...; ++i) { base* b (&*i); if (derived1* d1 = dynamic_cast (b)) { // b is of derived1 type, adjusted pointer in in d1 } else if (derived2* d2 = dynamic_cast (b)) { // b is of derived2 type, adjusted pointer in in d2 } ... } > P.S. Your new feature and factory mechanism idea is an excellent idea but > we'd like to be able to do this for all classes not just subclasses. I am not quite sure what you mean here. Can you elaborate a little bit? The approach I described in the previous email allows one to specify native base class for any type defined in XML Schema. Maybe you want all types (including XML Schema built-in types such as string, token, etc.) to derive from you base class? hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051213/c4096c2e/attachment.pgp From chenchang19760717 at yahoo.com Mon Dec 19 05:40:11 2005 From: chenchang19760717 at yahoo.com (Chang Chen) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] can xsd compiled in cygwin environment? Message-ID: <20051219104011.60978.qmail@web30610.mail.mud.yahoo.com> Clean Clean DocumentEmail false false false MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} Hi compile xsd depends on build,and build deponds on 1 GNU make >= 3.81beta3 2 GNU bash >= 2.05a Unfortunately, I only can find the latest make version is3.80, is it ok? and my bash is 2.05 b , is it ok? Thanks Chang __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codesynthesis.com/pipermail/xsd-users/attachments/20051219/92cf19ca/attachment.html From boris at codesynthesis.com Tue Dec 20 01:57:18 2005 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] can xsd compiled in cygwin environment? In-Reply-To: <20051219104011.60978.qmail@web30610.mail.mud.yahoo.com> References: <20051219104011.60978.qmail@web30610.mail.mud.yahoo.com> Message-ID: <20051220065718.GA29365@karelia> Chang, Chang Chen writes: > Unfortunately, I only can find the latest make version is3.80, is it ok? No, you need 3.81beta3. I put it own for you on my personal page: http://codesynthesis.com/~boris/tmp/make-3.81beta3.tar.bz2 http://codesynthesis.com/~boris/tmp/make-3.81beta3.tar.bz2.sig > and my bash is 2.05 b , is it ok? Yes, this should be fine. Also note that xsd translator uses wide characters (wchar_t). Unfortunately, the stock libstd++ (Standard C++ Library that comes with g++) that comes with cygwin/mingw environment is compiled without support for wchar_t. You can read more about this here: http://www.mingw.org/MinGWiki/index.php/wide%20characters We use a custom-built linux-to-mingw g++ cross-compiler to build xsd for windows. I, however, suggest that you first give a try to the stock g++ with STLPort instead of libstdc++. You can get STLPort here: http://sourceforge.net/projects/stlport hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051220/1deb9151/attachment.pgp From Mark.BURGESS at rbos.com Fri Dec 23 06:53:00 2005 From: Mark.BURGESS at rbos.com (BURGESS, Mark, FM) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] Problem with duplicate Ids Message-ID: <55C5826684EBA046B491E70A8F7A99BC0DF237FC@lon0356xns.fm.rbsgrp.net> Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: RiskEngineXmlApiModel.h Type: application/octet-stream Size: 190659 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051223/6e4c34e4/RiskEngineXmlApiModel.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: RiskEngineXmlApi.cpp Type: application/octet-stream Size: 180799 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051223/6e4c34e4/RiskEngineXmlApi.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: RiskEngineXmlApi.h Type: application/octet-stream Size: 100178 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051223/6e4c34e4/RiskEngineXmlApi-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: RiskEngineXmlApiModel.cpp Type: application/octet-stream Size: 365848 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051223/6e4c34e4/RiskEngineXmlApiModel-0001.obj From boris at codesynthesis.com Fri Dec 23 10:46:08 2005 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] Problem with duplicate Ids In-Reply-To: <55C5826684EBA046B491E70A8F7A99BC0DF237FC@lon0356xns.fm.rbsgrp.net> References: <55C5826684EBA046B491E70A8F7A99BC0DF237FC@lon0356xns.fm.rbsgrp.net> Message-ID: <20051223154608.GA21210@karelia> Mark, BURGESS, Mark, FM writes: > I am trying to insert an ExecutionEnvironment with id = > "ExecutionEnvironment:2" and an ExecutionOperation with id = > "ExecutionOperation:3" and ExecutionEnvironmentRef = > "ExecutionEnvironment:2" into an ExecutionObjects but it throws a > xsd::cxx::tree::duplicate_id exception and no one here can figure out > why. The duplicate_id exception is thrown if you try to insert a duplicate ID into a document tree. XML Schema requires IDs to be unique in the context of a document. I looked at you code and I can't see right away where the duplication could happen (though note that it differs from what you described above, e.g., I don't see where you pass "ExecutionOperation:3"). I also cannot build and debug your code since it is not complete. What I suggest you do is catch this exception and print the ID that is causing the problem. This will hopefully give you some hints. If you still can't find the reason, it would be helpful if you could create a minimal example that reproduces the problem. > const ares::ExecutionEnvironment::_xsd_MarketDataContext::type_ BTW, you should use ares::ExecutionEnvironment::MarketDataContext::type instead of the above. All names that start with _xsd_ are for internal use and may change in a backwards-incompatible manner. This is also described in the manual: http://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/ See Section 2.8, "Mapping for Local Elements and Attributes". hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051223/800bfdbb/attachment.pgp From Mark.BURGESS at rbos.com Fri Dec 23 11:28:26 2005 From: Mark.BURGESS at rbos.com (BURGESS, Mark, FM) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] Problem with duplicate Ids Message-ID: <55C5826684EBA046B491E70A8F7A99BC0DF237FF@lon0356xns.fm.rbsgrp.net> Our firewall didn't like me including an exe in the zip file so I have resent without. Hopefully this one will get through... -----Original Message----- From: BURGESS, Mark, FM Sent: 23 December 2005 16:23 To: 'Boris Kolpackov'; BURGESS, Mark, FM Cc: 'xsd-users@codesynthesis.com'; SHAH, Sima, FM Subject: RE: [xsd-users] Problem with duplicate Ids Hi Boris, Thanks for taking a look. Sorry the initial question wasn't clear, I just cut and pasted the problem from my original code in case you could see immediately what I had done wrong. I have now created a cut down complete example which exhibits the same problem. If you could take a look I would appreciate it since I'm stumped on this one. Thanks, Mark. -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: 23 December 2005 15:46 To: BURGESS, Mark, FM Cc: 'xsd-users@codesynthesis.com'; SHAH, Sima, FM Subject: Re: [xsd-users] Problem with duplicate Ids Mark, BURGESS, Mark, FM writes: > I am trying to insert an ExecutionEnvironment with id = > "ExecutionEnvironment:2" and an ExecutionOperation with id = > "ExecutionOperation:3" and ExecutionEnvironmentRef = > "ExecutionEnvironment:2" into an ExecutionObjects but it throws a > xsd::cxx::tree::duplicate_id exception and no one here can > figure out why. The duplicate_id exception is thrown if you try to insert a duplicate ID into a document tree. XML Schema requires IDs to be unique in the context of a document. I looked at you code and I can't see right away where the duplication could happen (though note that it differs from what you described above, e.g., I don't see where you pass "ExecutionOperation:3"). I also cannot build and debug your code since it is not complete. What I suggest you do is catch this exception and print the ID that is causing the problem. This will hopefully give you some hints. If you still can't find the reason, it would be helpful if you could create a minimal example that reproduces the problem. > const ares::ExecutionEnvironment::_xsd_MarketDataContext::type_ BTW, you should use ares::ExecutionEnvironment::MarketDataContext::type instead of the above. All names that start with _xsd_ are for internal use and may change in a backwards-incompatible manner. This is also described in the manual: http://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/ See Section 2.8, "Mapping for Local Elements and Attributes". hth, -boris *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: http://www.rbs.co.uk/CBFM http://www.rbsmarkets.com ******************************************************************************** -------------- next part -------------- A non-text attachment was scrubbed... Name: scratch.zip Type: application/octet-stream Size: 65250 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051223/ce0debff/scratch.obj From boris at codesynthesis.com Mon Dec 26 05:16:04 2005 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] Problem with duplicate Ids In-Reply-To: <55C5826684EBA046B491E70A8F7A99BC0DF23800@lon0356xns.fm.rbsgrp.net> References: <55C5826684EBA046B491E70A8F7A99BC0DF23800@lon0356xns.fm.rbsgrp.net> Message-ID: <20051226101604.GA29197@karelia> Mark, BURGESS, Mark, FM writes: > I have now created a cut down complete example which exhibits the same > problem. Thanks for doing this. It was very helpful. This problem is an interesting one. Here is the relevant code snippet: ExecutionEnvironment executionEnvironment ("ExecutionEnvironment:2"); ExecutionOperation executionOperation ("ExecutionOperation:3", executionEnvironment.id ()); The second argument to ExecutionOperation's c-tor is of type xml_schema::ncname. executionEnvironment.id () returns an instance of the xml_schema::id type. xml_schema::id inherits from xml_schema::ncname. The problem arises from the fact that all containers in the document tree are polymorphism-aware . This means that they preserve dynamic types of objects rather than only static types (like std:: containers do). Here is what happens in the example above: the second argument to ExecutionOperation has static type ncname and dynamic type id. The c-tor implementation uses clone() function to make complete (dynamic) copy of the object. As a result we end up with another instance of id which contains "ExecutionEnvironment:2". Later when we try to insert executionOperation into the tree we end up with the duplicate_id exception because it conflicts with the executionEnvironment's id. I agree this is somewhat unexpected in this particular case and I am thinking of a way to make it less surprising. The fact that XML Schema allows polymorphic behavior on any type (via xsi:type) will make it hard to find a good solution to this problem. A simple workaround for this problem is to pass a temporary of ncname to ExecutionOperation c-tor, e.g., ExecutionOperation executionOperation ( "ExecutionOperation:3", xml_schema::ncname (executionEnvironment.id ())); Alternatively, you may want to change the type of the ref attribute from NCName to IDREF. hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051226/c3f9583d/attachment.pgp From boris at codesynthesis.com Thu Dec 29 07:19:07 2005 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] Re: description of the bug while running library example of the" w3c xml constructs to the c++" software In-Reply-To: References: Message-ID: <20051229121907.GA13163@karelia> Hi, Mohit.Hasija@relianceinfo.com writes: > i have posted this query because i could not get the relevant e- mail id > where i should post this bug. Please send all such queries to the xsd-users mailing list. See the support section for more information: http://codesynthesis.com/support/ > the bug description is as follows: > > driver.cxx: > *** error code 3: > driver.cxx,line 113 : Error: No parameters provided for template. > driver.cxx line 113: rror :unexpected type name ""encountered. > driver.cxxx line 113: badly formed expression. I assume you are compiling one of the examples. It would be helpful to know exactly which one. > the compiler used is CC > the platform is SUN solaris. Which version of Sun C++ are you using? I.e., what does 'CC -V' print? thanks, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051229/81ed2125/attachment.pgp From boris at codesynthesis.com Thu Dec 29 07:39:37 2005 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] Re: description of the bug while running library example of the" w3c xml constructs to the c++" software In-Reply-To: References: <20051229121907.GA13163@karelia> Message-ID: <20051229123937.GA13478@karelia> Mohit.Hasija@relianceinfo.com writes: > the following text gets printed:-- > > Sun WorkShop 6 update 2 C++ 5.3 Patch 111685-20 2004/03/19 We do not support this version of Sun C++. We only support versions 5.7 and 5.8. I suggest that you upgrade to Sun C++ 5.8 (Studio 11) especially since it is free (as in beer): http://www.sun.com/software/products/studio/get.xml hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051229/2e66d5a0/attachment.pgp From boris at codesynthesis.com Fri Dec 30 03:36:42 2005 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] Re: description of the bug while running library example of the" w3c xml constructs to the c++" software In-Reply-To: References: <20051229123937.GA13478@karelia> Message-ID: <20051230083642.GA16873@karelia> Hi, Could you please CC the xsd-users mailing list to your replies; this way other will be able to benefit from the information. Mohit.Hasija@relianceinfo.com writes: > we have updated the solaris version to 5.8. Did you upgrade the OS (Solaris) or the compiler? You need to upgrade the compiler to version 5.8 (Studio 11). Can you double check what gets printed when you execute CC -V? > then we compiled the code whose traces are as below: I did the same steps using Sun C++ 5.8 and everything works fine: $ ../../../../bin/xsd cxx-tree --generate-inline --generate-ostream --generate-serialization hello.xsd $ /opt/studio11/SUNWspro/bin/CC -V CC: Sun C++ 5.8 2005/10/13 $ /opt/studio11/SUNWspro/bin/CC -I../../../../libxsd -I/build/boris/xerces-c-src_2_6_0/include -c *.cxx driver.cxx: hello.cxx: $ I think you are still using an older version of the compiler. hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051230/9dc5b6f3/attachment.pgp From Mohit.Hasija at relianceinfo.com Fri Dec 30 07:04:45 2005 From: Mohit.Hasija at relianceinfo.com (Mohit.Hasija@relianceinfo.com) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] Re: description of the bug while running library example of the" w3c xml constructs to the c++" software In-Reply-To: <20051230083642.GA16873@karelia> Message-ID: dear Mr. Boris, below is the trace which shows the compiler version in use for compilation. -->also the makefile which has been provided in every folder does not work. it gives an 'unexpected end of line seen" error. at line no.2 -->please do reply the arguments need to be passed while generating xsd file. bash-2.05$ /opt/sunstd11/SUNWspro/bin/CC -V CC: Sun C++ 5.8 2005/10/13 bash-2.05$ /opt/sunstd11/SUNWspro/bin/CC -I../../../../libxsd *.cxx driver.cxx: hello.cxx: "hello.cxx", line 114: Error: Formal argument x of type const xsd::cxx::tree::string_template& in call to std::vector >::push_back(const xsd::cxx::tree::string_template&) is being passed std::auto_ptr>. 1 Error(s) detected. thanks mohit Boris Kolpackov cc: xsd-users@codesynthesis.com Subject: Re: description of the bug while running library example of the" 12/30/2005 02:06 w3c xml constructs to the c++" software PM Importance: Normal Sender's OU: Reliance |------------------| | [ ] Confidential | |------------------| Hi, Could you please CC the xsd-users mailing list to your replies; this way other will be able to benefit from the information. Mohit.Hasija@relianceinfo.com writes: > we have updated the solaris version to 5.8. Did you upgrade the OS (Solaris) or the compiler? You need to upgrade the compiler to version 5.8 (Studio 11). Can you double check what gets printed when you execute CC -V? > then we compiled the code whose traces are as below: I did the same steps using Sun C++ 5.8 and everything works fine: $ ../../../../bin/xsd cxx-tree --generate-inline --generate-ostream --generate-serialization hello.xsd $ /opt/studio11/SUNWspro/bin/CC -V CC: Sun C++ 5.8 2005/10/13 $ /opt/studio11/SUNWspro/bin/CC -I../../../../libxsd -I/build/boris/xerces-c-src_2_6_0/include -c *.cxx driver.cxx: hello.cxx: $ I think you are still using an older version of the compiler. hth, -boris From boris at codesynthesis.com Fri Dec 30 08:25:28 2005 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:42 2009 Subject: [xsd-users] Re: description of the bug while running library example of the" w3c xml constructs to the c++" software In-Reply-To: References: <20051230083642.GA16873@karelia> Message-ID: <20051230132528.GA19792@karelia> Hi, Mohit.Hasija@relianceinfo.com writes: > -->also the makefile which has been provided in every folder does not work. > it gives an 'unexpected end of line seen" error. at line no.2 Provided makefiles are for GNU make while you are probably using Sun make. I guess we need to mention that in the README. > bash-2.05$ /opt/sunstd11/SUNWspro/bin/CC -V > CC: Sun C++ 5.8 2005/10/13 > bash-2.05$ /opt/sunstd11/SUNWspro/bin/CC -I../../../../libxsd *.cxx > driver.cxx: > hello.cxx: > "hello.cxx", line 114: Error: Formal argument x of type const > xsd::cxx::tree::string_template& in call to > std::vector >::push_back(const > xsd::cxx::tree::string_template&) is being passed > std::auto_ptr>. Hm, that's mysterious. We use the same version of xsd and the same compiler. Which version of Xerces-C++ are you using (I assume it is installed into /usr or /usr/local since you did not specify any corresponding -I options)? Can you do the following for me: 1. Generate pre-processed source code for hello.cxx: $ /opt/sunstd11/SUNWspro/bin/CC -I../../../../libxsd -E hello.cxx >hello.i 2. Compress hello.i and send it to me directly (not to the list). thanks, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051230/799dec8d/attachment.pgp