From Arul.Prakash2 at rsa.com Mon Jul 2 02:36:09 2012 From: Arul.Prakash2 at rsa.com (Arul.Prakash2@rsa.com) Date: Mon Jul 2 02:36:44 2012 Subject: [xsd-users] no input file specified error, even if input file specified Message-ID: <0DB3CF5C512BBD4FA7E3A8ECD8FE7352104B885FF8@MX26A.corp.emc.com> Hi, I am new to CS.I am tring to generate C++ code from a xsd file.I am getting a bunch of errors C:\Program Files\CodeSynthesis XSD 3.3\examples\cxx\tree\hello>xsd cxx-tree --generate-serialization commonapi-config.xsd w3-org-docs\XMLSchema.dtd:121:9: warning: attribute 'xmlns' has already been dec lared for element 'schema' commonapi-config.xsd: warning T004: generating parsing and serialization functio ns for 7 global elements commonapi-config.xsd: info: use --root-element-* options to specify document roo t(s) commonapi-config.xsd:81:95: warning T001: namespace '##other' allows for element 'Status' commonapi-config.xsd:81:95: warning T001: generated code may not associate eleme nt 'Status' correctly if it appears in place of this wildcard commonapi-config.xsd:79:36: info: element 'Status' is defined here w3-org-docs\www-w3-org.2001.04.xenc-schema.xsd:19:40: error: unable to map XML S chema namespace 'http://www.w3.org/2001/04/xmlenc#' to C++ namespace w3-org-docs\www-w3-org.2001.04.xenc-schema.xsd:19:40: info: use the --namespace- map or --namespace-regex option to provide custom mapping So ignoring the warnings(I can ignore rite?).Inorder to get rid of the error I tried C:\Program Files\CodeSynthesis XSD 3.3\examples\cxx\tree\hello>xsd cxx-tree --ge nerate-serialization --namespace-map commonapi-config.xsd error: no input file specified PS.I tried the file name within the quotes also. Any help from CS experts? Thanks Arul -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 7465 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20120702/0b06e009/smime.bin From Arul.Prakash2 at rsa.com Mon Jul 2 02:45:37 2012 From: Arul.Prakash2 at rsa.com (Arul.Prakash2@rsa.com) Date: Mon Jul 2 02:46:03 2012 Subject: [xsd-users] FW: no input file specified error, even if input file specified Message-ID: <0DB3CF5C512BBD4FA7E3A8ECD8FE7352104B885FFA@MX26A.corp.emc.com> From: Prakash, Arul Sent: Monday, July 02, 2012 12:06 PM To: 'xsd-users@codesynthesis.com' Subject: no input file specified error,even if input file specified Hi, I am new to CS.I am tring to generate C++ code from a xsd file.I am getting a bunch of errors C:\Program Files\CodeSynthesis XSD 3.3\examples\cxx\tree\hello>xsd cxx-tree --generate-serialization commonapi-config.xsd w3-org-docs\XMLSchema.dtd:121:9: warning: attribute 'xmlns' has already been dec lared for element 'schema' commonapi-config.xsd: warning T004: generating parsing and serialization functio ns for 7 global elements commonapi-config.xsd: info: use --root-element-* options to specify document roo t(s) commonapi-config.xsd:81:95: warning T001: namespace '##other' allows for element 'Status' commonapi-config.xsd:81:95: warning T001: generated code may not associate eleme nt 'Status' correctly if it appears in place of this wildcard commonapi-config.xsd:79:36: info: element 'Status' is defined here w3-org-docs\www-w3-org.2001.04.xenc-schema.xsd:19:40: error: unable to map XML S chema namespace 'http://www.w3.org/2001/04/xmlenc#' to C++ namespace w3-org-docs\www-w3-org.2001.04.xenc-schema.xsd:19:40: info: use the --namespace- map or --namespace-regex option to provide custom mapping So ignoring the warnings(I can ignore rite?).Inorder to get rid of the error I tried C:\Program Files\CodeSynthesis XSD 3.3\examples\cxx\tree\hello>xsd cxx-tree --ge nerate-serialization --namespace-map commonapi-config.xsd error: no input file specified PS.I tried the file name within the quotes also. Any help from CS experts? Thanks Arul From philschmidt at gmx.net Mon Jul 2 04:06:03 2012 From: philschmidt at gmx.net (Philipp Schmidt) Date: Mon Jul 2 04:07:44 2012 Subject: [xsd-users] Problem accessing basic datatypes behind XML types Message-ID: <1428182.04LHW112eS@sam> Hello, I have successfully generated the code from the xsd but now I am stuck while trying to access the data. For example I have an optional string type typedef ::xml_schema::String NameType; typedef ::xsd::cxx::tree::optional< NameType > NameOptional; typedef ::xsd::cxx::tree::traits< NameType, char > NameTraits; const NameOptional& name () const; NameOptional& name (); that I now want to store in a QString (std::string throws the same errors, I will now list only the std::string stuff). The way I am trying to access the data is as follows: std::string name = valueReport.name(); which results in the following compiler-error (regardless if I cast to std::string or not): /.../devicemodel_valuedescription.cpp:39:50: error: conversion from ?const NameOptional {aka const xsd::cxx::tree::optional > >}? to non-scalar type ?std::string {aka std::basic_string}? requested The same goes for all other datatypes which are either stored as strings or integers. So how do I access the data correctly to store it in Qt4/std datatypes? Kind regards Philipp Schmidt From erik.sjolund at gmail.com Mon Jul 2 04:21:50 2012 From: erik.sjolund at gmail.com (=?ISO-8859-1?Q?Erik_Sj=F6lund?=) Date: Mon Jul 2 04:21:58 2012 Subject: [xsd-users] Problem accessing basic datatypes behind XML types In-Reply-To: <1428182.04LHW112eS@sam> References: <1428182.04LHW112eS@sam> Message-ID: > std::string name = valueReport.name(); Maybe like this? std::string name(valueReport.name().c_str()); cheers, Erik Sj?lund From philschmidt at gmx.net Mon Jul 2 04:41:49 2012 From: philschmidt at gmx.net (Philipp Schmidt) Date: Mon Jul 2 04:43:25 2012 Subject: Fwd: Re: [xsd-users] Problem accessing basic datatypes behind XML types Message-ID: <1729731.1gU43CZfkg@sam> Sorry, forgot to press "answer all" -.- Am Montag, 2. Juli 2012, 10:21:50 schrieben Sie: > > std::string name = valueReport.name(); > > Maybe like this? > std::string name(valueReport.name().c_str()); > > cheers, > Erik Sj?lund Hi, that works for non-optional values. I now found out that for optional values you check if they are set with present() (did that already elsewhere in the code) and then get() the data... So for example: std::string name = value.name().present() ? value.name().get() : ""; Same goes for all other value types. Thanks for the fast feedback! cheers, Philipp Schmidt From boris at codesynthesis.com Mon Jul 2 08:34:20 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jul 2 08:27:37 2012 Subject: [xsd-users] no input file specified error, even if input file specified In-Reply-To: <0DB3CF5C512BBD4FA7E3A8ECD8FE7352104B885FF8@MX26A.corp.emc.com> References: <0DB3CF5C512BBD4FA7E3A8ECD8FE7352104B885FF8@MX26A.corp.emc.com> Message-ID: Hi Arul, Please don't send multiple copies of the same email to the mailing list. One is sufficient. Arul.Prakash2@rsa.com writes: > w3-org-docs\www-w3-org.2001.04.xenc-schema.xsd:19:40: error: unable to map > XML Schema namespace 'http://www.w3.org/2001/04/xmlenc#' to C++ namespace > > [...] > > So ignoring the warnings(I can ignore rite?).Inorder to get rid of the error > I tried > > xsd cxx-tree --generate-serialization --namespace-map commonapi-config.xsd > > error: no input file specified The --namespace-map option expects a value which specifies how the XML namespace should be mapped to the C++ namespace. See the XSD compiler command line manual (man pages) for details: http://www.codesynthesis.com/projects/xsd/documentation/xsd.xhtml In your case it will be something along these lines: --namespace-map http://www.w3.org/2001/04/xmlenc#=xmlenc Boris From boris at codesynthesis.com Mon Jul 2 08:39:18 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jul 2 08:32:32 2012 Subject: [xsd-users] compiling WXXM schema In-Reply-To: References: Message-ID: Hi Daniel, In the future please keep your replies CC'ed to the xsd-users mailing list as discussed in the posting guidelines: http://www.codesynthesis.com/support/posting-guidelines.xhtml Gavrila, Daniel writes: > Which is the meaning of these options: > > --include-regex %../../gml/3.2.1/(.+)%../../gml/$1% > --extern-xml-schema xml-schema.xsd You can learn about what they mean by studying the XSD compiler command line manual (man pages): http://www.codesynthesis.com/projects/xsd/documentation/xsd.xhtml > Should I added to the new option file ? You would want to add the first option only if your schema imports GML. It is also a good idea to add the second option. > Do you know another people that try to compile the WXXM schema ? No, I am not aware of anyone else. Boris From philschmidt at gmx.net Mon Jul 2 08:48:06 2012 From: philschmidt at gmx.net (Philipp Schmidt) Date: Mon Jul 2 08:49:43 2012 Subject: [xsd-users] Generate separate header file for specific elements Message-ID: <3665928.FjhWgjk4aM@sam> Hello, I have xsd files where the lowest two elements that are needed to nest every other element are defined in every single xsd file, as well as most complex datatypes. Can I use --generate-xml-schema to put these definitions into a general header that I can then include everywhere else and if yes: How? For example: I have the following xsd ... and want to have the elements "asdf" and "qwertz" as well as the types "foo" and "bar" in said separate header file. Kind regards, Philipp Schmidt From boris at codesynthesis.com Mon Jul 2 09:07:19 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jul 2 09:00:33 2012 Subject: [xsd-users] Generate separate header file for specific elements In-Reply-To: <3665928.FjhWgjk4aM@sam> References: <3665928.FjhWgjk4aM@sam> Message-ID: Hi Philipp, Philipp Schmidt writes: > I have xsd files where the lowest two elements that are needed to nest every > other element are defined in every single xsd file, as well as most complex > datatypes. Can I use --generate-xml-schema to put these definitions into a > general header that I can then include everywhere else No, --generate-xml-schema won't help you here. To achieve what you want you will need to factor these common types out into a separate schema file and then xs:include it in all the other files. And the resulting generated C++ code will have the same structure. Boris From daniel.berglund at scilifelab.se Tue Jul 10 10:14:15 2012 From: daniel.berglund at scilifelab.se (Daniel Berglund) Date: Tue Jul 10 10:14:25 2012 Subject: [xsd-users] Mapping of complex type with simple type string extension Message-ID: Hi I have a question about the mapping for complex types with simple type extension. The tree manual has an example http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.7 If I understand correctly if we have the object of the complex type in the example you can acess date by object.base() ? I'm having something similar but with a string instead of date. I don't have an object named base in the generate code as in the example. How do I acess that string? /Daniel From daniel.berglund at scilifelab.se Tue Jul 10 10:14:29 2012 From: daniel.berglund at scilifelab.se (Daniel Berglund) Date: Tue Jul 10 10:14:36 2012 Subject: [xsd-users] Mapping of complex type with simple type string extension Message-ID: Hi I have a question about the mapping for complex types with simple type extension. The tree manual has an example http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.7 If I understand correctly if we have the object of the complex type in the example you can acess date by object.base() ? I'm having something similar but with a string instead of date. I don't have an object named base in the generate code as in the example. How do I acess that string? /Daniel From boris at codesynthesis.com Wed Jul 11 05:39:48 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jul 11 05:31:39 2012 Subject: [xsd-users] Mapping of complex type with simple type string extension In-Reply-To: References: Message-ID: Hi Daniel, Please don't send multiple copies of the same question to the mailing list. One is sufficient. Daniel Berglund writes: > > > > > > > > > If I understand correctly if we have the object of the complex type in the > example you can acess date by object.base()? No, object will simply derive from xml_schema::date class and you can work with object as if it was date. Alternatively, if you want an explicit reference to date, then you can do: object o = ...; xml_schema::date& d = o; // Implicit derived-to-base conversion. > I'm having something similar but with a string instead of date. Similarly, in this case your complex type will derive from xml_schema::string which in turn derives from std::string. So you can do: object o = ...; const char* cs = o.c_str (); // Call std::string::c_str() directly. o.assign ("foo"); // Call std::string::assign() directly. std::string& s = o; // Implicit derived-to-base conversion. Boris From skunkworx at verizon.net Fri Jul 13 01:32:38 2012 From: skunkworx at verizon.net (Skunk Worx) Date: Fri Jul 13 01:33:45 2012 Subject: [xsd-users] dlclose and xsd cxx-tree Message-ID: <4FFFB2F6.90806@verizon.net> Hello, I seem to be having a problem with xsd cxx-tree and dlclose(). I am trying xsd cxx-tree on an EPEL 6, x86_64 machine. I've downloaded and installed the xsd-3.3.0-1.x86_64 RPM. Suppose I have a schema Foo.xsd : ...and I process it into .cxx, ,hxx files : $ xsd cxx-tree Foo.xsd ...and compile it into a shared library : $ g++ -fPIC -g -shared -o libFoo.so Foo.cxx -lxerces-c ...and create a simple main.cpp to dlopen / dlclose this library : #include #include #include int main() { static const char *lib="./libFoo.so"; char cmd[1024]; void *h; if((h=dlopen(lib,RTLD_NOW))==0) { printf("dlerror : %s\n",dlerror()); exit(1); } if(dlclose(h)) { printf("dlerror : %s\n",dlerror()); exit(1); } sprintf(cmd,"fuser %s",lib); system(cmd); exit(0); } ...and compile the main program : $ g++ -fPIC -g -o main main.cpp -ldl ...and run it : $ ./main ./libFoo.so: 3326m ...why, after a successful dlclose(), is the .so still referenced in the application memory? It is my understanding that this will result in an invalid .so initialization if the .so is subsequently reopened by the same application instance. I suspect it is something in the "namespace xml_schema {}" area of the generated Foo.hxx file but I am not sure. Thanks in advance for any insight! --- John From boris at codesynthesis.com Fri Jul 13 05:02:58 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jul 13 04:54:23 2012 Subject: [xsd-users] dlclose and xsd cxx-tree In-Reply-To: <4FFFB2F6.90806@verizon.net> References: <4FFFB2F6.90806@verizon.net> Message-ID: Hi John, Skunk Worx writes: > I seem to be having a problem with xsd cxx-tree and dlclose(). > > [...] > > ...why, after a successful dlclose(), is the .so still referenced in the > application memory? I did some searches and there appears to be a bug either in GCC or glibc (there doesn't seem to be a consensus on this). See these two threads for more information: http://gcc.gnu.org/ml/gcc-help/2011-05/msg00403.html http://www.cygwin.com/ml/binutils/2011-05/msg00376.html > It is my understanding that this will result in an invalid .so > initialization if the .so is subsequently reopened by the same > application instance. I did some testing and what happens is dlclose() is simply ignored. As a result, a subsequent dlopen() is also ignored. So it is ok to re-load the library with this bug. Boris From erik.sjolund at gmail.com Sat Jul 14 03:53:22 2012 From: erik.sjolund at gmail.com (=?ISO-8859-1?Q?Erik_Sj=F6lund?=) Date: Sat Jul 14 03:53:30 2012 Subject: [xsd-users] segmentation fault when runninig CodeSynthesis XSD Message-ID: I created a minimal schema where I could reproduce a segmentation fault I got for a bigger schema. The schema mini2.xsd fails but mini1.xsd runs ok. Is it a bug in CodeSynthesis XSD? See below for details. cheers, Erik Sj?lund $ cat /etc/issue Ubuntu 12.04 LTS \n \l $ uname -m i686 $ wget --quiet http://www.codesynthesis.com/download/xsd/3.3/linux-gnu/i686/xsd-3.3.0-i686-linux-gnu.tar.bz2 $ tar xfj xsd-3.3.0-i686-linux-gnu.tar.bz2 $ xsd-3.3.0-i686-linux-gnu/bin/xsd cxx-tree mini1.xsd $ xsd-3.3.0-i686-linux-gnu/bin/xsd cxx-tree mini2.xsd Segmentation fault (core dumped) $ diff -u mini1.xsd mini2.xsd --- mini1.xsd 2012-07-14 09:33:56.985975678 +0200 +++ mini2.xsd 2012-07-14 09:34:03.574007988 +0200 @@ -1,5 +1,5 @@ $ cat mini1.xsd $ cat mini2.xsd $ From boris at codesynthesis.com Mon Jul 16 08:02:52 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jul 16 07:53:46 2012 Subject: [xsd-users] segmentation fault when runninig CodeSynthesis XSD In-Reply-To: References: Message-ID: Hi Erik, Erik Sj?lund writes: > - targetNamespace="http://example.com/test" > + targetNamespace="http://www.w3.org/2001/XMLSchema" http://www.w3.org/2001/XMLSchema is a reserved namespace and you cannot use it as a target namespace for your own schemas. Of course, it would be nice for XSD not to crash and report an error. Though this is such a pathological case that I don't think we should bother with it. Boris From erik.sjolund at gmail.com Mon Jul 16 14:28:11 2012 From: erik.sjolund at gmail.com (=?ISO-8859-1?Q?Erik_Sj=F6lund?=) Date: Mon Jul 16 14:28:19 2012 Subject: [xsd-users] segmentation fault when runninig CodeSynthesis XSD In-Reply-To: References: Message-ID: On Mon, Jul 16, 2012 at 2:02 PM, Boris Kolpackov wrote: > http://www.w3.org/2001/XMLSchema is a reserved namespace and you cannot > use it as a target namespace for your own schemas. Hi Boris, thanks for the answer. Some background information: I need to create some XML Schemas from within a running program. It would be possible to use Xerces for writing these XML Schemas, but I am interested in the possibility to use CodeSynthesis XSD for this. My plan was to first write an XML schema, minimal.xsd, that validates a subset of all valid XML schemas. Then I would let CodeSynthesis XSD generate a dataobject model from minimal.xsd. xsd cxx-tree --generate-serialization --root-element schema minimal.xsd I would then use that dataobject model to write some simple XML schemas. Is it possible to do this with CodeSynthesis XSD? cheers, Erik Sj?lund From boris at codesynthesis.com Tue Jul 17 08:42:43 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jul 17 08:33:27 2012 Subject: [xsd-users] segmentation fault when runninig CodeSynthesis XSD In-Reply-To: References: Message-ID: Hi Erik, Erik Sj?lund writes: > Some background information: I need to create some XML Schemas from > within a running program. It would be possible to use Xerces for > writing these XML Schemas, but I am interested in the possibility to > use CodeSynthesis XSD for this. > > My plan was to first write an XML schema, minimal.xsd, that validates > a subset of all valid XML schemas. Then I would let CodeSynthesis XSD > generate a dataobject model from minimal.xsd. > > xsd cxx-tree --generate-serialization --root-element schema minimal.xsd > > I would then use that dataobject model to write some simple XML schemas. > > Is it possible to do this with CodeSynthesis XSD? The problem with using the XML Schema namespace as target namespace is that it messes up name lookup, fundamental namespace generation, etc, etc. So the way I would handle this is use some other target namespace in the schema, save the object model to DOM and then change the namespace to the XML Scheme namespace at the DOM level (see the DOMDocument::renameNode() function for details). The same logic can also be applied to parsing, if you need this. Boris From erik.sjolund at gmail.com Tue Jul 17 08:53:12 2012 From: erik.sjolund at gmail.com (=?ISO-8859-1?Q?Erik_Sj=F6lund?=) Date: Tue Jul 17 08:53:19 2012 Subject: [xsd-users] segmentation fault when runninig CodeSynthesis XSD In-Reply-To: References: Message-ID: On Tue, Jul 17, 2012 at 2:42 PM, Boris Kolpackov wrote: > Hi Erik, > > Erik Sj?lund writes: > >> Some background information: I need to create some XML Schemas from >> within a running program. It would be possible to use Xerces for >> writing these XML Schemas, but I am interested in the possibility to >> use CodeSynthesis XSD for this. >> >> My plan was to first write an XML schema, minimal.xsd, that validates >> a subset of all valid XML schemas. Then I would let CodeSynthesis XSD >> generate a dataobject model from minimal.xsd. >> >> xsd cxx-tree --generate-serialization --root-element schema minimal.xsd >> >> I would then use that dataobject model to write some simple XML schemas. >> >> Is it possible to do this with CodeSynthesis XSD? > > The problem with using the XML Schema namespace as target namespace is > that it messes up name lookup, fundamental namespace generation, etc, > etc. > > So the way I would handle this is use some other target namespace in > the schema, save the object model to DOM and then change the namespace > to the XML Scheme namespace at the DOM level (see the > DOMDocument::renameNode() function for details). The same logic can also > be applied to parsing, if you need this. > > Boris Ok, thanks a lot! cheers, Erik From GDomjan at netiq.com Tue Jul 17 20:07:13 2012 From: GDomjan at netiq.com (Greg Domjan) Date: Wed Jul 18 02:46:16 2012 Subject: [xsd-users] availability as maven plugin & dependency In-Reply-To: References: <4FE1EC41.C828.000E.1@novell.com> Message-ID: <5005A9D20200000E00AC246F@novprvoes0310.provo.novell.com> Hi Boris, I've started making some maven artefacts and dropped the start of it on github in plan to contribute it to you. https://github.com/GregDomjan/XSD-mapping-maven Like to make sure your happy with the idea and it doesn't break any restriction you might have that I didn't recognize. It does include the XSD 3.3 content, including licences, and references to your website. Greg >>> Boris Kolpackov 21/06/2012 5:37 AM >>> Hi Greg, Greg Domjan writes: > I was wondering if the "XSD: XML Data Binding for C++" was made available as > * a maven plugin and dependency > * a NuGet dependency No, not at the moment. Both of these tools don't seem to be used very frequently in C++ projects. From NuGet FAQ I see that they only support C#, F# and Visual Basic projects. > Or if you would consider providing it in that form in future? If there is a widespread demand, then we would consider this. So far you are the only person asking. But if you can come up with something like this and would like to contribute it, then that would be welcome! We have a Wiki page that lists instructions/code for integrating XSD with various IDEs, build systems, etc. For example, there are several CMake modules available. Boris From boris at codesynthesis.com Wed Jul 18 03:31:12 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jul 18 03:21:46 2012 Subject: [xsd-users] availability as maven plugin & dependency In-Reply-To: <5005A9D20200000E00AC246F@novprvoes0310.provo.novell.com> References: <4FE1EC41.C828.000E.1@novell.com> <5005A9D20200000E00AC246F@novprvoes0310.provo.novell.com> Message-ID: Hi Greg, Greg Domjan writes: > Like to make sure your happy with the idea and it doesn't break any > restriction you might have that I didn't recognize. It does include > the XSD 3.3 content, including licences, and references to your website. I know next to nothing about Maven so maybe that's how things should be, but it seems strange to me that you had to include the tool itself with the build plugin. One major drawback is that when a new version of XSD is released, you will have to also release the new version of your plugin with the updated content. But, as I said, I don't know anything about Maven so maybe that's how things are done. There is definitely no problem with including XSD inside as long as the license is mentioned. Boris From emeng at qualcomm.com Fri Jul 20 01:48:41 2012 From: emeng at qualcomm.com (Meng, Emil) Date: Fri Jul 20 01:50:07 2012 Subject: [xsd-users] XSD 3.3.0 possible error when using type xsd:hexBinary with default value Message-ID: Hi, We have been trying to use xsd 3.3.0 and have run into some issues with our schema where 3.2.0 works without problems. After debugging the issue, we found what seems to be an error in the code generated in 3.3.0 under certain conditions. So far, we see the problem when the following conditions are true: 1. An element where Restrictions/enums are used, and there are greater than 9 entries 2. An element contains type xsd:hexBinary, and a default value exists (we're using 01ffff, unknown if other values cause the problem, but without a default value, things work fine) What happens is that the generated code has a literal value that is written in hex but without the '0x' prefix. This causes the compiler to not be able to differentiate a 'b' from a variable or a the decimal value 11. An example error case can be seen: ../../../../bin/xsd cxx-tree hello.xsd g++ -I../../../../libxsd -W -Wall -O3 -c driver.cxx -o driver.o g++ -I../../../../libxsd -W -Wall -O3 -c hello.cxx -o hello.o hello.cxx: In member function 'name::value name::_xsd_name_convert() const': hello.cxx:400: error: 'a' was not declared in this scope hello.cxx: At global scope: hello.cxx:413: error: 'a' was not declared in this scope hello.cxx:428: error: 'a' was not declared in this scope make: *** [hello.o] Error 1 We have taken the hello example and modified the hello.xsd file to exhibit the problem stated above. Below is the pasted schema (not sure how the mailing list handles attachments, so just pasting the file in... feel free to request an attachment and I will send it). In the example the enum "deadbabe" is the 10th element causing the generated code to have a literal 'a' instead of '0xa' or '10'. Any help in figuring this out would be greatly appreciated! Thanks, -emil hello.xsd no doc no doc The hello_t type consists of a greeting phrase and a collection of names to which this greeting applies. The greeting element contains the greeting phrase for this hello object. The name elements contains names to be greeted. The hello element is a root of the Hello XML vocabulary. Every conforming document should start with this element. From boris at codesynthesis.com Fri Jul 20 08:46:40 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jul 20 08:36:51 2012 Subject: [xsd-users] XSD 3.3.0 possible error when using type xsd:hexBinary with default value In-Reply-To: References: Message-ID: Hi Emil, Meng, Emil writes: > We have been trying to use xsd 3.3.0 and have run into some issues with our > schema where 3.2.0 works without problems. After debugging the issue, we > found what seems to be an error in the code generated in 3.3.0 under certain > conditions. So far, we see the problem when the following conditions are > true: > > 1. An element where Restrictions/enums are used, and there are greater > than 9 entries > 2. An element contains type xsd:hexBinary, and a default value exists (we're > using 01ffff, unknown if other values cause the problem, but without a > default value, things work fine) Bizarre-looking bug with a very simple explanation. Took me some time to figure out what's going on. A good one ;-). What happens is we forget to restore the decimal format on the stream after writing out some hex values (the hexBinary default value). Later, in a completely unrelated type, we try to write a literal 10 integer which ends up being written as 'a'. In any case, I've fixed this for the next release of XSD. If you would like, I can build you a pre-release binary with the fix. Just let me knew which platform you need. And thanks for reporting this and providing the test case! Boris From emeng at qualcomm.com Fri Jul 20 10:43:47 2012 From: emeng at qualcomm.com (Meng, Emil) Date: Fri Jul 20 10:43:51 2012 Subject: [xsd-users] XSD 3.3.0 possible error when using type xsd:hexBinary with default value In-Reply-To: References: Message-ID: Hi Boris, Thanks so much for your quick response and the fix to the bug! I'm glad to hear that it was a relatively simple fix, certainly sounded like a fun one : ) We really appreciate it! -emil -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Friday, July 20, 2012 6:47 AM To: Meng, Emil Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] XSD 3.3.0 possible error when using type xsd:hexBinary with default value Hi Emil, Meng, Emil writes: > We have been trying to use xsd 3.3.0 and have run into some issues > with our schema where 3.2.0 works without problems. After debugging > the issue, we found what seems to be an error in the code generated in > 3.3.0 under certain conditions. So far, we see the problem when the > following conditions are > true: > > 1. An element where Restrictions/enums are used, and there are greater > than 9 entries > 2. An element contains type xsd:hexBinary, and a default value exists (we're > using 01ffff, unknown if other values cause the problem, but without a > default value, things work fine) Bizarre-looking bug with a very simple explanation. Took me some time to figure out what's going on. A good one ;-). What happens is we forget to restore the decimal format on the stream after writing out some hex values (the hexBinary default value). Later, in a completely unrelated type, we try to write a literal 10 integer which ends up being written as 'a'. In any case, I've fixed this for the next release of XSD. If you would like, I can build you a pre-release binary with the fix. Just let me knew which platform you need. And thanks for reporting this and providing the test case! Boris From skunkworx at verizon.net Sat Jul 21 15:32:10 2012 From: skunkworx at verizon.net (Skunk Worx) Date: Sat Jul 21 15:33:31 2012 Subject: [xsd-users] dlclose and xsd cxx-tree In-Reply-To: References: <4FFFB2F6.90806@verizon.net> Message-ID: <500B03BA.5030305@verizon.net> On 07/13/2012 02:02 AM, Boris Kolpackov wrote: > Hi John, > > Skunk Worx writes: > >> I seem to be having a problem with xsd cxx-tree and dlclose(). >> >> [...] >> >> ...why, after a successful dlclose(), is the .so still referenced in the >> application memory? > > I did some searches and there appears to be a bug either in GCC or glibc > (there doesn't seem to be a consensus on this). See these two threads > for more information: > > http://gcc.gnu.org/ml/gcc-help/2011-05/msg00403.html > http://www.cygwin.com/ml/binutils/2011-05/msg00376.html > > >> It is my understanding that this will result in an invalid .so >> initialization if the .so is subsequently reopened by the same >> application instance. > > I did some testing and what happens is dlclose() is simply ignored. > As a result, a subsequent dlopen() is also ignored. So it is ok > to re-load the library with this bug. > > Boris > Boris, Thank you for finding this. I was pretty lost. I contacted the Fedora Users and GNU libc-help mailing lists about this. The only response from GNU is that the following 2008 POSIX description of dlclose() is interpreted as "dlclose() is advisory in nature". http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlclose.html They interpret the text as having no requirement for dlclose() to result in the destructors being called on a .so file. In my experience this contradicts everything I've ever seen with the dlopen() / dlclose() of an .so file, but that's that. I'll just have to work around the bloat with a application level .so wrapper or something. Regards, John From maxagupov at gmail.com Mon Jul 30 01:54:49 2012 From: maxagupov at gmail.com (Max Agupov) Date: Mon Jul 30 02:18:02 2012 Subject: [xsd-users] xsd falls with exception bad_cast (Ubuntu 10.04) Message-ID: Hello Trying to convert attached shemas I run into a problem. The command 'xsd cxx-tree imod_global.xsd' brings to fall with exception bad_cast Error text: terminate called after throwing an instance of 'std::bad_cast' what(): St8bad_cast [1] 2942 abort xsd cxx-tree imod_global.xsd I`m using xsd-3.3.0-1, Ubuntu 10.04 Maxim Agupov -------------- next part -------------- A non-text attachment was scrubbed... Name: imod_global.xsd Type: application/octet-stream Size: 609 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20120730/26aa5c26/imod_global.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: imod_types.xsd Type: application/octet-stream Size: 1105 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20120730/26aa5c26/imod_types.obj From boris at codesynthesis.com Mon Jul 30 04:54:48 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jul 30 04:43:19 2012 Subject: [xsd-users] xsd falls with exception bad_cast (Ubuntu 10.04) In-Reply-To: References: Message-ID: Hi Max, Max Agupov writes: > Trying to convert attached shemas I run into a problem. I looked into this and the crash is caused by the global element and attribute in your schema that have the same name: While this is quite unusual, apparently it is valid XML Schema. I've fixed this bug for the next release of XSD. If you would like, I can build you a pre-release binary with the fix (it won't be the .deb package though, just a .tar.bz2). Alternatively, there is a fairly easy workaround: use different names for the attribute and element. Thanks for reporting this! Boris From drago.krznaric at se.transport.bombardier.com Mon Jul 30 12:29:51 2012 From: drago.krznaric at se.transport.bombardier.com (drago.krznaric@se.transport.bombardier.com) Date: Mon Jul 30 12:30:22 2012 Subject: [xsd-users] Drago Krznaric is out of the office. Message-ID: I will be out of the office starting Tue 2012/07/24 and will not return until Sun 2012/08/05. I will respond to your message when I return.