From manav.rathi at incainformatics.com Mon Jun 2 00:26:33 2008 From: manav.rathi at incainformatics.com (Manav Rathi) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Accessors for sequences In-Reply-To: <20080530144447.GC2563@karelia> Message-ID: <20080602042652.E96D422F9E5@relay2.relay.sat.mlsrvr.com> > I guess we could add a bunch more options (we already have almost a > hundred options for the C++/Tree mapping so a few more, a few less, > I am sure nobody will notice ;-)). Why don't you yourself use XML for program options? Considering the fact that your tools enable hundreds to xml'ify their applications, it is kind of odd that xsd doesn't read XML input itself. And imagine how much fun it'd be for you to generate the input.xsd schema for xsd.exe using xsd.exe. But how will you specify the input for the first input.xsd? Hmm... > > --one-accessor-regex > --one-modifier-regex > > --opt-accessor-regex > --opt-modifier-regex > > --seq-accessor-regex > --seq-modifier-regex > > I've added this to my TODO list. If you would like to start using > these new options I can probably implement them on Monday and build > you a pre-release binary. Let me know if you would like that. Sure. No need to rush, though. > And thanks for the suggestion. You're welcome :) From k.karamazen at trinite.nl Mon Jun 2 09:28:44 2008 From: k.karamazen at trinite.nl (K.Karamazen) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] invalid byte 1 Message-ID: <1212413324.14189.3.camel@localhost.localdomain> When using schema found at: #http://www.datex2.eu/?q=node/45 xsd cxx-tree --generate- polymorphic /home/kk/var/xsd/datex2/DATEXIISchema_1_0_1_0.xsd /home/kk/var/xsd/datex2/DATEXIISchema_1_0_1_0.xsd:5822:182: error: An exception occurred! Type:UTFDataFormatException, Message:invalid byte 1 () of a 1-byte sequence. What is the problem. From boris at codesynthesis.com Mon Jun 2 10:04:21 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] invalid byte 1 In-Reply-To: <1212413324.14189.3.camel@localhost.localdomain> References: <1212413324.14189.3.camel@localhost.localdomain> Message-ID: <20080602140421.GA14692@karelia> Hi, K.Karamazen writes: > When using schema found at: > #http://www.datex2.eu/?q=node/45 > > xsd cxx-tree --generate- > polymorphic /home/kk/var/xsd/datex2/DATEXIISchema_1_0_1_0.xsd > > > /home/kk/var/xsd/datex2/DATEXIISchema_1_0_1_0.xsd:5822:182: error: An > exception occurred! Type:UTFDataFormatException, Message:invalid byte 1 > () of a 1-byte sequence. This error would normally mean that the compiler has encountered a character in your schema which is not valid according to the UTF-8 encoding rules. However, I tried to download the schema and was able to translate it to C++ with XSD 3.1.0 without any problems. I used the following command line: xsd cxx-tree --generate-polymorphic --namespace-map \ http://datex2.eu/schema/1_0/1_0=Datex2 DATEXIISchema_1_0_1_0.xsd I also looked at line 5822 in the schema and didn't see anything suspicious there. Perhaps your copy got corrupted somehow. Can you download a fresh copy from the website and try again? Boris From boris at codesynthesis.com Mon Jun 2 14:09:03 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Accessors for sequences In-Reply-To: <20080602042652.E96D422F9E5@relay2.relay.sat.mlsrvr.com> References: <20080530144447.GC2563@karelia> <20080602042652.E96D422F9E5@relay2.relay.sat.mlsrvr.com> Message-ID: <20080602180903.GA16563@karelia> Hi Manav, Manav Rathi writes: > Why don't you yourself use XML for program options? Considering the fact > that your tools enable hundreds to xml'ify their applications, it is kind > of odd that xsd doesn't read XML input itself. I am one of those people who believe that it isn't much fun to write XML by hand. And since we have no plans to create an XSD options editor ;-), a plain text format seems to be more user friendly. Compare: --generate-inline --generate-polymorphic --namespace-map http://www.example.com/foo=Foo http://www.example.com/foo=Foo > And imagine how much fun it'd be for you to generate the input.xsd schema > for xsd.exe using xsd.exe. But how will you specify the input for the first > input.xsd? Hmm... It is not going to be pretty... > > I've added this to my TODO list. If you would like to start using > > these new options I can probably implement them on Monday and build > > you a pre-release binary. Let me know if you would like that. > > Sure. No need to rush, though. Ok, I've added the options. Let me know which platform/CPU you are using and I will build you a pre-release binary to try it out. Boris From edgarszi at gmail.com Mon Jun 2 15:10:12 2008 From: edgarszi at gmail.com (Edgar Szilagyi) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Hello World, doesn't work. I need help. Message-ID: <48444594.6080508@gmail.com> Hi! Sorry about my wrong english. I have tried the Hello World sample with tree generator such as showed in documentation: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/ xsd cxx-tree hello.xsd And compilation commands. But, when I test it, I get: hello.xml:2:8 error: Unknown element 'hello' hello.xml:4:13 error: Unknown element 'greeting' hello.xml:6:9 error: Unknown element 'name' hello.xml:7:9 error: Unknown element 'name' hello.xml:8:9 error: Unknown element 'name' I'm running Ubuntu 8.04 64bits. LibXerces: 2.7 (I tried 2.8 too) g++: 4.2.3 On the other hand, a parser mode, instead of tree, works perfectly. Anyone had this problem? Can anyone help-me? Thanks. Edgar From boris at codesynthesis.com Mon Jun 2 16:39:41 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Hello World, doesn't work. I need help. In-Reply-To: <48444594.6080508@gmail.com> References: <48444594.6080508@gmail.com> Message-ID: <20080602203941.GA17043@karelia> Hi Edgar, Edgar Szilagyi writes: > hello.xml:2:8 error: Unknown element 'hello' > hello.xml:4:13 error: Unknown element 'greeting' > hello.xml:6:9 error: Unknown element 'name' > hello.xml:7:9 error: Unknown element 'name' > hello.xml:8:9 error: Unknown element 'name' This is normally caused by the schema file not being found. For more information see Q 2.1, 2.2, and 2.3 in the C++/Tree Mapping FAQ: http://wiki.codesynthesis.com/Tree/FAQ Boris From pjullien at sopragroup.com Tue Jun 3 11:09:38 2008 From: pjullien at sopragroup.com (Jullien Patrick) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Using xml_schema::date Message-ID: <20080603150936.5FCC3D1C0C9@mailgw1.z-ancy-11.fr.sopragroup.com> Hi Boris, I assume that some changes have been made about datetime support in XSD, I have an xml schema containing some date attributes and the mapping classes generated with 3.1.x version of XSD is pretty much different that ones generated by 3.0.x You have added a date-time.hxx file into xsd/cxx/tree directory containing classes (timezone, date, date_time, etc.) that were defined in types.hxx, but the old xml_schema::date(string) constructor is no more available. Can you please give me the best practices for using this new type ? How one should parse strings for constructing these new objetcs to conform to [YYYY-mm-dd] standard xml date-format string (and go back to string from an xml_schema::date object) ? Is the date(int year, unsigned short month, unsigned short day) constructor mandatory (i.e obligation to substr and convert the input strings to right types) ? Thanks a lot, Cordially Patrick -------------- next part -------------- A non-text attachment was scrubbed... Name: Jullien Patrick.vcf Type: text/x-vcard Size: 302 bytes Desc: Jullien Patrick.vcf Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20080603/8aeb2481/JullienPatrick.vcf From atteeela at gmail.com Tue Jun 3 14:14:17 2008 From: atteeela at gmail.com (Attila) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Binding to references/links Message-ID: <4aeb04aa0806031114x2944cf83ya8021938f938847f@mail.gmail.com> Hi, I am wondering if it is possible to reference (xlink?) other elements in an XML document and have CS XSD pick up the link and bind to these elements? Jones Hello World Is it possible to do something like this? (book b1) book->author->name Thanks! From sbalasub at qualcomm.com Tue Jun 3 14:16:24 2008 From: sbalasub at qualcomm.com (Balasubramanyam, Shivakumar) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] XSD element with name as type Message-ID: Boris, Using XSD 3.1, we are seeing issues where the generated code for XSD element with name = type conflicts with xml_schema::type. How do we resolve this? ClassificationScheme:: ClassificationScheme (const ::xml_schema::type& type, const uri_type& uri, const type_type& type) : ::mpeg7::ClassificationSchemeType (type,uri),type_ (type, ::xml_schema::flags (), this) { } This causes a failure at compilation: generated_files/config_flow_messages.cpp: In constructor `ClassificationScheme::ClassificationScheme(const xml_schema::type&, const xml_schema::uri&,const xml_schema::string&)': generated_files/config_flow_messages.cpp:1441: error: conflicting declaration 'const xml_schema::type&type' generated_files/config_flow_messages.cpp:1441: error: 'type' has a previous declaration as `const xml_schema::string&type' generated_files/config_flow_messages.cpp:1441: error: declaration of `const xml_schema::type&type' generated_files/config_flow_messages.cpp:1441: error: conflicts with previous declaration `const xml_schema::string&type' The "::xml_schema::type& type" is based on XSD's naming convention while "const type_type& type" comes from my schema having a tag named "type". In 3.6 version of xsd, the code generated is: ClassificationScheme:: ClassificationScheme (const ::xml_schema::type& anyType,const uri_type& uri,const type_type& type):mpeg7::ClassificationSchemeType (anyType,uri),type_ (type, ::xml_schema::flags (), this) { } This is with the same set of xsd options and the same code. Thanks, Shiva From sbalasub at qualcomm.com Tue Jun 3 14:19:17 2008 From: sbalasub at qualcomm.com (Balasubramanyam, Shivakumar) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] DOM parser for embedded environment Message-ID: Boris, I understand that XSD/e is available for embedded platform which uses the SAX parser. Is there one available for DOM? Thanks, Shiva From boris at codesynthesis.com Tue Jun 3 14:45:28 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Binding to references/links In-Reply-To: <4aeb04aa0806031114x2944cf83ya8021938f938847f@mail.gmail.com> References: <4aeb04aa0806031114x2944cf83ya8021938f938847f@mail.gmail.com> Message-ID: <20080603184528.GB24133@karelia> Hi Attila, Attila writes: > I am wondering if it is possible to reference (xlink?) other elements in an > XML document and have CS XSD pick up the link and bind to these elements? It is possible to achieve this with ID/IDREF XML Schema types. For more information see the library example as well as Section 2.5.5, "Mapping for IDREF" in the C++/Tree Mapping User Manual: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.5.5 Boris From boris at codesynthesis.com Tue Jun 3 15:52:13 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] XSD element with name as type In-Reply-To: References: Message-ID: <20080603195213.GD24133@karelia> Hi Shiva, Balasubramanyam, Shivakumar writes: > ClassificationScheme (const ::xml_schema::type& type, const uri_type& > uri, const type_type& type) I have managed to create a test case that reproduces the problem. This is definitely a bug in XSD. When I have a fix, would you like a binary with it? If so, please let me know which platform and CPU architecture you need. Thanks for reporting this! Boris From boris at codesynthesis.com Tue Jun 3 15:59:33 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] DOM parser for embedded environment In-Reply-To: References: Message-ID: <20080603195933.GE24133@karelia> Hi Shiva, Balasubramanyam, Shivakumar writes: > I understand that XSD/e is available for embedded platform which uses > the SAX parser. Is there one available for DOM? We don't provide a DOM implementation with XSD/e (usually, for embedded systems, a stream-oriented representation like SAX is more suitable that an in-memory representation like DOM due to memory constraints). Perhaps what you are looking for in XSD/e is an in-memory mapping like C++/Tree? If that's the case then there is no such mapping currently but we are working on one. It, however, still won't use DOM underneath and will be more lighter-weight compared to C++/Tree but it will be quite similar. Boris From sbalasub at qualcomm.com Tue Jun 3 16:12:33 2008 From: sbalasub at qualcomm.com (Balasubramanyam, Shivakumar) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] XSD element with name as type In-Reply-To: <20080603195213.GD24133@karelia> References: <20080603195213.GD24133@karelia> Message-ID: Boris, We need this for Linux 32 bit machine. Sure, I can use a binary. If it works, can you please provide the patch for us? Thanks, Shiva -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Tuesday, June 03, 2008 12:52 PM To: Balasubramanyam, Shivakumar Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] XSD element with name as type Hi Shiva, Balasubramanyam, Shivakumar writes: > ClassificationScheme (const ::xml_schema::type& type, const uri_type& > uri, const type_type& type) I have managed to create a test case that reproduces the problem. This is definitely a bug in XSD. When I have a fix, would you like a binary with it? If so, please let me know which platform and CPU architecture you need. Thanks for reporting this! Boris From sbalasub at qualcomm.com Tue Jun 3 16:17:34 2008 From: sbalasub at qualcomm.com (Balasubramanyam, Shivakumar) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] DOM parser for embedded environment In-Reply-To: <20080603195933.GE24133@karelia> References: <20080603195933.GE24133@karelia> Message-ID: Boris, In most cases, the documents are small even in embedded platform. It will very useful for us to have a DOM like interface. SAX makes sense only for large documents. But if XSD is used for messaging, then it becomes very useful to use the DOM parser. Do you have any timeline for this feature? Compared to C++/Tree, some features that need to be eliminated are boost dependency, exceptions, optimal template usage. I will be interested in understanding the features you are planning to support. Thanks, Shiva -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Tuesday, June 03, 2008 1:00 PM To: Balasubramanyam, Shivakumar Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] DOM parser for embedded environment Hi Shiva, Balasubramanyam, Shivakumar writes: > I understand that XSD/e is available for embedded platform which uses > the SAX parser. Is there one available for DOM? We don't provide a DOM implementation with XSD/e (usually, for embedded systems, a stream-oriented representation like SAX is more suitable that an in-memory representation like DOM due to memory constraints). Perhaps what you are looking for in XSD/e is an in-memory mapping like C++/Tree? If that's the case then there is no such mapping currently but we are working on one. It, however, still won't use DOM underneath and will be more lighter-weight compared to C++/Tree but it will be quite similar. Boris From keith.c.wire at lmco.com Tue Jun 3 18:57:38 2008 From: keith.c.wire at lmco.com (Wire, Keith C) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Undefined Symbol Message-ID: Hi, I'm trying to build the hello world example for xsd. Generating the code is fine and have built and tested Xerces-C 2.8.0. using CC on solaris 10. when I try to compile the generated code I get an undefined symbol error "xerces_2_8::XMLPlatformUtils::Initialize(....) hello.o" I'm running > CC -I(path to libxsd)/libxsd -I$XERCESCROOT/include -c driver.cxx hello.cxx > CC -o driver driver.o hello.o -L$XERCESCROOT/lib I have been following the "Getting Started Guide" but have run into this error. Any ideas? Thanks, Keith From manav.rathi at incainformatics.com Tue Jun 3 08:38:35 2008 From: manav.rathi at incainformatics.com (Manav Rathi) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Accessors for sequences Message-ID: <20080603123958.3E79B219D7B@relay1.relay.sat.mlsrvr.com> > The new options are: > > --one-accessor-regex > --opt-accessor-regex > --seq-accessor-regex > > --one-modifier-regex > --opt-modifier-regex > --seq-modifier-regex > > They work similar to --accessor-regex and --modifier-regex but are > applied to corresponding cardinalities only. See the NAMING CONVENTION > section in documentation/xsd.xhtml for more information. A few questions, Boris. 1. I am using xsd-3.1.0-i686-windows. If I just pop in the new binary to the bin directory, will it work (or do I need to replace the entire directory tree). I ask this because it'll be extremely difficult for me to replace upgrade the entire xsd tree (multiple developers + source safe + this not being a stable version). (Note: It seems to work. I just want your sanction) 2. This is what I am using (ditto for modifiers). --seq-accessor-regex "/(\w+?\b)/$1s/" --seq-accessor-regex "/(\w+?s\b)/$1_s/" There are two regexes so that names ending with s are prefixed with _s. Is this okay? 3. The docs say "...After the initial name component, up to two additional name components can be present, separated by commas." What are these, and should I worry about them? 4. Offtopic. I noticed that the binary itself is ~ 21 MB. That's huge (although it is not a problem). Is it because of templates, or are you statically linking to something, or is it just that big. Just curious. -Manav From manav.rathi at incainformatics.com Tue Jun 3 08:46:57 2008 From: manav.rathi at incainformatics.com (Manav Rathi) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Accessors for sequences Message-ID: <20080603124756.EC6C7219E41@relay1.relay.sat.mlsrvr.com> > > 1. I am using xsd-3.1.0-i686-windows. If I just pop in the new binary to > the bin directory, will it work (or do I need to replace the entire > directory tree). I ask this because it'll be extremely difficult for me to > replace upgrade the entire xsd tree (multiple developers + source safe + > this not being a stable version). > > (Note: It seems to work. I just want your sanction) > Oops! Forgot to mention that I also replaced version.hxx. From boris at codesynthesis.com Wed Jun 4 03:54:21 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Accessors for sequences In-Reply-To: <20080603123958.3E79B219D7B@relay1.relay.sat.mlsrvr.com> References: <20080603123958.3E79B219D7B@relay1.relay.sat.mlsrvr.com> Message-ID: <20080604075421.GB26209@karelia> Hi Manav, Manav Rathi writes: > 1. I am using xsd-3.1.0-i686-windows. If I just pop in the new binary to the > bin directory, will it work (or do I need to replace the entire directory > tree). I ask this because it'll be extremely difficult for me to replace > upgrade the entire xsd tree (multiple developers + source safe + this not > being a stable version). > > (Note: It seems to work. I just want your sanction) Yes, I checked the difference between 3.1.0 and 3.1.1.a5 in libxsd and it should be possible to use the XSD binary from 3.1.1.a5 with the runtime from 3.1.0. > 2. This is what I am using (ditto for modifiers). > --seq-accessor-regex "/(\w+?\b)/$1s/" > --seq-accessor-regex "/(\w+?s\b)/$1_s/" > There are two regexes so that names ending with s are prefixed with _s. > Is this okay? Yes, this should do it (I don't think \b is really necessary). > 3. The docs say "...After the initial name component, up to two additional > name components can be present, separated by commas." > What are these, and should I worry about them? In certain situations XSD needs to generate compound names that don't come from the schema. For example, any_attribute for the anyAttribute wildcards. It passes such names to the regex as any,attribute to allow you to transform them (e.g., any_attribute, anyAttribute, getAnyAttribute, etc). However, there are no such compound names passed to the --seq-* regex so you don't need to worry about them. > 4. Offtopic. I noticed that the binary itself is ~ 21 MB. That's huge > (although it is not a problem). Is it because of templates, or are you > statically linking to something, or is it just that big. Just curious. The binary is statically linked to everything except the C runtime (that includes Xerces-C++, Boost, C++ runtime, etc.). This way you can use it on any machine. It also contains the symbol information (though no debug information) so that if the compiler crashes and dumps core one can view and report the stack trace. However since there is no concept of core on Windows, it does not make much sense to keep the symbols around and we should strip them for this platform. The stripped Windows binary is 9MB. Boris From boris at codesynthesis.com Wed Jun 4 04:16:56 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Re: Using xml_schema::date In-Reply-To: <20080603150936.5FCC3D1C0C9@mailgw1.z-ancy-11.fr.sopragroup.com> References: <20080603150936.5FCC3D1C0C9@mailgw1.z-ancy-11.fr.sopragroup.com> Message-ID: <20080604081656.GC26209@karelia> Hi Jullien, Jullien Patrick writes: > I assume that some changes have been made about datetime support in XSD, > I have an xml schema containing some date attributes and the mapping > classes generated with 3.1.x version of XSD is pretty much different > that ones generated by 3.0.x Right. Here is a fragment from the NEWS file: New implementations of the XML Schema date/time types (date, dateTime, duration, gDay, gMonth, gMonthDay, gYear, gYearMonth, and time) that represent the information in the numerical form. > You have added a date-time.hxx file into xsd/cxx/tree directory > containing classes (timezone, date, date_time, etc.) that were defined > in types.hxx, but the old xml_schema::date(string) constructor is no > more available. Can you please give me the best practices for using this > new type ? The old implementation was just a glorified string. The new one uses numeric representation. The xml_schema::date class now has the following two constructors: date (int year, unsigned short month, unsigned short day); date (int year, unsigned short month, unsigned short day, short zone_hours, short zone_minutes); So you would create a date instance like this: date today (2008, 6, 4); date tomorrow (2008, 6, 5, -2, -30); // GMT-2:30 For more information about the new date/time types see Section 2.5, "Mapping for Built-in Data Types" in the C++/Tree Mapping User Manual: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.5 > How one should parse strings for constructing these new objetcs to > conform to [YYYY-mm-dd] standard xml date-format string (and go back to > string from an xml_schema::date object)? While our intention was for the user to use the numeric representation as shown above, you can use the parsing constructor and ostream operator (requires the --generate-ostream option) to achieve this: date today ("2008-06-04", 0); std::ostringstream ostr; ostr << today; std::string today_str = ostr.str (); Boris From boris at codesynthesis.com Wed Jun 4 04:27:31 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Undefined Symbol In-Reply-To: References: Message-ID: <20080604082731.GA26544@karelia> Hi Keith, Wire, Keith C writes: > When I try to compile the generated code I get an undefined > symbol error "xerces_2_8::XMLPlatformUtils::Initialize(....) hello.o" > > I'm running > > > CC -I(path to libxsd)/libxsd -I$XERCESCROOT/include -c driver.cxx > hello.cxx > > > CC -o driver driver.o hello.o -L$XERCESCROOT/lib > You forgot to add -lxerces-c to the link line: CC -o driver driver.o hello.o -L$XERCESCROOT/lib -lxerces-c You can also use the makefiles that come with the hello and other examples: $ cd ../examples/cxx/tree/hello $ gmake CPPFLAGS=-I$XERCESCROOT/include LDFLAGS=-L$XERCESCROOT/lib Boris From manav.rathi at incainformatics.com Wed Jun 4 06:43:43 2008 From: manav.rathi at incainformatics.com (Manav Rathi) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Accessors for sequences In-Reply-To: <20080604075421.GB26209@karelia> Message-ID: <20080604104435.9C86B20EFE0@relay3.relay.sat.mlsrvr.com> > > 2. This is what I am using (ditto for modifiers). > > --seq-accessor-regex "/(\w+?\b)/$1s/" > > --seq-accessor-regex "/(\w+?s\b)/$1_s/" > > There are two regexes so that names ending with s are prefixed with _s. > > Is this okay? > > Yes, this should do it (I don't think \b is really necessary). You're right. Also, instead of appending 's' for normal sequences and '_s' for sequences with plural names, I am not simply appending '_list' to all sequences. So my regexes are now: --seq-accessor-regex /(\w+)/$1_list/ --seq-modifier-regex /(\w+)/$1_list/ P.S. if anyone has a better naming mechanism, please do let me know. From boris at codesynthesis.com Wed Jun 4 07:41:31 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] DOM parser for embedded environment In-Reply-To: References: <20080603195933.GE24133@karelia> Message-ID: <20080604114131.GB29282@karelia> Hi Shiva, Balasubramanyam, Shivakumar writes: > Do you have any timeline for this feature? We are planning to release the first version of XSD/e with the C++/Tree-like mapping (working name C++/Hybrid) by the end of October. We may have something for you to try (e.g., a beta version) around mid-September. > Compared to C++/Tree, some features that need to be eliminated > are > boost dependency Actually, C++/Tree mapping does not depend on boost. There are some integration points (e.g., binary serialization) but they are optional. > exceptions Yes, we plan to make the use of C++ exceptions optional just like in our other mappings provided by XSD/e. > optimal template usage This is actually a feature that we are trying to decide whether to rely on or not so your feedback is very much appreciated. Right now it seems that it would be just too much inconvenience not to use it in specific cases (notably to implement sequences and smart pointers). Do you use C++ templates in your embedded projects? If so, do you rely on implicit or explicit instantiation? It should be fairly straightforward for the XSD/e compiler to auto-generate explicit template instantiation requests. > I will be interested in understanding the features you are planning > to support. The C++/Hybrid will be based on Embedded C++/Parser for parsing and Embedded C++/Serializer for serialization. Because these two mappings support validation in the generated code, C++/Hybrid will also have this feature. In essence C++/Hybrid will consist of there parts: C++ object model classes, parser implementations based on C++/Parser and serializer implementations based on C++/Serializer. You will probably be happy to know that the C++ object model will be completely detached from parsing and serialization code ;-) We are planning to make the C++ object model lighter-weight compared to C++/Tree based on some of the techniques of the CORBA IDL to C++ mapping (used quite extensively in embedded systems). For example, we will have a notion of variable and fixed length types with the fixed-length ones being embedded and passed around by value instead of being allocated on the heap, for example: class point { float x; float y; }; class triangle { point a, b, c; }; We are also planning to use a different mapping for certain choice and sequence constructs. For example: Will be mapped to something along these lines: class foo { class sequence_element { int bar (); int baz (); }; typedef xsde::sequence sequence_type; sequence_type& sequence (); }; Later we will most likely port over other C++/Tree features that make sense in the embedded environment, such as binary serialization, type customization, etc. Also let me know if there is any particular feature that you are interested in and we will keep it in mind. Boris From pjullien at sopragroup.com Wed Jun 4 11:43:05 2008 From: pjullien at sopragroup.com (Jullien Patrick) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Error with sequences using xsd 3.1.x Message-ID: <20080604154306.E1EF3D1C0EE@mailgw1.z-ancy-11.fr.sopragroup.com> Hi Boris, I have migrated our xsd installation to version 3.1.0, thank you for your tip on dealing with dates. I'm in front of another problem using sequences, my program stops with a segfault while calling the sequence_common(const sequence_common&v, flags f, container *c) when it calls the _clone method. Because of the migration of xsd, I don't know if the bug is mine or not. Because of the high volume of xsd and source data, I don't what to give you to point where the problem is... My xsd contains this complex type: ... The complex type descripEnregistrementType is composed like this: ... The one and only root element is that one: The mapping files descripteurDonnees.[ch]xx are generated using cxx with cxx-tree mode and --generate-ostream --generate-serialization --root-element-all The descripteurDonnees.cxx contains a method for getting the descripEnregistrement_sequence reference: descripDonneesType::descripEnregistrement_sequence& descripDonneesType::descripEnregistrement() { return this->descripEnregistrement; } In one of my classes, I try to get the reference like this: descripDonneesType::descripEnregistrement_sequence seqEnr = m_pDescripDonnees->descripEnregistrement() The m_pDescripDonnees is a valid pointer to an instance of the descripteurDonnees class (containing true data issued from my data file, I assume correctly parsed and validated), but this call fails in the file containers.hxx in the loop over base_const_iterator i(v.v_.begin(), e(v.v_.end()); i!=e; ++i) Any idea(s) ? Did you ever encoutered such problems ? Cordially, Patrick From boris at codesynthesis.com Wed Jun 4 11:48:19 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Re: Error with sequences using xsd 3.1.x In-Reply-To: <20080604154306.E1EF3D1C0EE@mailgw1.z-ancy-11.fr.sopragroup.com> References: <20080604154306.E1EF3D1C0EE@mailgw1.z-ancy-11.fr.sopragroup.com> Message-ID: <20080604154819.GB3383@karelia> Hi Jullien, Jullien Patrick writes: > Any idea(s) ? Did you ever encoutered such problems ? No, nothing like this has been reported so far and I am sure a lot of people perform this kind of operations. So there must be something special about your particular case. Will you be able to send (off- list, directly to me) your test application so that I could take a look? Thanks, Boris From sbalasub at qualcomm.com Wed Jun 4 13:24:19 2008 From: sbalasub at qualcomm.com (Balasubramanyam, Shivakumar) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] DOM parser for embedded environment In-Reply-To: <20080604114131.GB29282@karelia> References: <20080603195933.GE24133@karelia> <20080604114131.GB29282@karelia> Message-ID: Boris, You rock :-) I really like the road map you have for the embedded platform. I recently have started investigating the embedded platform development and hence my interest in code synthesis. I will be more than glad to provide any input from my side. I will provide the feedback about templates once I get better idea of the requirements of our platform. I would also be interested to use your tool in phases if you do have. For instance, if you provide us object creation and objection serialization, that itself would be great for us. We can wait for the validation as second phase integration. Actually, we do have one special requirement for backward capability which is to ignore any unexpected elements (it will be great to provide a turn on/off for this kind of validation). AFAIK, if you get an unexpected exception, you do not continue to parse and provide only the expected elements. Yes, I really like the separation of C++ and Serialization; the use cases for this are limitless. I hope this is ported to all products. I was going to respond to your earlier email regarding WSDL. If you provide clean separation, then WSDL 2.0 logical part could be a combination of XSD generated C++ classes (of messages) and framework of factory classes compliant with this spec below, http://www.omg.org/docs/ptc/06-08-01.pdf. I guess this is far fetched but that would be really great for applications to be totally unaware of binding services. (this is useful even for implementation to be direct meaning a simple function call within the process) IMO, the future application programming interface would be WSDL. I think it is not just limited to Web Services, since the binding could be anything (even direct interface implementation). It should be ASDL (Application services) :-). Thanks, Shiva -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Wednesday, June 04, 2008 4:42 AM To: Balasubramanyam, Shivakumar Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] DOM parser for embedded environment Hi Shiva, Balasubramanyam, Shivakumar writes: > Do you have any timeline for this feature? We are planning to release the first version of XSD/e with the C++/Tree-like mapping (working name C++/Hybrid) by the end of October. We may have something for you to try (e.g., a beta version) around mid-September. > Compared to C++/Tree, some features that need to be eliminated > are > boost dependency Actually, C++/Tree mapping does not depend on boost. There are some integration points (e.g., binary serialization) but they are optional. > exceptions Yes, we plan to make the use of C++ exceptions optional just like in our other mappings provided by XSD/e. > optimal template usage This is actually a feature that we are trying to decide whether to rely on or not so your feedback is very much appreciated. Right now it seems that it would be just too much inconvenience not to use it in specific cases (notably to implement sequences and smart pointers). Do you use C++ templates in your embedded projects? If so, do you rely on implicit or explicit instantiation? It should be fairly straightforward for the XSD/e compiler to auto-generate explicit template instantiation requests. > I will be interested in understanding the features you are planning > to support. The C++/Hybrid will be based on Embedded C++/Parser for parsing and Embedded C++/Serializer for serialization. Because these two mappings support validation in the generated code, C++/Hybrid will also have this feature. In essence C++/Hybrid will consist of there parts: C++ object model classes, parser implementations based on C++/Parser and serializer implementations based on C++/Serializer. You will probably be happy to know that the C++ object model will be completely detached from parsing and serialization code ;-) We are planning to make the C++ object model lighter-weight compared to C++/Tree based on some of the techniques of the CORBA IDL to C++ mapping (used quite extensively in embedded systems). For example, we will have a notion of variable and fixed length types with the fixed-length ones being embedded and passed around by value instead of being allocated on the heap, for example: class point { float x; float y; }; class triangle { point a, b, c; }; We are also planning to use a different mapping for certain choice and sequence constructs. For example: Will be mapped to something along these lines: class foo { class sequence_element { int bar (); int baz (); }; typedef xsde::sequence sequence_type; sequence_type& sequence (); }; Later we will most likely port over other C++/Tree features that make sense in the embedded environment, such as binary serialization, type customization, etc. Also let me know if there is any particular feature that you are interested in and we will keep it in mind. Boris From Nick.John at ActivIdentity.com Fri Jun 6 02:53:24 2008 From: Nick.John at ActivIdentity.com (Nick John) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Binding to referenced objects when using key/keyref Message-ID: Hi, Is there a command line option which will cause the creation of code to manage key/keyref items similar to that of ID/IDREF ? (ie, adding new items will check items for unique key, access keyref will provide pointer to item with matching key) ID/IDREF being the old form of key (initially from DTD) which is globally unique within a schema, and key/keyref being the new format to be able to specify identifiers unique within a portion of the schema. Also, is there any form of ID generation code being created that we have overlooked? For instance to create an ID for a new element we have been going to the root node and calling _lookup_id() to ask if the id exists until we find one that does not. Cheers, Nick Nicholas John ActivIdentity 7 Phipps Close , Deakin , ACT Tel: +61 2 6208 4866 http://www.actividentity.com The information contained in this email message may be privileged, confidential and protected from disclosure. If you are not the intended recipient, any dissemination, distribution or copying is strictly prohibited. If you think that you have received this email message in error, please notify the sender by reply email and delete the message and any attachments. From boris at codesynthesis.com Fri Jun 6 03:21:29 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Binding to referenced objects when using key/keyref In-Reply-To: References: Message-ID: <20080606072129.GC22216@karelia> Hi Nick, Nick John writes: > Is there a command line option which will cause the creation of code to > manage key/keyref items similar to that of ID/IDREF ? > > (ie, adding new items will check items for unique key, access keyref > will provide pointer to item with matching key) No there is no such mapping at the moment. We thought of creating something like this, however, there is one problem: the key/unqiue/keyref constructs are defined in an element, not in a type. As a result, it is not clear where to place the mapping for them. For local elements we could use the outer type but for global elements (which are translated to parsing/serialization functions), it is not clear where to place the mapping. Making it global does not seem to be a good idea since then the constraint will be shared across all instances of a document (it is also not clear how to associate such a global data with instances that are created programmatically). Even if we solved this problem, the general-purpose solution would require a substantial effort since we would need support for mapping XPath expressions to members in the object model. This gets tricky very quickly once you start considering optional and sequences of elements. Overall, this relatively seldom used feature does not seem to be worth the effort. > Also, is there any form of ID generation code being created that we have > overlooked? For instance to create an ID for a new element we have been > going to the root node and calling _lookup_id() to ask if the id exists > until we find one that does not. No, there is no such support. Normally, IDs have some meaning and are assigned by the application. Your approach of using _lookup_id() is fine if a bit slow in case you have a large number of IDs. An alternative would be to customize the root type of your vocabulary (or even xml_schema::type) and implement ID generation logic there using a counter of something along these lines. Boris From jan.noorland at iff.com Fri Jun 6 07:40:57 2008 From: jan.noorland at iff.com (jan.noorland@iff.com) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Serialization and extended ascii characters. Message-ID: Hi, I'm trying to serialize an object model to XML where one of the string values can contain extended ascii characters Example: Instant?neas The serialization code throws an exception on the ? character. Is there a way to solve this? * * * * * * * * * * This communication contains information of International Flavors & Fragrances (IFF) and/or its affiliates that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended only for the addressee. Any copying, dissemination or other use of this information by anyone other than the intended recipient is prohibited. If you have received this communication in error, please contact the sender and delete it from your system. From boris at codesynthesis.com Fri Jun 6 08:16:41 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Serialization and extended ascii characters. In-Reply-To: References: Message-ID: <20080606121641.GA31713@karelia> Hi Jan, jan.noorland@iff.com writes: > I'm trying to serialize an object model to XML where one of the string > values > can contain extended ascii characters > > Example: Instant?neas > > The serialization code throws an exception on the ? character. > > Is there a way to solve this? I tend to think (without knowing which exception is thrown) that this is happening because XSD-generated code with character type 'char' expects the text in UTF-8 encoding. So you will need to make sure that the '?' character in your string is encoded as UTF-8 multibyte sequence. Alternatively, you can try to instruct the generated code to assume that text is in the local code page by compiling your application with XSD_USE_LCP macro defined. This approach, however, is not portable in the sense that you cannot control the local code page on some platforms (notably, Windows). For more information see Q 1.2 in the C++/Tree Mapping FAQ: http://wiki.codesynthesis.com/Tree/FAQ Boris From jan.noorland at iff.com Fri Jun 6 08:50:13 2008 From: jan.noorland at iff.com (jan.noorland@iff.com) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Serialization and extended ascii characters. In-Reply-To: <20080606121641.GA31713@karelia> Message-ID: Hi Boris, Thanks for your response. My code is build with Visual C++ 2003 and the input data is defined as char. The character is a valid ISO Latin-1 character (? = 0xE1). Exception: SEHException StackTrace: at _CxxThrowException(Void* , _s__ThrowInfo* ) at xsd.cxx.xml.bits.char_transcoder.from(SByte* s, UInt32 length) in c:\program files\codesynthesis xsd 3.1\include\xsd\cxx\xml\string.txx:line 289 at xsd.cxx.xml.transcode_to_xmlch(basic_string,std::allocator >* s) in c:\program files\codesynthesis xsd 3.1\include\xsd\cxx\xml\string.ixx:line 117 at xsd.cxx.xml.string.__ctor(string* , basic_string,std::allocator >* s) in c:\program files\codesynthesis xsd 3.1\include\xsd\cxx\xml\string.hxx:line 59 at xercesc_2_8.operator<<(DOMElement* e, basic_string,std::allocator >* s) in c:\program files\codesynthesis xsd 3.1\include\xsd\cxx\tree\serialization.txx:line 55 at xsd.cxx.tree.bits.insert > >(DOMElement* e, string >* x) in c:\program files\codesynthesis xsd 3.1\include\xsd\cxx\tree\serialization.txx:line 211 at xsd.cxx.tree.operator<< >(DOMElement* e, string >* x) in c:\program files\codesynthesis xsd 3.1\include\xsd\cxx\tree\serialization.txx:line 231 at xi.npi.<<(DOMElement* e, ProjectDescription* i) in d:\data\source\.net\c++\submissiontest\submission.cxx:line 1700 at xi.npi.<<(DOMElement* e, SubmissionType* i) in d:\data\source\.net\c++\submissiontest\submission.cxx:line 1586 at xi.npi.Submission(DOMDocument* d, SubmissionType* s, flags __unnamed002) in d:\data\source\.net\c++\submissiontest\submission.cxx:line 1478 at xi.npi.Submission(auto_ptr* , SubmissionType* s, namespace_infomap* m, flags f) in d:\data\source\.net\c++\submissiontest\submission.cxx:line 1503 at sendSubmissiontoXI(SByte* text1, SByte* text2) in d:\data\source\.net\c++\submissiontest\submissiontest.cpp:line 157" String* Does it imply that I need to use the --char-type wchar_t parameter to regenerate the XSD code? Thanks, Jan. Boris Kolpackov 06/06/2008 02:20 PM To jan.noorland@iff.com cc xsd-users@codesynthesis.com Subject Re: [xsd-users] Serialization and extended ascii characters. Hi Jan, jan.noorland@iff.com writes: > I'm trying to serialize an object model to XML where one of the string > values > can contain extended ascii characters > > Example: Instant?neas > > The serialization code throws an exception on the ? character. > > Is there a way to solve this? I tend to think (without knowing which exception is thrown) that this is happening because XSD-generated code with character type 'char' expects the text in UTF-8 encoding. So you will need to make sure that the '?' character in your string is encoded as UTF-8 multibyte sequence. Alternatively, you can try to instruct the generated code to assume that text is in the local code page by compiling your application with XSD_USE_LCP macro defined. This approach, however, is not portable in the sense that you cannot control the local code page on some platforms (notably, Windows). For more information see Q 1.2 in the C++/Tree Mapping FAQ: http://wiki.codesynthesis.com/Tree/FAQ Boris * * * * * * * * * * This communication contains information of International Flavors & Fragrances (IFF) and/or its affiliates that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended only for the addressee. Any copying, dissemination or other use of this information by anyone other than the intended recipient is prohibited. If you have received this communication in error, please contact the sender and delete it from your system. From boris at codesynthesis.com Fri Jun 6 09:08:38 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Serialization and extended ascii characters. In-Reply-To: References: <20080606121641.GA31713@karelia> Message-ID: <20080606130838.GA32288@karelia> Hi Jan, jan.noorland@iff.com writes: > My code is build with Visual C++ 2003 and the input data is defined as > char. The character is a valid ISO Latin-1 character (? = 0xE1). Yes, but it is not a valid UTF-8 character. The same character in UTF-8 will be represented as a 2-byte sequence: 0xC3 0xA1. > Does it imply that I need to use the --char-type wchar_t parameter to > regenerate the XSD code? You have three options here: 1. Use 'char' as the character type and represent non-ASCII characters as proper UTF-8 sequences. 2. Use 'char' as the character type and compile your code with XSD_USE_LCP macro defined. If your and all your user's Windows is configured to use ISO Latin-1 as an encoding then everything should work. 3. Use 'wchar_t' as the character type (compile your schemas with --char-type wchar_t) and use UTF-16 representation for 0xE1 which is 0x00E1 (L"?" will probably also work). Boris From mlang at delysid.org Sun Jun 8 15:33:20 2008 From: mlang at delysid.org (Mario Lang) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Preserving element order in MusicXML? In-Reply-To: <20080528140355.GC14026@karelia> (Boris Kolpackov's message of "Wed\, 28 May 2008 16\:03\:55 +0200") References: <873ao2ee5g.fsf@x2.delysid.org> <20080528140355.GC14026@karelia> Message-ID: <87wskzzpq7.fsf@x2.delysid.org> Skipped content of type multipart/signed-------------- next part -------------- XSDCXXTREEFLAGS = --root-element score-partwise --root-element score-timewise \ --type-naming ucc \ $(patsubst %,--generate-%,serialization doxygen polymorphic) \ --location-regex '%http://www.musicxml.org/xsd/(.+)%$$1%' all: parttime timepart @echo "Now type 'make test'." test: parttime timepart tie-fails.xml ./parttime tie-fails.xml|./timepart parttime: musicxml.o xlink.o xml.o parttime.o $(CXX) -o $@ $@.o musicxml.o xlink.o xml.o -l xerces-c timepart: musicxml.o xlink.o xml.o timepart.o $(CXX) -o $@ $@.o musicxml.o xlink.o xml.o -l xerces-c musicxml.xsd: musicxml.xsl wget -O- http://www.musicxml.org/xsd/$@|xsltproc -o $@ $< - xlink.xsd xml.xsd: wget -O$@ http://www.musicxml.org/xsd/$@ clean: rm -f timepart parttime *.o *.hxx rm -f musicxml.xsd xlink.xsd xml.xsd musicxml.cxx xlink.cxx xml.cxx musicxml.cxx: xlink.hxx xml.hxx %.cxx %.hxx: %.xsd xsdcxx cxx-tree $(XSDCXXTREEFLAGS) $< %.o: %.cxx $(CXX) $(CXXFLAGS) -c $< -------------- next part -------------- A non-text attachment was scrubbed... Name: musicxml.xsl Type: text/xml Size: 4276 bytes Desc: XSLT for musicxml.xsd Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20080608/bffd0dc0/musicxml.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: parttime.cxx Type: text/x-c++src Size: 2141 bytes Desc: Transform score-partwise to score-timewise Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20080608/bffd0dc0/parttime.cxx -------------- next part -------------- A non-text attachment was scrubbed... Name: timepart.cxx Type: text/x-c++src Size: 2145 bytes Desc: Transform score-timewise to score-partwise Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20080608/bffd0dc0/timepart.cxx -------------- next part -------------- A non-text attachment was scrubbed... Name: tie-fails.xml Type: application/vnd.recordare.musicxml+xml Size: 4235 bytes Desc: Sample MusicXML file Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20080608/bffd0dc0/tie-fails.bin -------------- next part -------------- -- Thanks, ????? | Debian Developer .''`. | Get my public key via finger mlang/key@db.debian.org : :' : | 1024D/7FC1A0854909BCCDBE6C102DDFFC022A6B113E44 `. `' `- From jan.noorland at iff.com Mon Jun 9 04:08:28 2008 From: jan.noorland at iff.com (jan.noorland@iff.com) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Serialization and extended ascii characters. In-Reply-To: <20080606130838.GA32288@karelia> Message-ID: Thanks Boris for pointing me in the right direction. Option 2 was sufficient to fix the problem. Best Regards, Jan. Boris Kolpackov 06/06/2008 03:12 PM To jan.noorland@iff.com cc xsd-users@codesynthesis.com Subject Re: [xsd-users] Serialization and extended ascii characters. Hi Jan, jan.noorland@iff.com writes: > My code is build with Visual C++ 2003 and the input data is defined as > char. The character is a valid ISO Latin-1 character (? = 0xE1). Yes, but it is not a valid UTF-8 character. The same character in UTF-8 will be represented as a 2-byte sequence: 0xC3 0xA1. > Does it imply that I need to use the --char-type wchar_t parameter to > regenerate the XSD code? You have three options here: 1. Use 'char' as the character type and represent non-ASCII characters as proper UTF-8 sequences. 2. Use 'char' as the character type and compile your code with XSD_USE_LCP macro defined. If your and all your user's Windows is configured to use ISO Latin-1 as an encoding then everything should work. 3. Use 'wchar_t' as the character type (compile your schemas with --char-type wchar_t) and use UTF-16 representation for 0xE1 which is 0x00E1 (L"?" will probably also work). Boris * * * * * * * * * * This communication contains information of International Flavors & Fragrances (IFF) and/or its affiliates that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended only for the addressee. Any copying, dissemination or other use of this information by anyone other than the intended recipient is prohibited. If you have received this communication in error, please contact the sender and delete it from your system. From boris at codesynthesis.com Mon Jun 9 11:53:57 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Preserving element order in MusicXML? In-Reply-To: <87wskzzpq7.fsf@x2.delysid.org> References: <873ao2ee5g.fsf@x2.delysid.org> <20080528140355.GC14026@karelia> <87wskzzpq7.fsf@x2.delysid.org> Message-ID: <20080609155357.GA8055@karelia> Hi Mario, Mario Lang writes: > > > > > > > > > > > > > > > > > > > [...] > > Is this a bug in the generated serialisation code? I suppose you can say that. This is the consequence of the "flattening" approach that I talked about in my previous email. In this case XSD tries to serializes each element in the order that it is encountered in the flattened view of the above content model. This works in most real-world schemas and results in a simpler API. However, this approach does not work in cases where there are several choice arms that have the same elements and they appear in different order. I don't think we will be able to fix this in C++/Tree since that would require significant changes (and complications) to the mapping architecture. > If not, and this is again expected behaviour, can you see a way how I could > modify the schema to make these cases work? One workaround would be to "relax" the schema for the purpose of code generation (you would still use the original schema for validation, etc.). For example, you can replace the above fragment with something along these lines: This model accepts all instances that are accepted by the original model (but also accepts instances that are invalid per the original) and should result in the correct serialization by C++/Tree. One possible way to address this flattening issue in the generic way would be to implement an automatic transformation like this in the compiler. Boris From Matthew.Hutchins at csiro.au Mon Jun 9 20:27:11 2008 From: Matthew.Hutchins at csiro.au (Matthew.Hutchins@csiro.au) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Problems with location-regex pathnames on Windows Message-ID: <9EF4A5826DD960459F3A015742550B3DCC001F@exactn2-cbr.nexus.csiro.au> Hi, I am using XSD 3.1.0 on Windows. When I use --location-regex to map a schema name to a pathname, and the pathname is an absolute pathname containing a drive letter and Windows path separators "\", I get an error like this: > xsd cxx-tree schema2.xsd --location-regex "%http://www.csiro.au/(.*)%P:\\staff\\matthew\\development\\sandbox\\xsd \\$1%" schema2.xsd: error: 'P:\staff\matthew\development\sandbox\xsd\schema1.xsd' is not a valid filesystem path In fact this also seems to be true for a relative pathname containing Windows separators "\". However calling xsd with this path is fine: > xsd cxx-tree "P:\staff\matthew\development\sandbox\xsd\schema1.xsd" (works and produces output) I looked at the code a bit, and it seems the job of determining whether a path is valid is handed to boost, and it is supposed to be checking for native paths, so I don't understand why there is a problem. Perhaps the location-regex part of the code was compiled with different compiler flags ... ? Anyway, can anyone help with this problem or suggest a work-around? I want to be able to import schemas that reside on a different Windows drive to the schema being compiled. Thanks Matthew PS: Schemas used to generate above output: --- schema1.xsd: --- --- schema2.xsd --- --- __________________________________ Dr Matthew A Hutchins Senior Research Scientist Networking Technologies Laboratory CSIRO ICT Centre --- Matthew.Hutchins@csiro.au Phone: +61 2 6216 7088 | Mobile: 0408 862 669 | Fax: +61 2 6216 7111 Mail: GPO Box 664 Canberra ACT 2601 Australia www.ict.csiro.au From bruno.marotta at fortis.com Tue Jun 10 02:55:06 2008 From: bruno.marotta at fortis.com (bruno.marotta@fortis.com) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Serialization with no line breaks Message-ID: <8E2E628CE354934FAB31A90699BCFA0D0248F8F7@spmw0018.mail.shared.fortis> Hi, how do I serialize to an XML in one straight line (no line breaks) Regards, Bruno Marotta IS GMK Equity & Capital Markets ISE - Information Systems Fortis Bank Belgium Tel: +32 2 312 01 43 E-mail: bruno.marotta@fortis.com Mail : Montagne du Parc - 3 - Warandeberg, B-1000 Brussels, Belgium -------------- next part -------------- = = = = = = = = = = = = = = = = = = = = = = = = = Fortis disclaimer : http://www.fortis.be/legal/disclaimer.htm Privacy policy related to banking activities of Fortis: http://www.fortis.be/legal/privacy_policy.htm = = = = = = = = = = = = = = = = = = = = = = = = = From boris at codesynthesis.com Tue Jun 10 03:26:23 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Serialization with no line breaks In-Reply-To: <8E2E628CE354934FAB31A90699BCFA0D0248F8F7@spmw0018.mail.shared.fortis> References: <8E2E628CE354934FAB31A90699BCFA0D0248F8F7@spmw0018.mail.shared.fortis> Message-ID: <20080610072623.GA31517@karelia> Hi Bruno, bruno.marotta@fortis.com writes: > how do I serialize to an XML in one straight line (no line breaks) You can turn of XML pretty printing as explained in this reply: http://www.codesynthesis.com/pipermail/xsd-users/2007-September/001221.html Seeing that this feature has been requested by a few people already we will add a serialization flag in the next release of XSD to turn pretty-printing off. Gordon Kramer suggest a patch that implements this so instead of performing your own DOM serialization as explained above you may want to simply apply this patch (it doesn't require a compiler rebuild so you can apply it to a pre-compiled binary distribution): http://www.codesynthesis.com/pipermail/xsd-users/2008-March/001555.html Boris From boris at codesynthesis.com Tue Jun 10 07:04:00 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Problems with location-regex pathnames on Windows In-Reply-To: <9EF4A5826DD960459F3A015742550B3DCC001F@exactn2-cbr.nexus.csiro.au> References: <9EF4A5826DD960459F3A015742550B3DCC001F@exactn2-cbr.nexus.csiro.au> Message-ID: <20080610110400.GB31517@karelia> Hi Matthew, Matthew.Hutchins@csiro.au writes: > When I use --location-regex to map a schema name to a pathname, and the > pathname is an absolute pathname containing a drive letter and Windows > path separators "\", I get an error like this: > > > xsd cxx-tree schema2.xsd --location-regex > "%http://www.csiro.au/(.*)%P:\\staff\\matthew\\development\\sandbox\\xsd > \\$1%" > schema2.xsd: error: > 'P:\staff\matthew\development\sandbox\xsd\schema1.xsd' is not a valid > filesystem path > > [...] > > I looked at the code a bit, and it seems the job of determining whether > a path is valid is handed to boost, and it is supposed to be checking > for native paths, so I don't understand why there is a problem. Absolute/Windows paths are rarely used in include/import declarations. The --location-regex option was meant to substitute remote URLs with local paths, normally relative to the root schema. We didn't expect that someone would use it for a more of an organizational purpose, not that there is anything wrong with that. I've fixed this problem for the upcoming release and can build you a pre-release binary with the fix if you would like. One drawback of using absolute paths like above is that you will end up with the following #include directive in the generated header file: #include "P:/staff/matthew/development/sandbox/xsd/schema1.hxx" unless you use the --include-regex option to translate it. On the other hand, if you used a suitable relative path in --location-regex you could have gotten the required header #include automatically. Boris From Pontus.Astrom at csr.com Tue Jun 10 07:53:23 2008 From: Pontus.Astrom at csr.com (=?iso-8859-1?Q?Pontus_=C5str=F6m?=) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] XSD compile problems Message-ID: Hi, First, congrats to an excellent package. I have been using it for a while in my projects with ease. I now want to compile it from sources so I easily can store it in my repository. For compilation I followed the guides given in http://www.codesynthesis.com/projects/xsd/extras/build-unix.xhtml. My geneal comments regarding the build is: 1. It is quite complicated to automate the process due to the interactive nature of the configuration. Nevertheless it is possible with tools like ezpect. 2. The makefiles are nonstandard. It would simplify for end users if it was more standards conformant and utilized for instance autotools or similar. 3. No distclean option exists so to preform a clean build on has to do 'make clean; find . -name "*-dynamic.make" -type f -delete'. This is a bit awkward. 4. During compile the actual compile commands are not shown. This makes it difficult to debug errors during compilations. It would be good if the exact commands executed are shown. During the compile I got some specific problems that I have difficulty to solve> 1. Compiling libcult with gcc 4.2.1 and binutils 2.18 results in segmentation fault in ld: ld /home/pa01/ws/syde/MAIN/ext/src/codesynthesis.com/libcult/cult/cult.l c++ /home/pa01/ws/syde/MAIN/ext/src/codesynthesis.com/libcult/examples/cli/cli.cxx ld /home/pa01/ws/syde/MAIN/ext/src/codesynthesis.com/libcult/examples/cli/cli collect2: ld terminated with signal 11 [Segmentation fault] make: *** [/home/pa01/ws/syde/MAIN/ext/src/codesynthesis.com/libcult/examples/cli/cli] Error 1 My question is if there are known issues with this combination of compiler and binutils packages. For instance the combo gcc 4.1.1 with binutils 2.18 compiles libcult with no problems but that version of gcc is pretty poor and I rather not use it. 2. When compiling libxsd-frontend I get linking errors. Below is the first such linking error message I get. I have selected to link against the installed version of boost. I have tried to add the option -L/path/too/boost/install/lib under 'extra C++ linker options' in the configuration bit this does not work. I wonder if there is anything else I can try to solve the compile error? ld /home/pa01/ws/syde/MAIN/ext/src/codesynthesis.com/libxsd-frontend/tests/dump/driver /home/pa01/ws/syde/MAIN/ext/src/codesynthesis.com/libxsd-frontend/tests/dump/driver.o: In function `__static_initialization_and_destruction_0(int, int)': driver.cxx:(.text+0x25): undefined reference to `boost::system::get_system_category()' driver.cxx:(.text+0x2f): undefined reference to `boost::system::get_posix_category()' driver.cxx:(.text+0x39): undefined reference to `boost::system::get_posix_category()' driver.cxx:(.text+0x43): undefined reference to `boost::system::get_system_category()' Best regards, Pontus From merli86 at gmail.com Tue Jun 10 08:08:18 2008 From: merli86 at gmail.com (Andrea Merli) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Problem with reading from XML Message-ID: <4834a9c60806100508q6d90fd9bg85f6175e0b033e2b@mail.gmail.com> My problem is this: I would have to read from XML file, but I do not succeed to capture the attributes. I have tried to write "driver.cxx" like in the "C++/Tree Mapping Getting Started Guide" but when I execute the instruction "./driver " appears many errors like these: -Unknown element 'shotBoundaryResults' -Attribute 'src' is not declared for element 'seg' What I can make? I enclose you also the 2 files generates from the compiler xsd and my xml file if they could serve to you. Thanks, aspect one answer -------------- next part -------------- A non-text attachment was scrubbed... Name: Archivio.zip Type: application/zip Size: 8937 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20080610/1f90d745/Archivio.zip From boris at codesynthesis.com Tue Jun 10 08:25:58 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] XSD compile problems In-Reply-To: References: Message-ID: <20080610122558.GC31517@karelia> Hi Pontus, Pontus ?str?m writes: > First, congrats to an excellent package. I have been using it for a > while in my projects with ease. Thanks, I am glad you found it useful. > 1. It is quite complicated to automate the process due to the interactive > nature of the configuration. Nevertheless it is possible with tools like > ezpect. Yes, we are aware of that and plan to provide support for auto-configuration. > 2. The makefiles are nonstandard. It would simplify for end users if it > was more standards conformant and utilized for instance autotools or > similar. This is a tricky issue. I agree it would have been easier for end-users if we used autotools. However, it would have also slowed the development of XSD immensely. I am not sure what would people generally prefer: a more functional product or an easier to use build system. I wrote a blog post not long ago about this: http://www.codesynthesis.com/~boris/blog/2008/03/24/user-or-development-oriented-build-system/ I also must add that the build system we use can and hopefully will be improved so that it is more end-user-friendly on commonly used platforms (e.g., GNU/Linux). > 3. No distclean option exists so to preform a clean build on has to do > 'make clean; find . -name "*-dynamic.make" -type f -delete'. This is a > bit awkward. The disfigure target does this, e.g., 'make disfigure'. Perhaps we should alias it to distclean. > 4. During compile the actual compile commands are not shown. This makes > it difficult to debug errors during compilations. It would be good if > the exact commands executed are shown. You can add verbose=1 to the make command line to see them, e.g., 'make verbose=1'. > 1. Compiling libcult with gcc 4.2.1 and binutils 2.18 results in > segmentation fault in ld: > > [...] > > My question is if there are known issues with this combination of > compiler and binutils packages. For instance the combo gcc 4.1.1 > with binutils 2.18 compiles libcult with no problems but that > version of gcc is pretty poor and I rather not use it. This is probably a binutils issue which you may want to report to the binutils developers. I am using 2.17 and can build XSD with all versions of gcc between 3.4-4.2 inclusive. I also think building it with 4.1.1 should be fine (at least I haven't heard anybody having problems with this combination). > 2. When compiling libxsd-frontend I get linking errors. Below is > the first such linking error message I get. I have selected to > link against the installed version of boost. I have tried to > add the option -L/path/too/boost/install/lib under 'extra C++ > linker options' in the configuration bit this does not work. > I wonder if there is anything else I can try to solve the compile > error? If it is installed into one of the system-default locations (e.g., /usr or /usr/local) then everything should work without any extra -L paths. Also, if you get link errors and not "library not found" type of errors then that means the library was found ok and there is some other issue. Which version of boost are you using? You may want to try to build something like 1.33.1 (that one still has a more or less sane build system) and see if that helps. Boris From boris at codesynthesis.com Tue Jun 10 08:36:31 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Problem with reading from XML In-Reply-To: <4834a9c60806100508q6d90fd9bg85f6175e0b033e2b@mail.gmail.com> References: <4834a9c60806100508q6d90fd9bg85f6175e0b033e2b@mail.gmail.com> Message-ID: <20080610123631.GD31517@karelia> Hi Andrea, Andrea Merli writes: > I have tried to write "driver.cxx" like in the "C++/Tree Mapping Getting > Started Guide" but when I execute the instruction "./driver " > appears many errors like these: > -Unknown element 'shotBoundaryResults' > -Attribute 'src' is not declared for element 'seg' This normally means that the schema could not be found and so your XML file could not be validated. For ways to resolve this see Q 2.1-2.3 in the C++/Tree Mapping FAQ: http://wiki.codesynthesis.com/Tree/FAQ > I enclose you also the 2 files generates from the compiler xsd and my xml > file if they could serve to you. In the future, please send the schema file instead of the generated C++ files. Boris From boris at codesynthesis.com Wed Jun 11 09:19:45 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] XSD/e 2.1.0 released Message-ID: <20080611131945.GF5203@karelia> Hi, We have released XSD/e 2.1.0. XSD/e is our embedded/mobile systems version of XSD. Major new features in this release include support for XML Schema polymorphism (xsi:type and substitution groups), support for delegation-based implementation reuse in addition to inheritance-based, automatic generation of sample serializer implementations and test drivers, support for parser and serializer reuse after an error, and the file-per-type compilation mode in addition to file-per-schema. For a complete list of new features in this release refer to the announcement on the xsde-announcements mailing list: http://www.codesynthesis.com/pipermail/xsde-announcements/2008/000003.html Boris From rlischner at proteus-technologies.com Wed Jun 11 11:11:43 2008 From: rlischner at proteus-technologies.com (Ray Lischner) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Problem with extension of complexType with simpleContent with required attribute Message-ID: I have a problem with Code Synthesis 2.3.1. (I have not verified that it exists in 3.1.0. We made a number of significant changes to the code generator, and moving to 3.1.0 will require a significant investment of time and effort. I planned on waiting until 3.x stabilized before taking the hit of moving our changes to 3.x.) If a schema has a complexType with simpleContent with a required attribute, and then has another complexType with simpleContent that extends the original type, the constructors are incorrect. For example: The generated code for Base's constructor is okay: Base (const _xsd_Base::base_& , const a::type&); The generated code for Derived's constructor, however, requires a Base object and a value for "a". In effect, I must supply two values of "a": one when constructing Base, and This value for "a" overwrites the value of "a" that is inherited from Base: Derived(const _xsd_Derived::base_&, const a::type&); It seems that Code Synthesis gives Derived's constructor all the inherited attributes, just as it would for a complexContent type. The problem is the first argument, which uses the immediate base class. In this case, the type of the first argument should be xml_schema::string. If this problem has already been fixed, can you give me any hints as to how to patch our 2.3.1 version for the time being--until we can move forward to 3.1? Thank you. Ray Lischner, Senior Member of Technical Staff 133 National Business Pkwy, Ste 150 t. 443.539.3448 Annapolis Junction, MD 20701 c. 301.377.7390 rlischner@proteus-technologies.com f. 443.539.3370 This electronic message and any files transmitted with it contain information which may be privileged and/or proprietary. The information is intended for use solely by the intended recipient(s). If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of this information is prohibited. If you have received this electronic message in error, please advise the sender by reply email or by telephone (443.539.3400) and delete the message. From boris at codesynthesis.com Wed Jun 11 12:41:21 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Problem with extension of complexType with simpleContent with required attribute In-Reply-To: References: Message-ID: <20080611164121.GJ5203@karelia> Hi Ray Ray Lischner writes: > It seems that Code Synthesis gives Derived's constructor all the > inherited attributes, just as it would for a complexContent type. > The problem is the first argument, which uses the immediate base > class. In this case, the type of the first argument should be > xml_schema::string. Right, this is a bug in 2.3.1. > If this problem has already been fixed, can you give me any hints > as to how to patch our 2.3.1 version for the time being--until we > can move forward to 3.1? There is no such problem in 3.1.0 -- the constructor has string as a base. The part of code that handles this in 3.1.0 is quite a bit different compared to 2.3.1 so there is not way to backport anything from 3.1.0. I've come up with a patch for 2.3.1 that should fix the problem: http://codesynthesis.com/~boris/tmp/xsd-2.3.1-ultimate-base.patch I haven't tested it (don't have the 2.3.1 dependencies built) but I am pretty sure it works. If it doesn't then let me know and I will build everything and take a look. Boris From rlischner at proteus-technologies.com Wed Jun 11 14:15:37 2008 From: rlischner at proteus-technologies.com (Ray Lischner) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Problem with extension of complexType with simpleContent with required attribute References: <20080611164121.GJ5203@karelia> Message-ID: Thank you. The patch works perfectly. I hope that we will be able to move to version 3 sometime this year. We move slowly, sometimes, but this also reflects how solid and reliable 2.3.1 is. Ray Lischner, Senior Member of Technical Staff 133 National Business Pkwy, Ste 150 t. 443.539.3448 Annapolis Junction, MD 20701 c. 301.377.7390 rlischner@proteus-technologies.com f. 443.539.3370 This electronic message and any files transmitted with it contain information which may be privileged and/or proprietary. The information is intended for use solely by the intended recipient(s). If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of this information is prohibited. If you have received this electronic message in error, please advise the sender by reply email or by telephone (443.539.3400) and delete the message. ________________________________ From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Wed 6/11/2008 12:41 PM To: Ray Lischner Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] Problem with extension of complexType with simpleContent with required attribute Hi Ray Ray Lischner writes: > It seems that Code Synthesis gives Derived's constructor all the > inherited attributes, just as it would for a complexContent type. > The problem is the first argument, which uses the immediate base > class. In this case, the type of the first argument should be > xml_schema::string. Right, this is a bug in 2.3.1. > If this problem has already been fixed, can you give me any hints > as to how to patch our 2.3.1 version for the time being--until we > can move forward to 3.1? There is no such problem in 3.1.0 -- the constructor has string as a base. The part of code that handles this in 3.1.0 is quite a bit different compared to 2.3.1 so there is not way to backport anything from 3.1.0. I've come up with a patch for 2.3.1 that should fix the problem: http://codesynthesis.com/~boris/tmp/xsd-2.3.1-ultimate-base.patch I haven't tested it (don't have the 2.3.1 dependencies built) but I am pretty sure it works. If it doesn't then let me know and I will build everything and take a look. Boris From Pontus.Astrom at csr.com Thu Jun 12 08:42:10 2008 From: Pontus.Astrom at csr.com (=?iso-8859-1?Q?Pontus_=C5str=F6m?=) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] xml_schema::parser_map usage? Message-ID: Hi, I'm looking for a clue of how to use the xml_schema::parser_map stuff for parsers with polymorphic types but can't find any information. Is there a document or code snippet somewhere that gives some insight? Best regards, Pontus From rlischner at proteus-technologies.com Thu Jun 12 09:04:23 2008 From: rlischner at proteus-technologies.com (Ray Lischner) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] How to distinguish simpleTypes from complexTypes Message-ID: How can I distinguish between a simpleType and a complexType? In the past, I used the IsSimpleType functor, but now we have schemas with simpleTypes with complexContent and attributes, so that no longer works. I tried writing my own traversal functor that derives from Traversal::AnyType and Traversal::AnySimpleType, but when I try overriding traverse(SemanticGraph::AnyType&), etc., these functions are never called. Only the traverse(SemanticGraph::Complex&) function is called. Thanks for the help. Ray Lischner, Senior Member of Technical Staff 133 National Business Pkwy, Ste 150 t. 443.539.3448 Annapolis Junction, MD 20701 c. 301.377.7390 rlischner@proteus-technologies.com f. 443.539.3370 This electronic message and any files transmitted with it contain information which may be privileged and/or proprietary. The information is intended for use solely by the intended recipient(s). If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of this information is prohibited. If you have received this electronic message in error, please advise the sender by reply email or by telephone (443.539.3400) and delete the message. From Thierry.Seegers at am.sony.com Thu Jun 12 19:44:55 2008 From: Thierry.Seegers at am.sony.com (Seegers, Thierry) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Constant rebuilds and no clean, in VS2005. Message-ID: <31F9D6F2CE0DD84B864BBDC38148D76703F7C259@ussdixms03.am.sony.com> Hi, This being my first post here, I'd like to congratulate the makers of this tool. It's pretty neat (and obviously, quite helpful). J I'm facing an annoyance where, in Visual Studio 2005, the project responsible for generating source code is constantly rebuilding, even when no schema files nor generated files have been touched. I've followed the instructions on the Wiki about using the custom build rules file for VS2k5. Some changes I've made to my project settings that may have an effect -I'm not sure- are General->Output Directory = $(ProjectDir)$(ConfigurationName) and Librarian->General->Output File=..\..\..\$(ConfigurationName)\$(ProjectName).lib. All my schema files and generated files have been added to the project. Another thing I noticed is that performing a Clean on the project does not delete the generated files. Is that expected? Regards, Thierry Seegers From boris at codesynthesis.com Fri Jun 13 03:08:47 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] xml_schema::parser_map usage? In-Reply-To: References: Message-ID: <20080613070847.GA12466@karelia> Hi Pontus, Pontus ?str?m writes: > I'm looking for a clue of how to use the xml_schema::parser_map > stuff for parsers with polymorphic types but can't find any > information. parser_map is an interface for resolving parsers based on a type id (you can find its definition in libxsd/xsd/cxx/parser/map.hxx) Implementations of this interface can be passed instead of an individual parser to the parser construction functions. You can provide your own implementation or you can use the default one provided by the XSD runtime (not currently aliased in xml_schema, but will be in the next release). Based on the example in Section 5.4, "Support for Polymorphism" in C++/Parser Mapping Getting Started Guide you can rewrite this fragment which does not use parser_map: instance_p.person_parser (person_p); instance_p.person_parser (superman_p); instance_p.person_parser (batman_p); With something like this: xsd::cxx::parser::parser_map_impl person_map_impl; person_map.insert (person_p._dynamic_type (), person_p); person_map.insert (superman_p._dynamic_type (), superman_p); person_map.insert (batman_p._dynamic_type (), batman_p); instance_p.person_parser (person_map); One reason to use a parser map over setting individual parsers is in the case where you have several places where, say, the person element can be present in the vocabulary. In this case it is easier to create and fill the map once and pass it to those places. > Is there a document or code snippet somewhere that gives some > insight? We will expand Section 5.4, "Support for Polymorphism" for the next release with this information. Thanks for the suggestion! Boris From boris at codesynthesis.com Fri Jun 13 05:07:34 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] How to distinguish simpleTypes from complexTypes In-Reply-To: References: Message-ID: <20080613090734.GD12466@karelia> Hi Ray, Ray Lischner writes: > How can I distinguish between a simpleType and a complexType? In the > past, I used the IsSimpleType functor, but now we have schemas with > simpleTypes with complexContent and attributes, so that no longer > works. In XML Schema the distinction between simpleType and complexType is somewhat arbitrary so we don't really preserve it the semantic graph. Consider: The two types are essentially the same but one is simple and the other is complex in XML Schema speak. Is you don't care about such technicalities, then the IsSimpleType does the trick: it returns false for types that have elements and/or attributes and true otherwise. It will return true for both of the above types but false for a complexType/simpleContent that has an attribute. Boris From boris at codesynthesis.com Fri Jun 13 05:53:25 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Constant rebuilds and no clean, in VS2005. In-Reply-To: <31F9D6F2CE0DD84B864BBDC38148D76703F7C259@ussdixms03.am.sony.com> References: <31F9D6F2CE0DD84B864BBDC38148D76703F7C259@ussdixms03.am.sony.com> Message-ID: <20080613095325.GA3435@karelia> Hi Thierry, Seegers, Thierry writes: > This being my first post here, I'd like to congratulate the makers of > this tool. It's pretty neat (and obviously, quite helpful). J Thanks! > I'm facing an annoyance where, in Visual Studio 2005, the project > responsible for generating source code is constantly rebuilding, even > when no schema files nor generated files have been touched. I've > followed the instructions on the Wiki about using the custom build rules > file for VS2k5. Some changes I've made to my project settings that may > have an effect -I'm not sure- are General->Output Directory = > $(ProjectDir)$(ConfigurationName) and Librarian->General->Output > File=..\..\..\$(ConfigurationName)\$(ProjectName).lib. All my schema > files and generated files have been added to the project. > > Another thing I noticed is that performing a Clean on the project does > not delete the generated files. Is that expected? I am pretty sure this means that the output file names that are specified by the rules file do not match what is actually produced by the XSD compiler. I tried in a test project to change the "Output Directory" field to $(ProjectDir)$(ConfigurationName) but could not reproduce the problem. The only way I could get the "always rebuilding" behavior is when I changed the C++ file extensions from the default .hxx/.cxx to .h/.cpp. This is due to a bug in the rules files that are distributed in 3.1.0 that we have fixed for the next release. Perhaps you have also changed the generated file extensions in your project? If that's the case, you can get the fixed rules files here: http://www.codesynthesis.com/~boris/tmp/etc-3.1.1.zip Let me know if this doesn't help. Boris From Thierry.Seegers at am.sony.com Fri Jun 13 13:51:44 2008 From: Thierry.Seegers at am.sony.com (Seegers, Thierry) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] (no subject) Message-ID: <31F9D6F2CE0DD84B864BBDC38148D76703F7C3C3@ussdixms03.am.sony.com> Hi Boris, > The only way I could get the "always rebuilding" behavior is when I > changed the C++ file extensions from the default .hxx/.cxx to .h/.cpp. > This is due to a bug in the rules files that are distributed in 3.1.0 > that we have fixed for the next release. Perhaps you have also changed > the generated file extensions in your project? Haha, that was exactly it! For some reason I despise the "xx" in file extensions... :D When using the rule files of v.3.1.1 the problem is indeed fixed. Thank you for that. (I knew something was fishy when, after reverting to setting up my project using the VS2003 instructions, it was all working as expected...) Another thing I noticed that you may want to fix: additional command lines options for the project get duplicated at the file level. For instance, I've added the following options in Project Properties->C++/Tree Mapping Rule->Command Line->Additional options --accessor-regex /interface/interface_/ --modifier-regex /interface/interface_/ --include-with-brackets If I then look at the Properties panel of an individual schema file, in C++/Tree Mapping Rule->Command Line->All options, I see the following: xsd.exe cxx-tree --output-dir generated --hxx-suffix .h --cxx-suffix .cpp --ixx-suffix .i --fwd-suffix -fwd.h --char-type wchar_t --generate-polymorphic --generate-intellisense --accessor-regex /interface/interface_/ --modifier-regex /interface/interface_/ --include-with-brackets --accessor-regex /interface/interface_/ --modifier-regex /interface/interface_/ --include-with-brackets This duplication of options is probably harmless but I figured I'd let you know... Regards, Thierry Seegers From boris at codesynthesis.com Fri Jun 13 13:51:56 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] VS rules files In-Reply-To: <31F9D6F2CE0DD84B864BBDC38148D76703F7C3C3@ussdixms03.am.sony.com> References: <31F9D6F2CE0DD84B864BBDC38148D76703F7C3C3@ussdixms03.am.sony.com> Message-ID: <20080613175156.GC4825@karelia> Hi Thierry, Seegers, Thierry writes: > Another thing I noticed that you may want to fix: additional command > lines options for the project get duplicated at the file level. > > For instance, I've added the following options in Project > Properties->C++/Tree Mapping Rule->Command Line->Additional options > > > > --accessor-regex /interface/interface_/ --modifier-regex > /interface/interface_/ --include-with-brackets > > > > If I then look at the Properties panel of an individual schema file, in > C++/Tree Mapping Rule->Command Line->All options, I see the following: > > > > xsd.exe cxx-tree --output-dir generated --hxx-suffix .h --cxx-suffix > .cpp --ixx-suffix .i --fwd-suffix -fwd.h --char-type wchar_t > --generate-polymorphic --generate-intellisense --accessor-regex > /interface/interface_/ --modifier-regex /interface/interface_/ > --include-with-brackets --accessor-regex /interface/interface_/ > --modifier-regex /interface/interface_/ --include-with-brackets I tried to reproduce this but couldn't. I added --include-with-brackets in the "Additional options" field in the project-wide C++/Tree Mapping Rule tab. I then opened the same tab for a particular schema and there I see single --include-with-brackets option in the "All options" field. I assume that your "Additional options" field in the schema-specific configuration is empty? BTW, the easier way to escape the 'interface' name is to use the --reserved-name option: --reserved-name interface Boris From rlischner at proteus-technologies.com Mon Jun 16 10:09:53 2008 From: rlischner at proteus-technologies.com (Ray Lischner) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Problem with extension of complexType with simpleContent with required attribute References: <20080611164121.GJ5203@karelia> Message-ID: The fix works too well. Suppose type A extends B, which extends xsd:string. We have customized B so that the implementation actually derives from fundamental_base. (Specifically, we call B CUnsigned. It lets us write C-style hex numbers in the XML document, while using unsigned integers in the code. These particular elements are bit masks and are easier to express in hexadecimal. Our existing code uses uint32_t, so using hexBinary in the schema would still require a customized type to perform the conversions.) Before we applied this patch, the code for A's constructor would take a B as an argument, which was fine because B has all our customizations. With the fix, A's constructor now takes an xsd:string, which is bad because it bypasses our customizations. (On the other hand, some of our types now have attributes, which is why we needed the fix in the first place.) I tried the --generate-from-base-ctor switch, but it doesn't help. I see that the base class needs to have at least one required member, which makes sense to avoid generating two constructors with identical arguments. Is there some way, other than customizing A, to recover the behavior of constructing an A from a B, while retaining the proper construction of A when B has attributes? Ray Lischner, Senior Member of Technical Staff 133 National Business Pkwy, Ste 150 t. 443.539.3448 Annapolis Junction, MD 20701 c. 301.377.7390 rlischner@proteus-technologies.com f. 443.539.3370 This electronic message and any files transmitted with it contain information which may be privileged and/or proprietary. The information is intended for use solely by the intended recipient(s). If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of this information is prohibited. If you have received this electronic message in error, please advise the sender by reply email or by telephone (443.539.3400) and delete the message. ________________________________ From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Wed 6/11/2008 12:41 PM To: Ray Lischner Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] Problem with extension of complexType with simpleContent with required attribute Hi Ray Ray Lischner writes: > It seems that Code Synthesis gives Derived's constructor all the > inherited attributes, just as it would for a complexContent type. > The problem is the first argument, which uses the immediate base > class. In this case, the type of the first argument should be > xml_schema::string. Right, this is a bug in 2.3.1. > If this problem has already been fixed, can you give me any hints > as to how to patch our 2.3.1 version for the time being--until we > can move forward to 3.1? There is no such problem in 3.1.0 -- the constructor has string as a base. The part of code that handles this in 3.1.0 is quite a bit different compared to 2.3.1 so there is not way to backport anything from 3.1.0. I've come up with a patch for 2.3.1 that should fix the problem: http://codesynthesis.com/~boris/tmp/xsd-2.3.1-ultimate-base.patch I haven't tested it (don't have the 2.3.1 dependencies built) but I am pretty sure it works. If it doesn't then let me know and I will build everything and take a look. Boris From boris at codesynthesis.com Mon Jun 16 12:20:25 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Problem with extension of complexType with simpleContent with required attribute In-Reply-To: References: <20080611164121.GJ5203@karelia> Message-ID: <20080616162025.GG13604@karelia> Hi Ray, Ray Lischner writes: > The fix works too well. Suppose type A extends B, which extends > xsd:string. We have customized B so that the implementation > actually derives from fundamental_base. (Specifically, > we call B CUnsigned. It lets us write C-style hex numbers in the > XML document, while using unsigned integers in the code. These > particular elements are bit masks and are easier to express in > hexadecimal. Hm, interesting technique. I gave it some thought and it seems that the proper way to support this kind of usage (that is, construction of derived types by using implicit conversion c-tors provided by customization of the base) would be to have an option to instruct XSD to generate an extra c-tor which uses an instance of an intermediate base (the first simple type in the hierarchy). I am, however, wondering if this has too limited an application since the only way to achieve the same behavior for complex types or for c-tors with two or more arguments would be to customize all derived types and add the extra c-tors manually. In any case, I can add this option to the 3.x.x code base if there is a real application that needs it. A workaround that should work in 2.3.1 would be to use union instead of derivation. In other words, your type B would look like so: Since union is not explicitly derived from any type, the generated code will use B as the ultimate base in any inheritance hierarchy. Boris From edgarszi at gmail.com Mon Jun 16 12:57:57 2008 From: edgarszi at gmail.com (Edgar Szilagyi) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] GML extending, How-to? Message-ID: <48569B95.6070804@gmail.com> Hi! First of all, thanks for Boris Kolpackov, who quickly answered my Hello World question. Sorry about my wrong english. I'm working in research group at University of S?o Paulo. We have developed many simulation software for big companies in Brazil. Now we are revising file format for information interchange and adopting XML and Code Synthesis due it's high quality. Thanks very much for all developers! Well, that's the question: We want to extend GML(Geographic Markup Language). But, how can we do it? A GML has a completly defined schema, with gml::featureCollection as root element. When we parse a GML valid file, all we get is a AbstractFeatureType. But we need a specialized instance: railRoad. How can we put these two things (GML schema and our specialization below) together? This is a schema sample: Can anyone help us? Thanks very much! Edgar Szilagyi From Matthew.Hutchins at csiro.au Mon Jun 16 20:15:42 2008 From: Matthew.Hutchins at csiro.au (Matthew.Hutchins@csiro.au) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Schemas defined across multiple DLLs and the static factory map instance Message-ID: <9EF4A5826DD960459F3A015742550B3DCC0022@exactn2-cbr.nexus.csiro.au> Hi, This email is related to an issue discussed on the list in Oct 2006 on static variable initialisation, but slightly different. I am using XSD 3.1 on Windows with Visual Studio 2003 (7). I am defining a C++ class library hierarchy with some base classes in one library (A) and some instances in other libraries (B,C,D). Schemas are defined across all the libraries. The code that reads XML documents is in library A. There are schemas defined in B,C,D with elements that are extensions of those defined in A. Each library is linked into a DLL. The issue is that the XML reader in library A does not recognise the subclasses/elements from the other libraries. The reason is that each DLL has its own unique instance of the static type_factory_map instance, so the elements from A are added to the factory map for A, the elements for B are added to the factory map for B, and so on. There is a fix for this, but a change to the definition of type_factory_map would make it easier. Code linked into each DLL can get access to the factory map instance for its own DLL like this: return ::xsd::cxx::tree::type_factory_map_instance< 0, char > (); Thus, a base class in library A can expose the factory map instance for the A DLL, and classes in the other libraries can then see it. The register_element method can be used to manually add definitions. What would make this easier is if there was a public method defined in type_factory_map to add all the elements defined in another type_factory_map. Then a class in DLL B could get its local factory map instance and add the definitions to the factory map instance from DLL A. Perhaps something like this (this is just written in this email, I haven't compiled or tested it): public: void register_elements(const type_factory_map & that) { for (element_map::const_iterator i = that.element_map.begin(); i != that.element_map.end(); ++i) { for (element_map::const_iterator j = i->second.begin(); j != i->second.end(); ++j) { element_map_[i->first][j->first] = j->second; } } } Matthew __________________________________ Dr Matthew A Hutchins Senior Research Scientist Networking Technologies Laboratory CSIRO ICT Centre --- Matthew.Hutchins@csiro.au Phone: +61 2 6216 7088 | Mobile: 0408 862 669 | Fax: +61 2 6216 7111 Mail: GPO Box 664 Canberra ACT 2601 Australia www.ict.csiro.au From boris at codesynthesis.com Tue Jun 17 10:04:10 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] GML extending, How-to? In-Reply-To: <48569B95.6070804@gmail.com> References: <48569B95.6070804@gmail.com> Message-ID: <20080617140410.GD16542@karelia> Hi Edgar, Edgar Szilagyi writes: > Well, that's the question: We want to extend GML(Geographic Markup > Language). But, how can we do it? A GML has a completly defined schema, > with gml::featureCollection as root element. When we parse a GML valid > file, all we get is a AbstractFeatureType. But we need a specialized > instance: railRoad. How can we put these two things (GML schema and our > specialization below) together? Note that this mailing list is for questions about CodeSynthesis XSD, while this question is more about GML than XSD. Having said that I will give you a couple of pointers. If you need more GML-specific information, I suggest that you ask on the GML discussion forums hosted by the www.opengeospatial.org site. GML uses the so called XML Schema polymorphism to provide extensibility. In particular, you can extend the gml:AbstractFeatureType type and provide a substitution group member of this type that substitutes gml:_Feature element. So here is what you would normally do: 1. Create your Rail Road schema by importing gml.xsd and then defining a type, say RailRoadType that derives from AbstractFeatureType and a substitution group member, say, RailRoad, that substitutes gml:_Feature. 2. Compile both GML schemas and your extension schema with the --generate-polymorphic option. 3. Read Section 2.11, "Mapping for xsi:type and Substitution Groups" in the C++/Tree Mapping User Manual to learn how to access polymorphic content in the C++/Tree Mapping: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.11 Boris From boris at codesynthesis.com Tue Jun 17 11:13:43 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Schemas defined across multiple DLLs and the static factory map instance In-Reply-To: <9EF4A5826DD960459F3A015742550B3DCC0022@exactn2-cbr.nexus.csiro.au> References: <9EF4A5826DD960459F3A015742550B3DCC0022@exactn2-cbr.nexus.csiro.au> Message-ID: <20080617151343.GE16542@karelia> Hi Matthew, Matthew.Hutchins@csiro.au writes: > The issue is that the XML reader in library A does not recognise the > subclasses/elements from the other libraries. > > The reason is that each DLL has its own unique instance of the static > type_factory_map instance, so the elements from A are added to the > factory map for A, the elements for B are added to the factory map for > B, and so on. > > There is a fix for this, but a change to the definition of > type_factory_map would make it easier. > > Code linked into each DLL can get access to the factory map instance for > its own DLL like this: > > return ::xsd::cxx::tree::type_factory_map_instance< 0, char > (); > > Thus, a base class in library A can expose the factory map instance for > the A DLL, and classes in the other libraries can then see it. The > register_element method can be used to manually add definitions. This can definitely be done but there are a few drawbacks with this approach. First, it requires the user to manually call register_element for each DLL but A. Second, because the maps in B, C, and D are not used after the content is copied to A, it is somewhat wasteful. I think there is a better fix that involves some MS C++ template/DLL export voodoo. And if it works, then the necessary code can event be generated automatically by the XSD compiler. The idea is to export the static map variables in A and use them (import) in B, C, and D. I've modified a few files in XSD 3.1.0 runtime library to test this idea out. I would appreciate it if you could try it on your application and let me know if it works (I tried the approach on a simple test case and it seems to work; it is also used in a couple of other libraries, notably ACE). Here is what needs to be done: 1. Get the replacement files: http://www.codesynthesis.com/~boris/tmp/xsd-3.1.0-dll-maps.zip 2. Compile the A DLL with the XSD_TREE_EXPORT_MAP macro defined. 3. Compile the B, C, and D DLLs with the XSD_TREE_IMPORT_MAP macro defined. If this works then I can go ahead and add a few compiler options to generate this code automatically (which will also get rid of the requirement to define XSD_TREE_*_MAP macros during compilation). Thanks, Boris From Matthew.Hutchins at csiro.au Tue Jun 17 23:12:09 2008 From: Matthew.Hutchins at csiro.au (Matthew.Hutchins@csiro.au) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Schemas defined across multiple DLLs and the static factory map instance References: <9EF4A5826DD960459F3A015742550B3DCC0022@exactn2-cbr.nexus.csiro.au> <20080617151343.GE16542@karelia> Message-ID: <9EF4A5826DD960459F3A015742550B3DCC0025@exactn2-cbr.nexus.csiro.au> Hi Boris, Thanks, yes this works. I had to make a small change to your changed code. Change "class" to "struct" and add a __declspec(dllimport) to the import version (for both factory and serializer files): #ifdef _MSC_VER #ifdef XSD_TREE_EXPORT_MAP template struct __declspec (dllexport) type_serializer_plate<0, char>; #endif #ifdef XSD_TREE_IMPORT_MAP extern template struct __declspec (dllimport) type_serializer_plate<0, char>; #endif #endif Matthew -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Wednesday, 18 June 2008 1:14 AM To: Hutchins, Matthew (ICT Centre, ANU - Acton) Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] Schemas defined across multiple DLLs and the static factory map instance Hi Matthew, Matthew.Hutchins@csiro.au writes: > The issue is that the XML reader in library A does not recognise the > subclasses/elements from the other libraries. > > The reason is that each DLL has its own unique instance of the static > type_factory_map instance, so the elements from A are added to the > factory map for A, the elements for B are added to the factory map for > B, and so on. > > There is a fix for this, but a change to the definition of > type_factory_map would make it easier. > > Code linked into each DLL can get access to the factory map instance for > its own DLL like this: > > return ::xsd::cxx::tree::type_factory_map_instance< 0, char > (); > > Thus, a base class in library A can expose the factory map instance for > the A DLL, and classes in the other libraries can then see it. The > register_element method can be used to manually add definitions. This can definitely be done but there are a few drawbacks with this approach. First, it requires the user to manually call register_element for each DLL but A. Second, because the maps in B, C, and D are not used after the content is copied to A, it is somewhat wasteful. I think there is a better fix that involves some MS C++ template/DLL export voodoo. And if it works, then the necessary code can event be generated automatically by the XSD compiler. The idea is to export the static map variables in A and use them (import) in B, C, and D. I've modified a few files in XSD 3.1.0 runtime library to test this idea out. I would appreciate it if you could try it on your application and let me know if it works (I tried the approach on a simple test case and it seems to work; it is also used in a couple of other libraries, notably ACE). Here is what needs to be done: 1. Get the replacement files: http://www.codesynthesis.com/~boris/tmp/xsd-3.1.0-dll-maps.zip 2. Compile the A DLL with the XSD_TREE_EXPORT_MAP macro defined. 3. Compile the B, C, and D DLLs with the XSD_TREE_IMPORT_MAP macro defined. If this works then I can go ahead and add a few compiler options to generate this code automatically (which will also get rid of the requirement to define XSD_TREE_*_MAP macros during compilation). Thanks, Boris From laurent.carcagno at isismpp.fr Wed Jun 18 06:05:23 2008 From: laurent.carcagno at isismpp.fr (Carcagno Laurent) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] (no subject) Message-ID: <761F451C5F17F74DAEE4661DA5ABBC16011A7975@factorix.ISISTHIBAUD.local> Hello, First thanks for the great job you've done, I just want to know if you plan to add expat as a target for C++/Tree mapping Thanks a lot for your answer, Best Regards, L. Carcagno From boris at codesynthesis.com Wed Jun 18 05:56:39 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Schemas defined across multiple DLLs and the static factory map instance In-Reply-To: <9EF4A5826DD960459F3A015742550B3DCC0025@exactn2-cbr.nexus.csiro.au> References: <9EF4A5826DD960459F3A015742550B3DCC0022@exactn2-cbr.nexus.csiro.au> <20080617151343.GE16542@karelia> <9EF4A5826DD960459F3A015742550B3DCC0025@exactn2-cbr.nexus.csiro.au> Message-ID: <20080618095639.GC18877@karelia> Hi Matthew, Matthew.Hutchins@csiro.au writes: > Thanks, yes this works. I had to make a small change to your changed > code. Change "class" to "struct" and add a __declspec(dllimport) to the > import version (for both factory and serializer files): Great, thanks for testing this! We will add two options to the upcoming 3.1.1 release that will allow one to generate that code automatically (that is, you will need to compile schemas that go into the A DLL with something like --export-maps and schemas that go to B, C, and D with --import-maps). Unfortunately this is too big a change to backport to 3.1.0. So you have two options: we can build you a pre-release 3.1.1 binary with these options or you can use the modified headers I sent you for the time being and when 3.1.1 is released, upgrade and change to using the compiler options. Let me know if you would like the binary. Boris From boris at codesynthesis.com Wed Jun 18 06:50:53 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Expat as an underlying parser for C++/Tree In-Reply-To: <761F451C5F17F74DAEE4661DA5ABBC16011A7975@factorix.ISISTHIBAUD.local> References: <761F451C5F17F74DAEE4661DA5ABBC16011A7975@factorix.ISISTHIBAUD.local> Message-ID: <20080618105053.GE18877@karelia> Hi Laurent, Carcagno Laurent writes: > I just want to know if you plan to add expat as a target for C++/Tree > mapping No there are no plans for support Expat as an underlying parser for C++/Tree. The C++/Tree mapping derives much of its power and flexibility from interfacing with DOM. Features like wildcard mapping, optional association with underlying DOM nodes, "fixing up" XML before parsing or after serialization, etc., all require DOM. So Xerces-C++ is pretty much a fixed underlying XML parser for this mapping. We are, however, working on a lighter-wight mapping similar to C++/Tree that will support various underlying XML parsers, including Expat. Boris From Raymond.Rizzuto at sig.com Thu Jun 19 16:07:33 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] .msi install doesn't include etc directory Message-ID: Hi! I just installed xsd 3.1.0 using the xsd-3.1.msi method, and was following the procedure at http://wiki.codesynthesis.com/Using_XSD_with_Microsoft_Visual_Studio. However, I found that the .msi doesn't install the requisite etc/ subdirectory. I downloaded xsd-3.1.0-i686-windows.zip, which does have those directories, and once I extracted them to the CodeSynthesis XSD 3.1.0 directory, I was able to continue. Recommendation: add the etc directory to the .msi Ray ________________________________ Ray Rizzuto raymond.rizzuto@sig.com Susquehanna International Group (610)747-2336 (W) (215)776-3780 (C) ________________________________ IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses. From boris at codesynthesis.com Thu Jun 19 16:53:41 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] .msi install doesn't include etc directory In-Reply-To: References: Message-ID: <20080619205341.GC6842@karelia> Hi Ray, Rizzuto, Raymond writes: > However, I found that the .msi doesn't install the requisite > etc/ subdirectory. Ouch, this is embarrassing. I've added the etc directory and uploaded the new revision of xsd-3.1.msi. Thanks for reporting this! Boris From Hellhound_01 at web.de Fri Jun 20 09:20:04 2008 From: Hellhound_01 at web.de (Christian Heine) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] How to get xsi:type informations Message-ID: <485BAE84.50405@web.de> Hi all, I've trouble to get the xsi:type informations from an xsd object. In my schema I've an abstract element which has to bee declared explicit by using the xsi:type attribute to make sure that only objects of the abstract type are returned. i.e.: So far so good and it works fine. But now i've to reinterprete the type for concrete object initialization. How i get the xsi:tpye information from the XSD unit object? I could see all embedded objects and attributes when i touch the XSD unit object, but i missing the xsi::type informations... Thanks for any hint or tip, Best regards, Christian From boris at codesynthesis.com Fri Jun 20 09:19:32 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] How to get xsi:type informations In-Reply-To: <485BAE84.50405@web.de> References: <485BAE84.50405@web.de> Message-ID: <20080620131932.GD8446@karelia> Hi Christian, Christian Heine writes: > I've trouble to get the xsi:type informations from an xsd object. In > my schema I've an abstract element which has to bee declared explicit > by using the xsi:type attribute to make sure that only objects of the > abstract type are returned. > > i.e.: > > > > So far so good and it works fine. But now i've to reinterprete the > type for concrete object initialization. How i get the xsi:tpye > information from the XSD unit object? You normally don't need to do anything with the xsi:type attribute when using the C++/Tree mapping (I assume you are using C++/Tree). Everything is handled by the generated code and actual dynamic types are instantiated. You can then discover the the actual object type using, for example, dynamic_cast. For more information see Section 2.11, "Mapping for xsi:type and Substitution Groups" in the C++/Tree Mapping User Manual: http://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.11 You may also find the 'polymorphism' example in examples/cxx/tree/ useful. (If you still need to get the raw xsi:type attribute value for some reason then let me know and I will provide with some pointers.) Boris From abray at ara.com Fri Jun 20 11:35:25 2008 From: abray at ara.com (Aaron Bray ARA/SED) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] xs:double truncation Message-ID: I have the following: I set value to 3.07391836376424E-30 in code. When serialized to file I get the value as 0 This is not acceptable. Something is truncating my double value. Previous XSD version worked (now I am using 3.1) Jaxb also handles this properly Do I need to set something in my xsd compiler options? Suggestions? From boris at codesynthesis.com Fri Jun 20 12:10:03 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] xs:double truncation In-Reply-To: References: Message-ID: <20080620161003.GJ8446@karelia> Hi Aaron, Aaron Bray ARA/SED writes: > I set value to 3.07391836376424E-30 in code. > > When serialized to file I get the value as 0 > > This is not acceptable. Something is truncating my double value. We are trying to balance between writing too much (e.g., some users expect 9999.9999 and get -9999.999900000000707) and too little (your case) information while serializing floating-point numbers. It has been tricky to satisfy everybody. In XSD 3.1.0 by default we serialize the number of decimal digits that the type can represent without change as opposed to just the number of potentially significant decimal digits (that's what XSD 2.x.x uses by default). See the following paper for some background information: http://www2.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1822.pdf You can achieve the same behavior as in 2.x.x by compiling your code with XSD_FP_ALL_DIGITS macro defined. It is also possible to customize the build-in floating point types (xsd:float, xsd:double, xsd:decimal) as well as their parsing and serialization routines in order to implement custom precision. The following example shown how to do this: http://www.codesynthesis.com/~boris/tmp/custom-double.zip Let me know if none of this helps. Boris From boris at codesynthesis.com Fri Jun 20 13:38:28 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] xs:double truncation In-Reply-To: <20080620161003.GJ8446@karelia> References: <20080620161003.GJ8446@karelia> Message-ID: <20080620173828.GK8446@karelia> Hi Aaron, Boris Kolpackov writes: > You can achieve the same behavior as in 2.x.x by compiling your code > with XSD_FP_ALL_DIGITS macro defined. Actually, this is not exactly true. In 2.x.x we mapped xsd:double to double and xsd:decimal to long double. Unfortunately, some compilers don't like the long double type and issue all kinds of warnings. So in 3.x.x we have changed the mapping: now both xsd:double and xsd:decimal are mapped to double. One negative consequence of this change is that because xsd:decimal cannot be in scientific notation and both xsd:double and xsd:decimal are mapped to double, xsd:double is always serialized in fixed notation. I think this is the reason why you get 0. One solution (illustrated in the custom-double example I mentioned earlier) is to re-map xsd:decimal back to long double and use scientific notation for xsd:double. Boris From abray at ara.com Fri Jun 20 14:35:12 2008 From: abray at ara.com (Aaron Bray ARA/SED) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] xs:double truncation In-Reply-To: <20080620173828.GK8446@karelia> References: <20080620161003.GJ8446@karelia> <20080620173828.GK8446@karelia> Message-ID: I have converted over to using the provided examples for double and decimal parsing and serialization It seems they are conflicting one another in definitions though. What would the correct way to remedy this situation? double-parsing.hxx(37) : error C2953: 'xsd::cxx::tree::traits' : class template has already been defined 1> c:\program files\codesynthesis xsd 3.1\include\xsd\cxx\tree\parsing\double.hxx(28) : see declaration of 'xsd::cxx::tree::traits' -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Friday, June 20, 2008 1:38 PM To: Aaron Bray ARA/SED Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] xs:double truncation Hi Aaron, Boris Kolpackov writes: > You can achieve the same behavior as in 2.x.x by compiling your code > with XSD_FP_ALL_DIGITS macro defined. Actually, this is not exactly true. In 2.x.x we mapped xsd:double to double and xsd:decimal to long double. Unfortunately, some compilers don't like the long double type and issue all kinds of warnings. So in 3.x.x we have changed the mapping: now both xsd:double and xsd:decimal are mapped to double. One negative consequence of this change is that because xsd:decimal cannot be in scientific notation and both xsd:double and xsd:decimal are mapped to double, xsd:double is always serialized in fixed notation. I think this is the reason why you get 0. One solution (illustrated in the custom-double example I mentioned earlier) is to re-map xsd:decimal back to long double and use scientific notation for xsd:double. Boris From boris at codesynthesis.com Fri Jun 20 14:38:46 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] xs:double truncation In-Reply-To: References: <20080620161003.GJ8446@karelia> <20080620173828.GK8446@karelia> Message-ID: <20080620183846.GL8446@karelia> Hi Aaron, Aaron Bray ARA/SED writes: > I have converted over to using the provided examples for double and > decimal parsing and serialization > It seems they are conflicting one another in definitions though. > What would the correct way to remedy this situation? > > double-parsing.hxx(37) : error C2953: 'xsd::cxx::tree::traits' > : class template has already been defined > 1> > c:\program files\codesynthesis xsd > 3.1\include\xsd\cxx\tree\parsing\double.hxx(28) : see declaration of > 'xsd::cxx::tree::traits' The double.hxx file shouldn't be included by the generated code if you are customizing the xsd:double and xsd:decimal types. I think one of the two things happen: 1. You don't have the following options when generating xml-schema.hxx (in which case double.hxx will be included by xml-schema.hxx) --custom-type double=double --custom-type "decimal=long double" 2. You don't have the following option when compiling some of your schemas (in which case double.hxx will be included by the generated header files for those schemas): --extern-xml-schema xml-schema.xsd Can you check if any of this is happening? If not, can you search the generated code to see which file(s) include double.hxx? Boris From abray at ara.com Fri Jun 20 16:24:23 2008 From: abray at ara.com (Aaron Bray ARA/SED) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] xs:double truncation In-Reply-To: <20080620183846.GL8446@karelia> References: <20080620161003.GJ8446@karelia> <20080620173828.GK8446@karelia> <20080620183846.GL8446@karelia> Message-ID: I did not have the --extern-xml-schema compiler option I can see that when I use it, it replaces the following include block #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include With the name of the .xsd file, only it changes the .xsd to .hxx Is it recommended that I have a xsd file that includes all the following but replaces double.hxx with the .hxx files provided in the sample zip? If not all base types are undefined error C2504: 'string' : base class undefined -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Friday, June 20, 2008 2:39 PM To: Aaron Bray ARA/SED Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] xs:double truncation Hi Aaron, Aaron Bray ARA/SED writes: > I have converted over to using the provided examples for double and > decimal parsing and serialization > It seems they are conflicting one another in definitions though. > What would the correct way to remedy this situation? > > double-parsing.hxx(37) : error C2953: 'xsd::cxx::tree::traits' > : class template has already been defined > 1> > c:\program files\codesynthesis xsd > 3.1\include\xsd\cxx\tree\parsing\double.hxx(28) : see declaration of > 'xsd::cxx::tree::traits' The double.hxx file shouldn't be included by the generated code if you are customizing the xsd:double and xsd:decimal types. I think one of the two things happen: 1. You don't have the following options when generating xml-schema.hxx (in which case double.hxx will be included by xml-schema.hxx) --custom-type double=double --custom-type "decimal=long double" 2. You don't have the following option when compiling some of your schemas (in which case double.hxx will be included by the generated header files for those schemas): --extern-xml-schema xml-schema.xsd Can you check if any of this is happening? If not, can you search the generated code to see which file(s) include double.hxx? Boris From abray at ara.com Fri Jun 20 17:08:00 2008 From: abray at ara.com (Aaron Bray ARA/SED) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] xs:double truncation In-Reply-To: <20080620183846.GL8446@karelia> References: <20080620161003.GJ8446@karelia> <20080620173828.GK8446@karelia> <20080620183846.GL8446@karelia> Message-ID: Ok, I figured it out, I am not sure how this works (there is explanation on your wiki, but it still hurts my head...) xsd.exe cxx-tree --generate-serialization --generate-ostream --generate-default-ctor --custom-type double=double --custom-type "decimal=long double" --hxx-epilogue-file xml-schema-epilogue.hxx --export-symbol __declspec(dllexport) --extern-xml-schema nucs-schema --generate-xml-schema nucs-schema I was not using the --generate-xml-schema command to generate the file --extern-xml-schema wanted It may be worth adding these two commands to your earlier referenced zip example README in the compile options All is well Thank you for the help! Aaron Bray -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Friday, June 20, 2008 2:39 PM To: Aaron Bray ARA/SED Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] xs:double truncation Hi Aaron, Aaron Bray ARA/SED writes: > I have converted over to using the provided examples for double and > decimal parsing and serialization > It seems they are conflicting one another in definitions though. > What would the correct way to remedy this situation? > > double-parsing.hxx(37) : error C2953: 'xsd::cxx::tree::traits' > : class template has already been defined > 1> > c:\program files\codesynthesis xsd > 3.1\include\xsd\cxx\tree\parsing\double.hxx(28) : see declaration of > 'xsd::cxx::tree::traits' The double.hxx file shouldn't be included by the generated code if you are customizing the xsd:double and xsd:decimal types. I think one of the two things happen: 1. You don't have the following options when generating xml-schema.hxx (in which case double.hxx will be included by xml-schema.hxx) --custom-type double=double --custom-type "decimal=long double" 2. You don't have the following option when compiling some of your schemas (in which case double.hxx will be included by the generated header files for those schemas): --extern-xml-schema xml-schema.xsd Can you check if any of this is happening? If not, can you search the generated code to see which file(s) include double.hxx? Boris From boris at codesynthesis.com Sun Jun 22 13:42:28 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] xs:double truncation In-Reply-To: References: <20080620161003.GJ8446@karelia> <20080620173828.GK8446@karelia> <20080620183846.GL8446@karelia> Message-ID: <20080622174228.GB23068@karelia> Hi Aaron, Aaron Bray ARA/SED writes: > Ok, I figured it out, I am not sure how this works (there is explanation > on your wiki, but it still hurts my head...) It might be a bit confusing in case of customizing built-in XML Schema types because there are two new features used at the same time: (1) By default the C++ mapping for XML Schema built-in types is placed into each generated header file. But you can instruct the XSD compiler to generate this mapping into a separate file and then include that file in other generated files. You generate such a header with the --generate-xml-schema option and include it in other generated headers with --extern-xml-schema (for more information on the semantics of these options see the XSD Compiler Command Line Manual[1]). (2) You can customize the XML Schema built-in types with the --custom-type option as described in the C++/Tree Mapping Customization Guide[2]. However, you can only do this when you are generating the XML Schema built-in types mapping into a separate file as described in (1). So if you want to customize a built-in type in your application you have to make two changes (1 and 2 above) at the same time. [1] http://www.codesynthesis.com/projects/xsd/documentation/xsd.xhtml [2] http://wiki.codesynthesis.com/Tree/Customization_guide Boris From Raymond.Rizzuto at sig.com Tue Jun 24 13:07:30 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] build issue with VisualStudio 2005 Message-ID: Hi! I have a Visual Studio 2005 project with a rather large schema file in it. Compiling the schema into C++ is the slowest part of the build process. When I make a code change to my application code, and rebuild, XSD is run against the schema file, even though the schema and its build options haven't changed. Is there some way to prevent that? I am building using the xsd-cxx-tree.rules for vc-8.0. My command line looks like this: xsd.exe cxx-tree --output-dir . --hxx-suffix .hxx --cxx-suffix .cxx --ixx-suffix .ixx --fwd-suffix -fwd.hxx --generate-serialization --generate-polymorphic --generate-ostream --generate-doxygen --generate-default-ctor --generate-from-base-ctor --generate-intellisense --type-naming ucc --function-naming lcc --root-element-all All settings were done from the Code Generation tab for the schema file, except for --root-element-all, which was set in the Additional Options pane of the Command Line tab. Ray ________________________________ Ray Rizzuto raymond.rizzuto@sig.com Susquehanna International Group (610)747-2336 (W) (215)776-3780 (C) ________________________________ IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses. From Raymond.Rizzuto at sig.com Tue Jun 24 12:31:03 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] namespace mapping Message-ID: Hi! I am using XSD version 3.1.0 on Windows with VisualStudio 2005. I get an exception when I serialize an object with this namespace map: xml_schema::NamespaceInfomap map; map[""].name = ""; map[""].schema = "SDMP-1.1.XSD"; message(std::cout, m, map); The exception is: First-chance exception at 0x7c812a5b in SDMPTest.exe: Microsoft C++ exception: xsd::cxx::xml::dom::mapping at memory location 0x0012eee8.. First-chance exception at 0x7c812a5b in SDMPTest.exe: Microsoft C++ exception: xsd::cxx::tree::no_namespace_mapping at memory location 0x0012f714.. According to the cxx-tree-guide, section 6.1, I was expecting the noNamespaceSchemaLocation attribute in the output with those settings. The only way I can get the code to run without an exception is to set name to http://sig.com/sdmp/messages, which is the value contained in SDMP-1.1.xsd: Any other value seems to exhibit the exception. Unfortunately, the schema is actually not located at that location, which is why I wanted to get the noNamespaceSchemaLocation attribute generated. Ray ________________________________ Ray Rizzuto raymond.rizzuto@sig.com Susquehanna International Group (610)747-2336 (W) (215)776-3780 (C) ________________________________ IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses. From boris at codesynthesis.com Tue Jun 24 14:29:45 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] build issue with VisualStudio 2005 In-Reply-To: References: Message-ID: <20080624182945.GF7443@karelia> Hi Raymond, Rizzuto, Raymond writes: > When I make a code change to my application code, and rebuild, XSD is > run against the schema file, even though the schema and its build > options haven't changed. Is there some way to prevent that? I am pretty sure this is the same problem as discussed recently in this thread: http://www.codesynthesis.com/pipermail/xsd-users/2008-June/001757.html Can you try to update the rules file with this revision and see if it solves the problem: http://www.codesynthesis.com/~boris/tmp/etc-3.1.1.zip Boris From Raymond.Rizzuto at sig.com Tue Jun 24 15:03:12 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] build issue with VisualStudio 2005 In-Reply-To: <20080624182945.GF7443@karelia> References: <20080624182945.GF7443@karelia> Message-ID: Boris, Thanks - the later rules files fix that annoyance! Ray -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Tuesday, June 24, 2008 2:30 PM To: Rizzuto, Raymond Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] build issue with VisualStudio 2005 Hi Raymond, Rizzuto, Raymond writes: > When I make a code change to my application code, and rebuild, XSD is > run against the schema file, even though the schema and its build > options haven't changed. Is there some way to prevent that? I am pretty sure this is the same problem as discussed recently in this thread: http://www.codesynthesis.com/pipermail/xsd-users/2008-June/001757.html Can you try to update the rules file with this revision and see if it solves the problem: http://www.codesynthesis.com/~boris/tmp/etc-3.1.1.zip Boris IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses. From boris at codesynthesis.com Tue Jun 24 14:41:28 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] namespace mapping In-Reply-To: References: Message-ID: <20080624184128.GG7443@karelia> Hi Ray, Rizzuto, Raymond writes: > xml_schema::NamespaceInfomap map; > map[""].name = ""; > map[""].schema = "SDMP-1.1.XSD"; > message(std::cout, m, map); > > [...] > > xmlns="http://sig.com/sdmp/messages" > targetNamespace="http://sig.com/sdmp/messages" > elementFormDefault="qualified" > attributeFormDefault="unqualified" version="1.1"> You get this exception because your vocabulary uses the http://sig.com/sdmp/messages namespace however you haven't provided the prefix-namespace mapping for it. I also think you are confusing the namespace part in the schemaLocation attribute with the place where the schema is located. In reality the namespace part should be the same as the targetNamespace attribute in your schema (only if your schema does not have targetNamespace should you be using noNamespaceSchemaLocation). The actual schema name can contain an absolute path (or even a remote URI), for example: schemaLocation="http://sig.com/sdmp/messages http://sig.com/SDMP-1.1.XSD" If the schema name is not a URI then it is resolved relative to the location of the XML document that contains the schemaLocation attribute (note that the namespace part is not used to locate the schema). There is also a number of ways to override the schema location information that comes from XML documents. For more information on this see Section 5.1, "XML Schema Validation and Searching" in the C++/Tree Mapping Getting Started Guide: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/#5.1 Boris From abray at ara.com Tue Jun 24 15:10:19 2008 From: abray at ara.com (Aaron Bray ARA/SED) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] build issue with VisualStudio 2005 In-Reply-To: References: Message-ID: I first off write a simple batch file to run xsd.exe on all my *.xsd files (it would contain your call below) This generates my cxx and hxx files I then have a DLL project dedicated to building the XSD generated classes and link to it with my other APIs. To avoid calling this batch file each time the project gets asked to build, I use ant Ant has a nice feature of checking to see if any *xsd files have been updated, run the batch, if no files have been updated since the last build, xsd.exe is not run. In my Schema DLL project I create a 'Build Events'->Pre-Build Event I add a command line: ant -s buildSchema.xml compilenative This calls ant to call the ant buildSchema.xml with the compilenative target I have the following targets in my ant xml file And Since compile native gets called from my vcproj ant will not run the buildSchema.bat file unless an .xsd file is new than the touch file. Does that help? -----Original Message----- From: xsd-users-bounces@codesynthesis.com [mailto:xsd-users-bounces@codesynthesis.com] On Behalf Of Rizzuto, Raymond Sent: Tuesday, June 24, 2008 1:08 PM To: xsd-users@codesynthesis.com Subject: [xsd-users] build issue with VisualStudio 2005 Hi! I have a Visual Studio 2005 project with a rather large schema file in it. Compiling the schema into C++ is the slowest part of the build process. When I make a code change to my application code, and rebuild, XSD is run against the schema file, even though the schema and its build options haven't changed. Is there some way to prevent that? I am building using the xsd-cxx-tree.rules for vc-8.0. My command line looks like this: xsd.exe cxx-tree --output-dir . --hxx-suffix .hxx --cxx-suffix .cxx --ixx-suffix .ixx --fwd-suffix -fwd.hxx --generate-serialization --generate-polymorphic --generate-ostream --generate-doxygen --generate-default-ctor --generate-from-base-ctor --generate-intellisense --type-naming ucc --function-naming lcc --root-element-all All settings were done from the Code Generation tab for the schema file, except for --root-element-all, which was set in the Additional Options pane of the Command Line tab. Ray ________________________________ Ray Rizzuto raymond.rizzuto@sig.com Susquehanna International Group (610)747-2336 (W) (215)776-3780 (C) ________________________________ IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses. From Raymond.Rizzuto at sig.com Tue Jun 24 17:44:48 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] namespace mapping In-Reply-To: <20080624184128.GG7443@karelia> References: <20080624184128.GG7443@karelia> Message-ID: Boris, Thanks - I think I was getting namespace, prefix and location confused. I'm still learning about XML Schema's (prior experience was DTD) and the XSD tool, and not sure I understand why I even need to specify a mapping to serialize the objects. The fact that XSD insulates me from needing to know the details of serialization is a double edged sword. Is it possible that XSD could choose unique prefixes for the namespaces in the document? Anyway, for now, I have made changes that seem to work. If I understand correctly, I can use an empty prefix with a namespace of "http://sig.com/sdmp/messages". I also have no schemaLocation. So it makes sense that I need the map of the empty prefix to specify name="http://sig.com/sdmp/messages" and that I don't/can't specify a schema location since the schema is not going to be available to the running code. I also came across the no_xml_declaration flag - I may end up using that since I have no need for the xml header in my application. It is an intra-company application, where both ends will be using XML binding against the same schema. My end will be using XSD, the other end is a C# application using another binding tool. Ray -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Tuesday, June 24, 2008 2:41 PM To: Rizzuto, Raymond Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] namespace mapping Hi Ray, Rizzuto, Raymond writes: > xml_schema::NamespaceInfomap map; > map[""].name = ""; > map[""].schema = "SDMP-1.1.XSD"; > message(std::cout, m, map); > > [...] > > xmlns="http://sig.com/sdmp/messages" > targetNamespace="http://sig.com/sdmp/messages" > elementFormDefault="qualified" > attributeFormDefault="unqualified" version="1.1"> You get this exception because your vocabulary uses the http://sig.com/sdmp/messages namespace however you haven't provided the prefix-namespace mapping for it. I also think you are confusing the namespace part in the schemaLocation attribute with the place where the schema is located. In reality the namespace part should be the same as the targetNamespace attribute in your schema (only if your schema does not have targetNamespace should you be using noNamespaceSchemaLocation). The actual schema name can contain an absolute path (or even a remote URI), for example: schemaLocation="http://sig.com/sdmp/messages http://sig.com/SDMP-1.1.XSD" If the schema name is not a URI then it is resolved relative to the location of the XML document that contains the schemaLocation attribute (note that the namespace part is not used to locate the schema). There is also a number of ways to override the schema location information that comes from XML documents. For more information on this see Section 5.1, "XML Schema Validation and Searching" in the C++/Tree Mapping Getting Started Guide: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/# 5.1 Boris IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses. From gabriele.zanetti at ing.unibs.it Wed Jun 25 04:27:56 2008 From: gabriele.zanetti at ing.unibs.it (gabriele.zanetti@ing.unibs.it) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] xercer compilin error (Wrapper4InputSource) Message-ID: <20080625102756.oeck965d76isooko@webmail.ing.unibs.it> Hi, I'm trying to use xsd 3.0.0 and xerces 2.8.0 to create some cxx and hxx file from a XML schema that I'll use in a bigger project. I'm using win2000. There's some problem compiling the code (with Eclipse): I've a lot of "undefined reference" where there's a "::xercesc::Wrapper4InputSource" calling. In other point of the code, there are lines like "::xercesc::DOMDocument" that run without any problem. I'm using the binary code of both the package including in my project the libraries of xerces and the xsd's header file needed. then, I tryed to follow the instruction in http://www.codesynthesis.com/projects/xsd/extras/build-windows.xhtml but I can't go beyond the "Libcult" point (using all the libcult version I founded: 1.2.0 , 1.3.0, 1.4.0) how thanks From boris at codesynthesis.com Wed Jun 25 04:16:33 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] xercer compilin error (Wrapper4InputSource) In-Reply-To: <20080625102756.oeck965d76isooko@webmail.ing.unibs.it> References: <20080625102756.oeck965d76isooko@webmail.ing.unibs.it> Message-ID: <20080625081633.GD12421@karelia> Hi Gabriele gabriele.zanetti@ing.unibs.it writes: > I'm trying to use xsd 3.0.0 and xerces 2.8.0 to create some cxx and hxx > file from a XML schema that I'll use in a bigger project. I'm using win2000. > > There's some problem compiling the code (with Eclipse): I've a lot of > "undefined reference" where there's a "::xercesc::Wrapper4InputSource" > calling. In other point of the code, there are lines like > "::xercesc::DOMDocument" that run without any problem. > > I'm using the binary code of both the package including in my project the > libraries of xerces and the xsd's header file needed. > > then, I tryed to follow the instruction in > http://www.codesynthesis.com/projects/xsd/extras/build-windows.xhtml > but I can't go beyond the "Libcult" point (using all the libcult version I > founded: 1.2.0 , 1.3.0, 1.4.0) These instructions are for building the XSD compiler from source code. If you have already downloaded the precompiled binary for Windows then you don't need these. I understand that you are trying to link the generated code and get undefined symbols pointing to Xerces-C++. I think you are either not linking to the Xerces-C++ library (check your project settings in Eclipse) or you are using the Xerces-C++ library that was built with a different compiler. Precompiled Xerces-C++ libraries available from the Xerces-C++ website were built with VC++ 7.1 and 8.0. If you are using g++ (Mingw or Cygwin) then you will need to build Xerces-C++ from source. You can following these instructions: http://xerces.apache.org/xerces-c/build.html Boris From ashoknn at qualcomm.com Wed Jun 25 04:58:29 2008 From: ashoknn at qualcomm.com (Ashok Nalkund) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Re: Validation during serialization? Message-ID: <486208B5.2060703@qualcomm.com> Hi Boris, I am facing the exact problem that Timothy is facing. I tried to get xsd to validate the object during serialization but no luck. Then I found this post from last month on the users mailing list. Do you have an idea when the validation for serialization would be available? tia, ashok PS: I'm not subscribed to the mailing list, please cc me on the response. > Hi Timothy, > > Lenz, Timothy K writes: > >> I am currently parsing and serializing XML files with the greatest of >> ease using XSD. My problem is, however, that I can't figure out how to >> validate what I serialize against the XML schema without reparsing what >> I just serialized. > > The C++/Tree mapping does not support XML Schema validation during > serialization (it uses underlying parser's XML Schema validation > capabilities and Xerces-C++ does not support validation during > serialization). > > We are, however, working on another XML Schema to C++ mapping which > will provide XML Schema validation in the generated code for both > parsing and serialization. > > Boris > From boris at codesynthesis.com Wed Jun 25 08:36:54 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] namespace mapping In-Reply-To: References: <20080624184128.GG7443@karelia> Message-ID: <20080625123654.GH12421@karelia> Hi Ray, Rizzuto, Raymond writes: > The fact that XSD insulates me from needing to know the details of > serialization is a double edged sword. Is it possible that XSD could > choose unique prefixes for the namespaces in the document? No at the moment but we may add this functionality in the future. Generally, people prefer to assign meaningful prefixes to their namespaces instead of something like p1, p2, etc. > Anyway, for now, I have made changes that seem to work. If I understand > correctly, I can use an empty prefix with a namespace of > "http://sig.com/sdmp/messages". Yes, you can make http://sig.com/sdmp/messages the default namespace (i.e., empty prefix) as long as you have all elements in your vocabulary qualified (elementFormDefault="qualified"). Boris From boris at codesynthesis.com Wed Jun 25 08:56:13 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Re: Validation during serialization? In-Reply-To: <486208B5.2060703@qualcomm.com> References: <486208B5.2060703@qualcomm.com> Message-ID: <20080625125613.GJ12421@karelia> Hi Ashok, Ashok Nalkund writes: > I am facing the exact problem that Timothy is facing. I tried to get > xsd to validate the object during serialization but no luck. Then I > found this post from last month on the users mailing list. > > Do you have an idea when the validation for serialization would be > available? We plan to have a C++/Tree-like mapping with support for validation during serialization available in the next 3-4 months. However, it will first appear in XSD/e, our embedded systems offering. There is also a workaround for the C++/Tree mapping that you can use in the meantime. It involves serializing the object model into XML and re-parsing the result (perhaps only to DOM or even using SAX) with validation enabled. One approach would be to serialize the document into an in-memory buffer, re-parse it (possibly using DOM or SAX parser for improved performance) to make sure it is valid, and then write it to its final destination (e.g., a file). Finally, you may also find the following post useful. It analyzes possible use cases for in-memory or serialization-time validation and comes to the conclusion that generally the application can't really do anything about an invalid document except knowing that it is invalid: http://www.codesynthesis.com/pipermail/xsd-users/2008-January/001443.html Boris From Raymond.Rizzuto at sig.com Wed Jun 25 13:13:31 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] namespace mapping In-Reply-To: <20080625123654.GH12421@karelia> References: <20080624184128.GG7443@karelia> <20080625123654.GH12421@karelia> Message-ID: Boris, I agree that the user should be able to specify a prefix if they want, but it would be nice if that was an option. I.e. it would be nice if I could just call the serialize function with the output stream and the object to serialize. Ray -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Wednesday, June 25, 2008 8:37 AM To: Rizzuto, Raymond Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] namespace mapping Hi Ray, Rizzuto, Raymond writes: > The fact that XSD insulates me from needing to know the details of > serialization is a double edged sword. Is it possible that XSD could > choose unique prefixes for the namespaces in the document? No at the moment but we may add this functionality in the future. Generally, people prefer to assign meaningful prefixes to their namespaces instead of something like p1, p2, etc. > Anyway, for now, I have made changes that seem to work. If I understand > correctly, I can use an empty prefix with a namespace of > "http://sig.com/sdmp/messages". Yes, you can make http://sig.com/sdmp/messages the default namespace (i.e., empty prefix) as long as you have all elements in your vocabulary qualified (elementFormDefault="qualified"). Boris IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses. From Raymond.Rizzuto at sig.com Wed Jun 25 15:56:48 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] feature request Message-ID: IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses. From ashoknn at qualcomm.com Wed Jun 25 18:50:44 2008 From: ashoknn at qualcomm.com (Ashok Nalkund) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Re: Validation during serialization? In-Reply-To: <20080625125613.GJ12421@karelia> References: <486208B5.2060703@qualcomm.com> <20080625125613.GJ12421@karelia> Message-ID: <4862CBC4.9040804@qualcomm.com> Thanks Boris. Since I already provide deserialization functionality, I could use it as is to validate the generated xml. It may not be the most efficient way to implement, but an easy one. Also I might disable in the general run and have it conditionally enabled which will address efficiency to some extent. Thanks for your ideas. ashok Boris Kolpackov wrote: > Hi Ashok, > > Ashok Nalkund writes: > >> I am facing the exact problem that Timothy is facing. I tried to get >> xsd to validate the object during serialization but no luck. Then I >> found this post from last month on the users mailing list. >> >> Do you have an idea when the validation for serialization would be >> available? > > We plan to have a C++/Tree-like mapping with support for validation > during serialization available in the next 3-4 months. However, it > will first appear in XSD/e, our embedded systems offering. > > There is also a workaround for the C++/Tree mapping that you can use > in the meantime. It involves serializing the object model into XML > and re-parsing the result (perhaps only to DOM or even using SAX) > with validation enabled. One approach would be to serialize the > document into an in-memory buffer, re-parse it (possibly using DOM > or SAX parser for improved performance) to make sure it is valid, > and then write it to its final destination (e.g., a file). > > Finally, you may also find the following post useful. It analyzes > possible use cases for in-memory or serialization-time validation > and comes to the conclusion that generally the application can't > really do anything about an invalid document except knowing that > it is invalid: > > http://www.codesynthesis.com/pipermail/xsd-users/2008-January/001443.html > > Boris -- DRM support: mediaflo.eng.drm.support@qualcomm.com SCS support: mediaflo.openca.scs.support@qualcomm.com OpenCas support: mediaflo.openca.headend.dev.support@qualcomm.com What awful irony is this? We are as gods, but know it not. ATGATT: All The Gear All The Time! Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird/ From petteri.tolonen at logica.com Thu Jun 26 06:38:58 2008 From: petteri.tolonen at logica.com (Tolonen, Petteri) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] xsd:decimal and fractation digits Message-ID: <9CD0EFB2583B894190C8D1883F0085B5146D81F742@SE-EX007.groupinfra.com> Hi, My problem is too many decimal digits in decimal fields. When fractation digits will be supported? Part of my schema: I'll set Quantity to 213.23 and result aint what i am looking for. Result: 213.22999999999999 kg As i readed posts, i run in to this http://codesynthesis.com/pipermail/xsd-users/2007-September/001215.html Should i try to make custom decimal type or should i make custon type from Quantity with decimal truncation? What if there will be more xsd:desimal elements with different amount of fractation digits. And does it have effect that Quantity's parent element is also Quantity? For note: I can't make changes to schema. An another thing, i tried to read back the generated xml and i'll get these errors for every element: error: Element 'Quantity' should be un-qualified Sample xml: ... 213.22999999999999 ... Petteri Tolonen From Michael.Forstner at cpg.de Thu Jun 26 07:26:08 2008 From: Michael.Forstner at cpg.de (Forstner Michael) Date: Sun Oct 11 15:34:03 2009 Subject: AW: [xsd-users] xsd:decimal and fractation digits In-Reply-To: <9CD0EFB2583B894190C8D1883F0085B5146D81F742@SE-EX007.groupinfra.com> References: <9CD0EFB2583B894190C8D1883F0085B5146D81F742@SE-EX007.groupinfra.com> Message-ID: Hi, I've had the same problem and patched the XSD-Library for my needs: include/xsd/cxx/tree/serialization.hxx: inline void operator<< (xercesc::DOMElement& e, double d) { std::basic_ostringstream os; os.imbue (std::locale::classic ()); os.precision(2); //Patch: ALWAYS 2 fraction digits // We map both xsd:double and xsd:decimal to double and decimal [...] e << s; } inline void operator<< (xercesc::DOMAttr& a, double d) { std::basic_ostringstream os; os.imbue (std::locale::classic ()); os.precision (2); //Patch: ALWAYS 2 fraction digits // We map both xsd:double and xsd:decimal to double and decimal [...] a << s; } Hope that helps. Regards, Michael > -----Urspr?ngliche Nachricht----- > Von: xsd-users-bounces@codesynthesis.com > [mailto:xsd-users-bounces@codesynthesis.com] Im Auftrag von > Tolonen, Petteri > Gesendet: Donnerstag, 26. Juni 2008 12:39 > An: xsd-users@codesynthesis.com > Betreff: [xsd-users] xsd:decimal and fractation digits > > Hi, > > My problem is too many decimal digits in decimal fields. > When fractation digits will be supported? > > Part of my schema: > > > > > > > > > > > > > > > > > I'll set Quantity to 213.23 and result aint what i am looking for. > > Result: > > 213.22999999999999 > kg > > > As i readed posts, i run in to this > http://codesynthesis.com/pipermail/xsd-users/2007-September/00 > 1215.html > > Should i try to make custom decimal type or should i make > custon type from Quantity with decimal truncation? > What if there will be more xsd:desimal elements with > different amount of fractation digits. > And does it have effect that Quantity's parent element is > also Quantity? > > For note: I can't make changes to schema. > > An another thing, i tried to read back the generated xml and i'll get > these errors for every element: > > error: Element 'Quantity' should be un-qualified > > Sample xml: > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="MYOWNNAMESPACE MYXSDFILE.xsd"> > ... > > 213.22999999999999 > ... > > > > Petteri Tolonen > > From boris at codesynthesis.com Thu Jun 26 07:17:12 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] xsd:decimal and fractation digits In-Reply-To: <9CD0EFB2583B894190C8D1883F0085B5146D81F742@SE-EX007.groupinfra.com> References: <9CD0EFB2583B894190C8D1883F0085B5146D81F742@SE-EX007.groupinfra.com> Message-ID: <20080626111712.GB3508@karelia> Hi Petteri, Tolonen, Petteri writes: > When fractation digits will be supported? There are no immediate plans to support this feature. > > > > > > > > > > > > > > > > > I'll set Quantity to 213.23 and result aint what i am looking for. > > Result: > > 213.22999999999999 > kg > > > Should i try to make custom decimal type or should i make custom type > from Quantity with decimal truncation? What if there will be more > xsd:desimal elements with different amount of fractation digits. I would say that unless you have many xsd:decimal-based types and all of them have the same fractionDigits/totalDigits requirements, you should customize the Quantity type instead of xsd:decimal. > And does it have effect that Quantity's parent element is also Quantity? No, customization happens on the type level (the anonymous type for the Quantity element is automatically morphed into a named type with the same name). The custom/wildcard example shows how to customize parsing/serialization code via custom types (in this case you only need to customize serialization). If you would like to customize xsd:decimal, take a look the custom-double example: http://www.codesynthesis.com/~boris/tmp/custom-double.zip It also contains code that shows how to set notation/precision, remove trailing zeros, etc. > An another thing, i tried to read back the generated xml and i'll get > these errors for every element: > > error: Element 'Quantity' should be un-qualified You use the default namespace (xmlns="MYOWNNAMESPACE") which means that all elements in your vocabulary should be qualified. Try to assign some non-empty prefix to the namespace during serialization (so that it looks something like xmlns:mon="MYOWNNAMESPACE"). Boris From bruno.marotta at fortis.com Thu Jun 26 09:56:18 2008 From: bruno.marotta at fortis.com (bruno.marotta@fortis.com) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Access Violation Message-ID: <8E2E628CE354934FAB31A90699BCFA0D03F584A1@spmw0018.mail.shared.fortis> Hi, I have a very simple class automatically generated by cxx tree, that when instantiated like this: obj.action((xml::action::value)at); raises an Access Violation... at is an integer and its current value is 17. From the call stack it seems that the error occurs when freeing a temporarily created action instance... Here follows the class definition: class __declspec(dllexport) action: public ::xml_schema::string { public: enum value { New, LimitCheck, Exercise, Expiry, BarrierHit, Cancel, CancelAndReissue, Restructure, EarlyTermination, Fixing, Unwind, CancelOfMO, Novation, Netting, AddTrial, Update, Delete, OtherContractEvent }; action (); action (value v); action (const ::xml_schema::string& v); action (const ::xercesc::DOMElement& e, ::xml_schema::flags f = 0, ::xml_schema::type* c = 0); action (const ::xercesc::DOMAttr& a, ::xml_schema::flags f = 0, ::xml_schema::type* c = 0); action (const ::std::string& s, const ::xercesc::DOMElement* e, ::xml_schema::flags f = 0, ::xml_schema::type* c = 0); action (const action& x, ::xml_schema::flags f = 0, ::xml_schema::type* c = 0); virtual action* _clone (::xml_schema::flags f = 0, ::xml_schema::type* c = 0) const; action& operator= (value v); virtual operator value () const { return _xsd_action_convert (); } protected: value _xsd_action_convert () const; public: static const char* const _xsd_action_literals_[18]; static const value _xsd_action_indexes_[18]; }; The class code: // action // action:: action () : ::xml_schema::string () { } action:: action (value v) : ::xml_schema::string (_xsd_action_literals_[v]) { } action:: action (const ::xml_schema::string& v) : ::xml_schema::string (v) { } action:: action (const action& v, ::xml_schema::flags f, ::xml_schema::type* c) : ::xml_schema::string (v, f, c) { } action& action:: operator= (value v) { static_cast< ::xml_schema::string& > (*this) = ::xml_schema::string (_xsd_action_literals_[v]); return *this; } The call stack: ntdll.dll!_DbgBreakPoint@0() vrfcore.dll!00363933() vfbasics.dll!003a09b7() vfbasics.dll!0039b953() msvcr71d.dll!_heap_alloc_base(unsigned int size=3846624) Line 212 C vfbasics.dll!003a236f() vfbasics.dll!003a236f() vfbasics.dll!0039928a() vfbasics.dll!0039928a() vfbasics.dll!0039707a() vfbasics.dll!003967ed() vrfcore.dll!00367487() ntdll.dll!_RtlpDphReportCorruptedBlock@16() + 0x151 ntdll.dll!_RtlpDphNormalHeapFree@12() + 0x2e ntdll.dll!_RtlpDebugPageHeapFree@12() + 0x79 ntdll.dll!_RtlDebugFreeHeap@12() + 0x2c ntdll.dll!_RtlFreeHeapSlowly@12() + 0x23d19 ntdll.dll!_RtlFreeHeap@12() + 0x16470 vfbasics.dll!0039bb0b() msvcr71.dll!free(void * pBlock=0x0a8120a0) Line 103 C msvcp71.dll!std::basic_string,std::allocator >::_Tidy(bool _Built=true, unsigned int _Newsize=0) Line 1517 + 0x6 C++ msvcp71.dll!std::basic_string,std::allocator >::~basic_string,std::allocator >() Line 458 C++ TradeExporterBase.dll!xsd::cxx::tree::string >::~string >() + 0x6b C++ TradeExporterBase.dll!xml::action::~action() + 0x2b C++ I hope you can help me. Regards, Bruno Marotta -------------- next part -------------- = = = = = = = = = = = = = = = = = = = = = = = = = Fortis disclaimer : http://www.fortis.be/legal/disclaimer.htm Privacy policy related to banking activities of Fortis: http://www.fortis.be/legal/privacy_policy.htm = = = = = = = = = = = = = = = = = = = = = = = = = From boris at codesynthesis.com Thu Jun 26 10:00:42 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Access Violation In-Reply-To: <8E2E628CE354934FAB31A90699BCFA0D03F584A1@spmw0018.mail.shared.fortis> References: <8E2E628CE354934FAB31A90699BCFA0D03F584A1@spmw0018.mail.shared.fortis> Message-ID: <20080626140042.GE3508@karelia> Hi Bruno, bruno.marotta@fortis.com writes: > obj.action((xml::action::value)at); > > raises an Access Violation... > > [...] > > The call stack: > > ntdll.dll!_DbgBreakPoint@0() > vrfcore.dll!00363933() > vfbasics.dll!003a09b7() > vfbasics.dll!0039b953() > msvcr71d.dll!_heap_alloc_base(unsigned int size=3846624) Line 212 C > vfbasics.dll!003a236f() > vfbasics.dll!003a236f() > vfbasics.dll!0039928a() > vfbasics.dll!0039928a() > vfbasics.dll!0039707a() > vfbasics.dll!003967ed() > vrfcore.dll!00367487() > ntdll.dll!_RtlpDphReportCorruptedBlock@16() + 0x151 > ntdll.dll!_RtlpDphNormalHeapFree@12() + 0x2e > ntdll.dll!_RtlpDebugPageHeapFree@12() + 0x79 > ntdll.dll!_RtlDebugFreeHeap@12() + 0x2c > ntdll.dll!_RtlFreeHeapSlowly@12() + 0x23d19 > ntdll.dll!_RtlFreeHeap@12() + 0x16470 > vfbasics.dll!0039bb0b() > msvcr71.dll!free(void * pBlock=0x0a8120a0) Line 103 C > msvcp71.dll!std::basic_string,std::allocator >::_Tidy(bool _Built=true, unsigned int _Newsize=0) Line 1517 + 0x6 C++ > msvcp71.dll!std::basic_string,std::allocator >::~basic_string,std::allocator >() Line 458 C++ > TradeExporterBase.dll!xsd::cxx::tree::string >::~string >() + 0x6b C++ > TradeExporterBase.dll!xml::action::~action() + 0x2b C++ Since the enum value is legal the only suspect I have is the situation where the memory is allocated and deallocated on different heaps. Looking at the stack trace I see both msvcr71.dll and msvcr71d.dll which may indicate that your DLLs are built using different runtime libraries. Try to make sure that all your DLLs that contain the generated code as well the executable use the same runtime flavor (e.g., debug/release, single/multi-threaded) and the runtime is DLL. If the above does not help I will need a small test case from you that reproduces the problem. Boris From bruno.marotta at fortis.com Thu Jun 26 10:51:18 2008 From: bruno.marotta at fortis.com (bruno.marotta@fortis.com) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Access Violation In-Reply-To: <8E2E628CE354934FAB31A90699BCFA0D03F584A1@spmw0018.mail.shared.fortis> References: <8E2E628CE354934FAB31A90699BCFA0D03F584A1@spmw0018.mail.shared.fortis> Message-ID: <8E2E628CE354934FAB31A90699BCFA0D03F584A2@spmw0018.mail.shared.fortis> Find out the solution (but it does make too much sense). If a create the object explicitely it works: obj.action(xml::action((xml::action::value)at)); in the place of obj.action((xml::action::value)at); Regards -----Original Message----- From: xsd-users-bounces@codesynthesis.com [mailto:xsd-users-bounces@codesynthesis.com] On Behalf Of Marotta Bruno Sent: Thursday, June 26, 2008 3:56 PM To: xsd-users@codesynthesis.com Subject: [xsd-users] Access Violation Hi, I have a very simple class automatically generated by cxx tree, that when instantiated like this: obj.action((xml::action::value)at); raises an Access Violation... at is an integer and its current value is 17. From the call stack it seems that the error occurs when freeing a temporarily created action instance... Here follows the class definition: class __declspec(dllexport) action: public ::xml_schema::string { public: enum value { New, LimitCheck, Exercise, Expiry, BarrierHit, Cancel, CancelAndReissue, Restructure, EarlyTermination, Fixing, Unwind, CancelOfMO, Novation, Netting, AddTrial, Update, Delete, OtherContractEvent }; action (); action (value v); action (const ::xml_schema::string& v); action (const ::xercesc::DOMElement& e, ::xml_schema::flags f = 0, ::xml_schema::type* c = 0); action (const ::xercesc::DOMAttr& a, ::xml_schema::flags f = 0, ::xml_schema::type* c = 0); action (const ::std::string& s, const ::xercesc::DOMElement* e, ::xml_schema::flags f = 0, ::xml_schema::type* c = 0); action (const action& x, ::xml_schema::flags f = 0, ::xml_schema::type* c = 0); virtual action* _clone (::xml_schema::flags f = 0, ::xml_schema::type* c = 0) const; action& operator= (value v); virtual operator value () const { return _xsd_action_convert (); } protected: value _xsd_action_convert () const; public: static const char* const _xsd_action_literals_[18]; static const value _xsd_action_indexes_[18]; }; The class code: // action // action:: action () : ::xml_schema::string () { } action:: action (value v) : ::xml_schema::string (_xsd_action_literals_[v]) { } action:: action (const ::xml_schema::string& v) : ::xml_schema::string (v) { } action:: action (const action& v, ::xml_schema::flags f, ::xml_schema::type* c) : ::xml_schema::string (v, f, c) { } action& action:: operator= (value v) { static_cast< ::xml_schema::string& > (*this) = ::xml_schema::string (_xsd_action_literals_[v]); return *this; } The call stack: ntdll.dll!_DbgBreakPoint@0() vrfcore.dll!00363933() vfbasics.dll!003a09b7() vfbasics.dll!0039b953() msvcr71d.dll!_heap_alloc_base(unsigned int size=3846624) Line 212 C vfbasics.dll!003a236f() vfbasics.dll!003a236f() vfbasics.dll!0039928a() vfbasics.dll!0039928a() vfbasics.dll!0039707a() vfbasics.dll!003967ed() vrfcore.dll!00367487() ntdll.dll!_RtlpDphReportCorruptedBlock@16() + 0x151 ntdll.dll!_RtlpDphNormalHeapFree@12() + 0x2e ntdll.dll!_RtlpDebugPageHeapFree@12() + 0x79 ntdll.dll!_RtlDebugFreeHeap@12() + 0x2c ntdll.dll!_RtlFreeHeapSlowly@12() + 0x23d19 ntdll.dll!_RtlFreeHeap@12() + 0x16470 vfbasics.dll!0039bb0b() msvcr71.dll!free(void * pBlock=0x0a8120a0) Line 103 C msvcp71.dll!std::basic_string,std::allocator >::_Tidy(bool _Built=true, unsigned int _Newsize=0) Line 1517 + 0x6 C++ msvcp71.dll!std::basic_string,std::allocator >::~basic_string,std::allocator >() Line 458 C++ TradeExporterBase.dll!xsd::cxx::tree::string >::~string >() + 0x6b C++ TradeExporterBase.dll!xml::action::~action() + 0x2b C++ I hope you can help me. Regards, Bruno Marotta = = = = = = = = = = = = = = = = = = = = = = = = = Fortis disclaimer : http://www.fortis.be/legal/disclaimer.htm Privacy policy related to banking activities of Fortis: http://www.fortis.be/legal/privacy_policy.htm = = = = = = = = = = = = = = = = = = = = = = = = = From bruno.marotta at fortis.com Thu Jun 26 11:26:02 2008 From: bruno.marotta at fortis.com (bruno.marotta@fortis.com) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] Access Violation In-Reply-To: <20080626140042.GE3508@karelia> References: <8E2E628CE354934FAB31A90699BCFA0D03F584A1@spmw0018.mail.shared.fortis> <20080626140042.GE3508@karelia> Message-ID: <8E2E628CE354934FAB31A90699BCFA0D03F584A4@spmw0018.mail.shared.fortis> And yes, you were right. The application was linking with both libraries. Thanks! -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Thursday, June 26, 2008 4:01 PM To: Marotta Bruno Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] Access Violation Hi Bruno, bruno.marotta@fortis.com writes: > obj.action((xml::action::value)at); > > raises an Access Violation... > > [...] > > The call stack: > > ntdll.dll!_DbgBreakPoint@0() > vrfcore.dll!00363933() > vfbasics.dll!003a09b7() > vfbasics.dll!0039b953() > msvcr71d.dll!_heap_alloc_base(unsigned int size=3846624) Line 212 C > vfbasics.dll!003a236f() > vfbasics.dll!003a236f() > vfbasics.dll!0039928a() > vfbasics.dll!0039928a() > vfbasics.dll!0039707a() > vfbasics.dll!003967ed() > vrfcore.dll!00367487() > ntdll.dll!_RtlpDphReportCorruptedBlock@16() + 0x151 > ntdll.dll!_RtlpDphNormalHeapFree@12() + 0x2e > ntdll.dll!_RtlpDebugPageHeapFree@12() + 0x79 > ntdll.dll!_RtlDebugFreeHeap@12() + 0x2c > ntdll.dll!_RtlFreeHeapSlowly@12() + 0x23d19 > ntdll.dll!_RtlFreeHeap@12() + 0x16470 > vfbasics.dll!0039bb0b() > msvcr71.dll!free(void * pBlock=0x0a8120a0) Line 103 C > msvcp71.dll!std::basic_string,std::allocator >::_Tidy(bool _Built=true, unsigned int _Newsize=0) Line 1517 + 0x6 C++ > msvcp71.dll!std::basic_string,std::allocator >::~basic_string,std::allocator >() Line 458 C++ > TradeExporterBase.dll!xsd::cxx::tree::string >::~string >() + 0x6b C++ > TradeExporterBase.dll!xml::action::~action() + 0x2b C++ Since the enum value is legal the only suspect I have is the situation where the memory is allocated and deallocated on different heaps. Looking at the stack trace I see both msvcr71.dll and msvcr71d.dll which may indicate that your DLLs are built using different runtime libraries. Try to make sure that all your DLLs that contain the generated code as well the executable use the same runtime flavor (e.g., debug/release, single/multi-threaded) and the runtime is DLL. If the above does not help I will need a small test case from you that reproduces the problem. Boris = = = = = = = = = = = = = = = = = = = = = = = = = Fortis disclaimer : http://www.fortis.be/legal/disclaimer.htm Privacy policy related to banking activities of Fortis: http://www.fortis.be/legal/privacy_policy.htm = = = = = = = = = = = = = = = = = = = = = = = = = From Raymond.Rizzuto at sig.com Thu Jun 26 11:12:50 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] default contructor issue Message-ID: Hi I had been using the default constructor (via -generate-default-ctor), and forgot to initializing a DateTime mandatory element. When I went to serialize the object, I got an access violation. Is that a bug? Should I have instead gotten an xml_schema::Exception? Ray ________________________________ Ray Rizzuto raymond.rizzuto@sig.com Susquehanna International Group (610)747-2336 (W) (215)776-3780 (C) ________________________________ IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses. From boris at codesynthesis.com Thu Jun 26 13:29:36 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] default contructor issue In-Reply-To: References: Message-ID: <20080626172936.GH3508@karelia> Hi Ray, Rizzuto, Raymond writes: > I had been using the default constructor (via -generate-default-ctor), > and forgot to initializing a DateTime mandatory element. When I went > to serialize the object, I got an access violation. Is that a bug? > Should I have instead gotten an xml_schema::Exception? No this is not a bug. By default the generated code makes sure that you initialize all required attributes and elements by forcing you to initialize them at construction. By specifying --generate-default-ctor you choose to take the risk of forgetting to initialize some required members. This is clearly specifying in this option's documentation. Adding extra checks in the serialization code (as well as in accessors for consistency) will penalize people who use the strict interface by hurting performance and increasing object code size. Boris From Raymond.Rizzuto at sig.com Thu Jun 26 14:02:46 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] default contructor issue In-Reply-To: <20080626172936.GH3508@karelia> References: <20080626172936.GH3508@karelia> Message-ID: Boris, Thanks - I will take off that option so I and the other users are forced to properly initialize the mandatory items. Initially, I thought a default constructor plus setting values explicitly was clearer to read. The need to chain constructors, as shown below, botherers me a bit: NewRequest::RequestType request(DomainObject::IdType("request-1", "SusexToSDMP", 3), Request::StateType::Discarded, Request::ReceivedDateTimeType(2008, 1, 22, 8, 0, 0, 0, 0)); Of course, I can always construct my DomainObject::IdType before hand and pass the object on the NewRequest::RequestType constructor call. Thanks again for clarifying this point. Ray -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Thursday, June 26, 2008 1:30 PM To: Rizzuto, Raymond Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] default contructor issue Hi Ray, Rizzuto, Raymond writes: > I had been using the default constructor (via -generate-default-ctor), > and forgot to initializing a DateTime mandatory element. When I went > to serialize the object, I got an access violation. Is that a bug? > Should I have instead gotten an xml_schema::Exception? No this is not a bug. By default the generated code makes sure that you initialize all required attributes and elements by forcing you to initialize them at construction. By specifying --generate-default-ctor you choose to take the risk of forgetting to initialize some required members. This is clearly specifying in this option's documentation. Adding extra checks in the serialization code (as well as in accessors for consistency) will penalize people who use the strict interface by hurting performance and increasing object code size. Boris IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses. From Raymond.Rizzuto at sig.com Thu Jun 26 16:56:07 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] comparison question Message-ID: Hi! I have an object/element containing a polymorphic type. I enabled comparison code generation, but it looks like it gives up on deciding how to compare the contained polymorphic types. Here is the generated code for the polymorphic type's base: bool operator== (const MessageType&, const MessageType&) { return true; } bool operator!= (const MessageType& x, const MessageType& y) { return !(x == y); } I was hoping to use this to serialize then deserialize to compare the round trip on some XML I am creating, but this comparison always succeeds. I would think the comparison for equal might be done by using rtti to check if x and y are of the same type and equal. I.e. operator== (const MessageType& x, const MessageType& y) { if (typeid(x) != typeid(y)) return false; return x.operator==(y); } operator== would have to e a virtual member function - I'm not sure if that is allowed or not. In the case I was trying, I believe the compare would fail. The derived class, NewRequest, has an element called changed that is a NMTOKENS. I do this to fill it: changes.push_back("state of the union"); request.changed(changes); This should be invalid in that space isn't allowed in a NMTOKEN, but it is accepted. In the original object, the NMTOKENS list is of size 1, but when it is parsed back in, it is of size 4. Ray ________________________________ Ray Rizzuto raymond.rizzuto@sig.com Susquehanna International Group (610)747-2336 (W) (215)776-3780 (C) ________________________________ IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses. From boris at codesynthesis.com Fri Jun 27 04:13:27 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] comparison question In-Reply-To: References: Message-ID: <20080627081327.GD9497@karelia> Hi Ray, Rizzuto, Raymond writes: > operator== would have to e a virtual member function - I'm not sure if > that is allowed or not. I think this is allowed though you will have to use the same type for the right-hand-side operand in order for the virtual mechanism to work. A cleaner approach would be to provide a virtual compare() function which is called by operator==(). Overall, it will be way too heavy-weight for the common cases since most comparisons won't need rtti/virtual function mechanism (polymorphism is normally used only in a handful of places). Generally, the generated comparison operators are provided as a quick-and-dirty member-wise comparison for simple cases (I am still not sure it was a good idea to provide them at all). In some cases this semantics can be completely wrong. Applications that need comparison for any non-trivial cases (e.g., polymorphic objects) should provide their own comparison operators. In your particular case it may be easier to compare the XML representations (e.g., by serializing them to strings) instead of the object models (e.g., do XML->OM1->XML1->OM2->XML2 and compare XML1 and XML2 instead of OM1 and OM2). Boris From Raymond.Rizzuto at sig.com Fri Jun 27 09:23:57 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] comparison question In-Reply-To: <20080627081327.GD9497@karelia> References: <20080627081327.GD9497@karelia> Message-ID: Boris, In my application I am populating an object, then serializing to XML. The reason I then parsed it back to an object and compared them is to see if the destination would receive the same representation as I had started with. In the case I was testing, this comparison would have failed since the two NMTOKENS lists were of different sizes (1 had a single, invalid, xml token of "state of the union", the other had 4 tokens of each of those words" If I had done OM->XML1->OM2->XML2 and compared XML1 and XML2, I would not have seen this. While this discrepancy is due to a coding bug, it is valuable to pick these bugs up during development, which is why I was trying to use the comparison functions. I actually think the comparison functions are useful for people that are creating XML documents for exactly this kind of round trip validation. However, I won't be able to use it as is without a polymorphic comparison. Since that would have to be a member function, adding it would require changing the generated code. That sounds like a maintenance nightmare. I think code like the following would work: In MessageType: virtual bool operator=(const MessageType&x) const = 0; bool operator== (const MessageType& x, const MessageType& y) { return x.operator==(y); } In derived NewRequest bool operator=(const MessageType&x) const { if (typeid(x) != typeid(this)) return false; const NewRequest &x2 = dynamic_cast(x); // now do member-wise compare of this and x2 Ray -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Friday, June 27, 2008 4:13 AM To: Rizzuto, Raymond Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] comparison question Hi Ray, Rizzuto, Raymond writes: > operator== would have to e a virtual member function - I'm not sure if > that is allowed or not. I think this is allowed though you will have to use the same type for the right-hand-side operand in order for the virtual mechanism to work. A cleaner approach would be to provide a virtual compare() function which is called by operator==(). Overall, it will be way too heavy-weight for the common cases since most comparisons won't need rtti/virtual function mechanism (polymorphism is normally used only in a handful of places). Generally, the generated comparison operators are provided as a quick-and-dirty member-wise comparison for simple cases (I am still not sure it was a good idea to provide them at all). In some cases this semantics can be completely wrong. Applications that need comparison for any non-trivial cases (e.g., polymorphic objects) should provide their own comparison operators. In your particular case it may be easier to compare the XML representations (e.g., by serializing them to strings) instead of the object models (e.g., do XML->OM1->XML1->OM2->XML2 and compare XML1 and XML2 instead of OM1 and OM2). Boris IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses. From Raymond.Rizzuto at sig.com Fri Jun 27 16:15:57 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] access violation with --generate-wildcards Message-ID: Hi! I was compiling my code as follows: xsd.exe cxx-tree --output-dir . --hxx-suffix .hxx --cxx-suffix .cxx --ixx-suffix .ixx --fwd-suffix -fwd.hxx --generate-serialization --generate-polymorphic --generate-ostream --generate-comparison --generate-intellisense --type-naming ucc --function-naming lcc --root-element-all I decided to add -generate-wildcards. Now I take an unhandled exception: Unhandled exception at 0x1200987a (xerces-c_2_8D_vc80.dll) in SDMPTest.exe: 0xC0000005: Access violation reading location 0x00000000. xerces-c_2_8D_vc80.dll!xercesc_2_8::XMLMutex::lock() Line 60 + 0x3 bytes C++ xerces-c_2_8D_vc80.dll!xercesc_2_8::XMLMutexLock::XMLMutexLock(xercesc_2_8::XMLMutex * const toLock=0x00000000) Line 78 C++ xerces-c_2_8D_vc80.dll!xercesc_2_8::getDOMImplSrcVectorMutex() Line 90 + 0xe bytes C++ xerces-c_2_8D_vc80.dll!xercesc_2_8::DOMImplementationRegistry::getDOMImplementation(const wchar_t * features=0x0012f35c) Line 123 + 0x5 bytes C++ SDMPTest.exe!xsd::cxx::xml::dom::create_document() Line 30 + 0xc bytes C++ SDMPTest.exe!sdmp::messages::ObjectId::ObjectId(const char * String=0x007f8e4c, const sdmp::messages::SystemId & source={...}, const int & revision=3) Line 11393 + 0x71 bytes C++ SDMPTest.exe!wmain(int argc=1, wchar_t * * argv=0x00366b40) Line 16 + 0x3c bytes C++ SDMPTest.exe!__tmainCRTStartup() Line 594 + 0x19 bytes C SDMPTest.exe!wmainCRTStartup() Line 414 C kernel32.dll!7c816fd7() [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll] This is happening in the constructor call for my object: DomainObject::IdType test("request-1", "SusexToSDMP", 3); Id in DomainObject is of type ObjectId, defined as follows: Additional attributes may be added in future revisions. I was able to find the answer in the manual, and added the calls to xercesc::XMLPlatformUtils::Initialize (); and xercesc::XMLPlatformUtils::Terminate (); However, with this change, I got an exception on my app exit. Turned out to be my fault. Basically the code was: main() { xercesc::XMLPlatformUtils::Initialize (); DomainObject::IdType test("request-1", "SusexToSDMP", 3); . . . xercesc::XMLPlatformUtils::Terminate (); } The crash was like this: xerces-c_2_8D_vc80.dll!xercesc_2_8::DOMDocumentImpl::deleteHeap() Line 884 + 0x1d bytes C++ xerces-c_2_8D_vc80.dll!xercesc_2_8::DOMDocumentImpl::~DOMDocumentImpl() Line 208 C++ xerces-c_2_8D_vc80.dll!xercesc_2_8::DOMDocumentImpl::`vector deleting destructor'() + 0x50 bytes C++ xerces-c_2_8D_vc80.dll!xercesc_2_8::DOMDocumentImpl::release() Line 1367 + 0x20 bytes C++ SDMPTest.exe!xsd::cxx::xml::dom::auto_ptr::reset(xercesc_2_8::DOMDocument * x=0x00000000) Line 145 + 0x1c bytes C++ SDMPTest.exe!xsd::cxx::xml::dom::auto_ptr::~auto_ptr() Line 50 C++ SDMPTest.exe!sdmp::messages::ObjectId::~ObjectId() Line 11512 + 0x29 bytes C++ SDMPTest.exe!wmain(int argc=1, wchar_t * * argv=0x00366b40) Line 120 + 0x19 bytes C++ Obviously, terminating xerces and then destructing the object was an issue. I changed the code to: main() { xercesc::XMLPlatformUtils::Initialize (); { DomainObject::IdType test("request-1", "SusexToSDMP", 3); . . . } xercesc::XMLPlatformUtils::Terminate (); } Anyway, just wanted to pass along the information in case others run into this issue. Ray ________________________________ Ray Rizzuto raymond.rizzuto@sig.com Susquehanna International Group (610)747-2336 (W) (215)776-3780 (C) ________________________________ IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses. From Raymond.Rizzuto at sig.com Fri Jun 27 16:45:38 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] archives Message-ID: Is there any way you could add a search feature for the archives? I don't want to waste people's time asking questions that have been answered, but manually going through 35 archives is a bit tough. Ray ________________________________ Ray Rizzuto raymond.rizzuto@sig.com Susquehanna International Group (610)747-2336 (W) (215)776-3780 (C) ________________________________ IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses. From jnw at xs4all.nl Sat Jun 28 02:30:33 2008 From: jnw at xs4all.nl (Jeroen N. Witmond [Bahco]) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] archives Message-ID: <19920.194.109.230.85.1214634633.squirrel@webmail.xs4all.nl> > Is there any way you could add a search feature for the archives? See http://www.codesynthesis.com/pipermail/xsd-users/2007-October/001297.html :) Jeroen. From boris at codesynthesis.com Sun Jun 29 12:07:19 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:03 2009 Subject: [xsd-users] archives In-Reply-To: References: Message-ID: <20080629160719.GE26129@karelia> Hi Ray, Rizzuto, Raymond writes: > Is there any way you could add a search feature for the archives? Yes, we just did: http://www.codesynthesis.com/pipermail/xsd-users/ It searches the whole while website (and wiki) instead of just the archive for xsd-users but I think it is a reasonable first approximation. Let me know if you run into any problems or have any suggestions. Boris From pbhateja123 at gmail.com Mon Jun 30 12:33:18 2008 From: pbhateja123 at gmail.com (PARAS BHATEJA) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] xsd problem Message-ID: <175338300806300933w11c3b369t4108dc29a1b7f7eb@mail.gmail.com> hi, Myself* paras*, i am using the xsd 3.1.0 compiler for converting sxhema to c++ but i am facing a problem i have the schema like now i want a simple class that will generate the classes for all the complex types or it can be an element, i am not getting your generated code , it is very complex class Person { int age; char name[10]; //etc..... } it should be a simple template class we have to generate simple code instead of your code. i want that the classes generated should be simple and to the point as there are java classes generated through JAXB marshalling and unmarshalling with simple get and set properties in your compiler --suppress-parser doesnot really suppress the code and we are not able to deal with :: operators used in your .hxx files as there are many it is very difficult to understand the code please reply soon From boris at codesynthesis.com Mon Jun 30 12:41:08 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] comparison question In-Reply-To: References: <20080627081327.GD9497@karelia> Message-ID: <20080630164108.GA29494@karelia> Hi Ray, Rizzuto, Raymond writes: > I actually think the comparison functions are useful for people that are > creating XML documents for exactly this kind of round trip validation. > However, I won't be able to use it as is without a polymorphic > comparison. Ok, I've added this to out TODO list for 3.1.1. I will give it some more thought and see if there is an acceptable solution. > Since that would have to be a member function, adding it would > require changing the generated code. That sounds like a > maintenance nightmare. Actually, the type customization mechanism in C++/Tree is there to solve exactly this kind of problems. See the C++Tree Mapping Customization Guide for more information: http://wiki.codesynthesis.com/Tree/Customization_guide In particular, the custom/taxonomy example shows how to add a virtual function to a hierarchy of types. It even uses polymorphism. I agree this is a bit more work than to have the XSD compiler generate proper comparison operators but it can be done in a maintainable manner if you really need it. Boris From boris at codesynthesis.com Mon Jun 30 12:49:16 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] access violation with --generate-wildcards In-Reply-To: References: Message-ID: <20080630164916.GB29494@karelia> Hi Ray, Rizzuto, Raymond writes: > I decided to add -generate-wildcards. Now I take an unhandled > exception: I believe you have already found the answer to this in the archives. I will, however, answer this in case somebody has the same problem and stumbles on this thread: You most likely forgot to initialize the Xerces-C++ runtime. Since the wildcard content is represented as DOM fragments, the Xerces-C++ runtime needs to be initialized for the lifetime of the object model (normally the runtime is initialized and terminated by the parsing function). Also, since you are initializing the Xerces-C++ runtime yourself, it makes sense to pass the xml_schema::flags::dont_initialize flag to parsing/serialization functions. For more information see Section 2.12 in the C++/Tree Mapping User Manual: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.12 As well as the 'wildcard' example. Boris From Raymond.Rizzuto at sig.com Mon Jun 30 15:28:43 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] comparison question In-Reply-To: <20080630164108.GA29494@karelia> References: <20080627081327.GD9497@karelia> <20080630164108.GA29494@karelia> Message-ID: Boris, Thanks for the suggestion about type customization. I'll look into that. It sounds like I may be able to 1) make the compiler generate MessageType_base 2) derive my MessageType from MessageType_base 3) repeat #1 and #2 for the 36 types derived from MessageType 4) implement operator== for MessageType and have it call a virtual compare function 5) implement virtual compare function in the derived classes of MessageType Ray -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Monday, June 30, 2008 12:41 PM To: Rizzuto, Raymond Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] comparison question Hi Ray, Rizzuto, Raymond writes: > I actually think the comparison functions are useful for people that are > creating XML documents for exactly this kind of round trip validation. > However, I won't be able to use it as is without a polymorphic > comparison. Ok, I've added this to out TODO list for 3.1.1. I will give it some more thought and see if there is an acceptable solution. > Since that would have to be a member function, adding it would > require changing the generated code. That sounds like a > maintenance nightmare. Actually, the type customization mechanism in C++/Tree is there to solve exactly this kind of problems. See the C++Tree Mapping Customization Guide for more information: http://wiki.codesynthesis.com/Tree/Customization_guide In particular, the custom/taxonomy example shows how to add a virtual function to a hierarchy of types. It even uses polymorphism. I agree this is a bit more work than to have the XSD compiler generate proper comparison operators but it can be done in a maintainable manner if you really need it. Boris IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses. From boris at codesynthesis.com Mon Jun 30 16:35:01 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] comparison question In-Reply-To: References: <20080627081327.GD9497@karelia> <20080630164108.GA29494@karelia> Message-ID: <20080630203501.GF29494@karelia> Hi Ray, Rizzuto, Raymond writes: > 1) make the compiler generate MessageType_base > 2) derive my MessageType from MessageType_base Correct. > 3) repeat #1 and #2 for the 36 types derived from MessageType Ok, the fact that you have 36 types makes this solution a lot less attractive than if you had, say, 3 derived types. One alternative (which we will most likely use in the generated code) would be to have a map of type_info to pointer to operator== (actually, it will have to be a pointer to a "thunk" function which calls operator==). Then operator== for MessageType would lookup the proper operator== and call it. This way instead of customizing 36 derived types you will just need to add 36 entries to the map. Here is how this may look: typedef bool (*compare) (const MessageType&, const MessageType&); typedef std::map map; template bool compare_thunk (const MessageType& a, const MessageType& b) { const X& ax = static_cast (a); const X& bx = static_cast (b); return ax == bx; } map cmp_map; // global map bool operator== (const MessageType& a, const MessageType& b) { if (typeid (a) != typeid (b)) return false; map::const_iterator i = cmp_map.find (&typeid (a)); if (i != cmp_map.end ()) { compare c = i->second; return c (a, b); } else return false; // Missing map entry? } int main () { cmp_map[&typeid (MessageType1)] = &compare_thunk; cmp_map[&typeid (MessageType2)] = &compare_thunk; ... } We use this approach to do polymorphism-aware serialization. If you would like to take a look at the actual implementation, see the type-serializer-map.* files in libxsd/xsd/cxx/tree/. > 4) implement operator== for MessageType and have it call a virtual > compare function > 5) implement virtual compare function in the derived classes of > MessageType Correct again. Boris From Raymond.Rizzuto at sig.com Mon Jun 30 17:32:24 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] naming issue w/serialization and parsing Message-ID: Hi! I'm generating serialization functions for my schema, and having some naming issues. For classes that are lowercase (header, message, etc) the output serialization function names are getting an underscore appended: void message_ (::std::ostream& os, const ::sdmp::messages::message& x, const ::xml_schema::namespace_infomap& m, const ::std::string& e = "UTF-8", ::xml_schema::flags f = 0); Classes that are upper case (Instrument, etc) have a serialize function that is a lower case version of the class name: void instrument (::std::ostream& os, const ::sdmp::messages::Instrument& x, const ::xml_schema::namespace_infomap& m, const ::std::string& e = "UTF-8", ::xml_schema::flags f = 0); I'm guessing the that the message_ name was created to prevent the name from looking like a constructor. Since this is a bit confusing, I'd rather have the serialize name be something like Class_serialize. I was able to almost get the behavior I wanted with --serializer-regex /(.+)/$1_serialize/ - the problem is that Instrument's serialization becomes instrument_serialize. This is what the trace says: serialization function name: 'instrument' try: '(.+)' : 'instrument_serialize' : + I'm guessing that the function naming style is coming in to play here, though I am not sure. Can you suggest what I can do so the serialize function name maintains the capitalization of the element being serialized? I.e. so Instrument's serialization function would be Instrument_serialize? On a related issue, I have elements in the schema that differ only in the case of the first letter (OrderInstruction and orderInstruction). orderInstruction is actually derived from OrderInstruction. The problem is I only see serialization functions for orderInstruction: void orderInstruction_serialize (::std::ostream& os, const ::sdmp::messages::orderInstruction& x, const ::xml_schema::namespace_infomap& m, const ::std::string& e = "UTF-8", ::xml_schema::flags f = 0); There is no serialize function that takes a ::sdmp::messages::OrderInstruction. Ray ________________________________ Ray Rizzuto raymond.rizzuto@sig.com Susquehanna International Group (610)747-2336 (W) (215)776-3780 (C) ________________________________ IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.