From boris at codesynthesis.com Mon Sep 3 09:55:13 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Xerces-C++ 2.8.0 released Message-ID: <20070903135513.GB1048@karelia> Hi, Wanted to let everybody know that Xerces-C++ 2.8.0 is available. This release is primarily focused on bug fixes, optimizations and build system improvements. For the complete list of changes in 2.8.0 see the release information page: http://xerces.apache.org/xerces-c/releases.html I've also written a blog post that discusses some of the user-visible changes in more detail: http://www.codesynthesis.com/~boris/blog/2007/09/02/xerces-2-8-0-released/ Xerces-C++ 2.8.0 is available in source code and as precompiled libraries for the following platforms and compilers: 32 bit: Windows x86 MS Visual C++ 7.1 (2003) Windows x86 MS Visual C++ 8.0 (2005) Linux x86 GCC 3.4.x or later Solaris 10 x86 GCC 3.4.x or later Solaris 10 x86 Sun C++ 5.7 (Studio 10) or later Solaris 10 SPARC GCC 3.4.x or later Solaris 10 SPARC Sun C++ 5.7 (Studio 10) or later AIX 5.3 PowerPC IBM XL C++ 7.0 or later HP-UX 11i PA-RISC HP aCC A.03.x HP-UX 11i IA-64 HP aCC A.06.x MacOS X 10.4 Tiger x86 GCC 4.0.x (Xcode 2.x) or later MacOS X 10.4 Tiger PowerPC GCC 4.0.x (Xcode 2.x) or later 64 bit: Windows x86-64 MS Visual C++ 8.0 (2005) Linux x86-64 GCC 3.4.x or later Solaris 10 x86-64 GCC 3.4.x or later Solaris 10 x86-64 Sun C++ 5.7 (Studio 10) or later Solaris 10 SPARC GCC 3.4.x or later Solaris 10 SPARC Sun C++ 5.7 (Studio 10) or later AIX 5.3 PowerPC IBM XL C++ 7.0 or later HP-UX 11i PA-RISC HP aCC A.03.x HP-UX 11i IA-64 HP aCC A.06.x All these precompiled libraries were tested with XSD and can be downloaded along with the source code archives from: http://xerces.apache.org/xerces-c/download.cgi Enjoy, Boris From boris at codesynthesis.com Tue Sep 4 14:52:39 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Attempting to access attribute xml:base. In-Reply-To: <12285.194.109.230.85.1188034766.squirrel@webmail.xs4all.nl> References: <8644.194.109.230.85.1166735973.squirrel@webmail.xs4all.nl> <20061222093548.GB20058@karelia> <19842.194.109.230.85.1167412462.squirrel@webmail.xs4all.nl> <20061230175234.GB15258@karelia> <23487.194.109.230.85.1168705493.squirrel@webmail.xs4all.nl> <20070116213700.GB16367@karelia> <20371.194.109.230.85.1187897333.squirrel@webmail.xs4all.nl> <20070824081748.GA15774@karelia> <12285.194.109.230.85.1188034766.squirrel@webmail.xs4all.nl> Message-ID: <20070904185239.GB5778@karelia> Hi Jeroen, Jeroen N. Witmond [Bahco] writes: > > I took a look and it appears there are some constructs in both 2.3.1 > > and 3.0.0 that prevent anyType from being customized. I am going to > > try and fix this for the next release. I can also build you a pre- > > release binary if you would like to give it a try before the release. > > I would like that, but there is no big hurry. :) Ok, I've fixed the problem and also added the 'comments' example in examples/cxx/tree/custom/ which customizes the anyType in order to preserve/manipulate XML comments. I've built a pre-release GNU/Linux binary (hopefully that's what you are using) for you to test: http://www.codesynthesis.com/~boris/tmp/xsd-3.1.0.a1-i686-linux-gnu.tar.bz2 Let me know if you encounter any problems. Boris From sbalasub at qualcomm.com Wed Sep 5 08:10:23 2007 From: sbalasub at qualcomm.com (Balasubramanyam, Shivakumar) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] xml-schema exceptions. Message-ID: Hi, I get the following exception and am trying to find out what the possible cause for this exception, Received an xml_schema exceptionno type information available for type 'http://mediaflo.qualcomm.com/distribution/example#LibraryDIType' The example document is below, 0 String romance String 1967-08-13 1967-08-13 I can send the complete example if needed. Thanks, Shiva From boris at codesynthesis.com Wed Sep 5 08:13:16 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] xml-schema exceptions. In-Reply-To: References: Message-ID: <20070905121316.GC9015@karelia> Hi Shiva, Balasubramanyam, Shivakumar writes: > Received an xml_schema exceptionno type information available for type > 'http://mediaflo.qualcomm.com/distribution/example#LibraryDIType' This error usually means that you haven't compiled the schema where LibraryDIType is defined with the --generate-polymorphic option. Or you haven't included the generated .cxx file for this type into your application. If none of this helps then please send the example (you can send it directly to me if you want to keep your schemas private). Boris From uri at hyperroll.com Wed Sep 5 09:32:56 2007 From: uri at hyperroll.com (Uri Karagila) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] xsd: cannot compile on HP-UX Message-ID: <783879783B65E44995520FEF376C45380B5A8A@ilexch1.int.hyperroll.com> Hi, We use the following compiler on the HP-UX 11.11 (PA RISC): aCC: HP ANSI C++ B3910B A.03.63 We used to compile with default settings (like with the "-AP" flag: Classic environment). 1. The XSD generated code cannot be compiled with this option, and our shared libraries become incompatible with 3rd party products that were build with "-AP" flag, too. 2. When we've tried to compile the whole code with the "-AA" flag (Standard environment), the XSD generated files could not be compiled. We absolutely do not want to use STLport product with "-Aa" (we need to check the performance and correctness of the thing, and this may take us a long time, and can be very expensive for us). The problem example. void Load::parse (::xsd::cxx::xml::dom::parser< char >& p, ::xml_schema::flags f) { ... if (!namString_.present ()) { this->namString ( namString_traits::create ( /// <<< FOR THIS LINE !!! ::std::string ("NAM"), &p.element (), f, this)); } ... } The compiler's complaints are: Error 226: "HyperRoll-Load.cxx", line 2251 # No appropriate function found for call of 'auto_ptr::auto_ptr'. Last viable candidate was "std::auto_ptr > >::auto_ptr(std::auto_ptr > > &)" ["/opt/aCC/include_std/memory", line 838]. Argument of type 'class auto_ptr > >' could not be converted to 'std::auto_ptr > > &'. namString_traits::create ( ^^^^^^^^^^^^^^^^^^^^^^^^^^ Please solve this issue in a portable way. From boris at codesynthesis.com Wed Sep 5 13:30:30 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] xsd: cannot compile on HP-UX In-Reply-To: <783879783B65E44995520FEF376C45380B5A8A@ilexch1.int.hyperroll.com> References: <783879783B65E44995520FEF376C45380B5A8A@ilexch1.int.hyperroll.com> Message-ID: <20070905173030.GF9015@karelia> Hi Uri, Uri Karagila writes: > We used to compile with default settings (like with the "-AP" flag: > Classic environment). > 1. The XSD generated code cannot be compiled with this option, and our > shared libraries become incompatible with 3rd party products that were > build with "-AP" flag, too. XSD generated code can be compiled with -AP if you add -Aa and use STLPort for standard-conformant C++ standard library, as discussed on this page: http://wiki.codesynthesis.com/XSD/HP-UX_AP Note that you only need to add -Aa while compiling the generated code and code that uses it. > 2. When we've tried to compile the whole code with the "-AA" flag > (Standard environment), the XSD generated files could not be compiled. That's strange. We test and make sure each release works with aCC3. Which version of XSD are you using? If it's other than 2.3.1 or 3.0.0, can your upgrade to either one of these and see if it makes a difference. > We absolutely do not want to use STLport product with "-Aa" Unfortunately that's the only way to use XSD with aCC3 in "Classic mode" (-AP). The problem with "Classic mode" is that the C++ Library provided in this mode is nowhere close to the Standard C++, it has different interfaces and is missing a lot of parts that XSD depends on. That is why you need STLPort. Also note that if you are using third-party libraries that were compiled with -AP then all your code will have to be compiled with -AP. Boris From boris at codesynthesis.com Fri Sep 7 02:42:46 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Re: XSD compile error In-Reply-To: <40E8ED6ED5E2E54B8B93106DA4B8E1B002C273D2@CHQMAIL3.lands.resnet.qg> References: <40E8ED6ED5E2E54B8B93106DA4B8E1B002C273D2@CHQMAIL3.lands.resnet.qg> Message-ID: <20070907064246.GA25863@karelia> Hi Roger, In the future please send technical questions like these to the xsd-users mailing list (which I've CC'ed) instead of to me directly. This way a) other developers who may have experienced a similar problem can provide you with a solution b) questions and answers will be archived and available to others with similar problems. Fraser Roger writes: > First of all - thank you for XSD. I have been using it extensively in > VS2005 and it is truly an excellent product. Thanks, I am glad you like it. > I am now porting my projects to Linux (fc7). I decided to download the > source code and compile myself using your step-by-step instructions on > http://www.codesynthesis.com/projects/xsd/extras/build-unix.xhtml. > > All works well except for the last step when I attempt to compile XSD. > Here's what I see: > > [...] > > make: *** No rule to make target > `/home/fraserr/dev/boost_1_34_1/stage/lib/libboost_filesystem-gcc-1_34_1 > .so', needed by > `/home/fraserr/dev/libxsd-frontend-1.10.0/build/import/libboost/filesyst > em/filesystem.l'. Stop. Can you make sure there is libboost_filesystem-gcc-1_34_1.so in /home/fraserr/dev/boost_1_34_1/stage/lib? I didn't have a chance to test everything with 1.34.x yet. Maybe the boost folks changed their library naming schema again. If it is there but with a different name, you can simply create a symlink with the name XSD expects. > I note that during the initial run of make, I am prompted with: > > > Embed dynamic library paths into executable (rpath)? > [y]: > > > This wasn't on your instructions page, so I have been typing in 'n' - is > this OK? That's ok. Either way it shouldn't cause the build to fail. If you answer yes to this option then library paths will be embedded into the XSD executable so you won't have to set LD_LIBRARY_PATH to include, for example, /home/fraserr/dev/boost_1_34_1/stage/lib. Boris From raulh39 at tid.es Fri Sep 7 05:55:33 2007 From: raulh39 at tid.es (Raul Huertas) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Re: XSD compile error In-Reply-To: <20070907064246.GA25863@karelia> References: <40E8ED6ED5E2E54B8B93106DA4B8E1B002C273D2@CHQMAIL3.lands.resnet.qg> <20070907064246.GA25863@karelia> Message-ID: <46E12015.5050806@tid.es> Boris Kolpackov escribi?: ... All works well except for the last step when I attempt to compile XSD. Here's what I see: [...] make: *** No rule to make target `/home/fraserr/dev/boost_1_34_1/stage/lib/libboost_filesystem-gcc-1_34_1 .so', needed by `/home/fraserr/dev/libxsd-frontend-1.10.0/build/import/libboost/filesyst em/filesystem.l'. Stop. Can you make sure there is libboost_filesystem-gcc-1_34_1.so in /home/fraserr/dev/boost_1_34_1/stage/lib? I didn't have a chance to test everything with 1.34.x yet. Maybe the boost folks changed their library naming schema again. If it is there but with a different name, you can simply create a symlink with the name XSD expects. JMTC: I think that boost_1_34_1 have changed the library naming schema again. In this version, if you use the bjam utility (the "make" they use) with the option "--layout=system", the filesystem library is builded with this names: libboost_filesystem-d.a libboost_filesystem-mt-d.a libboost_filesystem-mt.a libboost_filesystem.a libboost_filesystem-d.so libboost_filesystem-mt-d.so libboost_filesystem-mt.so libboost_filesystem.so Without "--layout=system" you get (I haven't tested this): libboost_filesystem-gcc-mt-d-1_34_1.so See [1]http://tinyurl.com/ypdqsh for the details. Hth, Raul. References 1. http://tinyurl.com/ypdqsh From jnw at xs4all.nl Sat Sep 8 10:22:08 2007 From: jnw at xs4all.nl (Jeroen N. Witmond [Bahco]) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Attempting to access attribute xml:base. In-Reply-To: <20070904185239.GB5778@karelia> References: <8644.194.109.230.85.1166735973.squirrel@webmail.xs4all.nl> <20061222093548.GB20058@karelia> <19842.194.109.230.85.1167412462.squirrel@webmail.xs4all.nl> <20061230175234.GB15258@karelia> <23487.194.109.230.85.1168705493.squirrel@webmail.xs4all.nl> <20070116213700.GB16367@karelia> <20371.194.109.230.85.1187897333.squirrel@webmail.xs4all.nl> <20070824081748.GA15774@karelia> <12285.194.109.230.85.1188034766.squirrel@webmail.xs4all.nl> <20070904185239.GB5778@karelia> Message-ID: <23224.194.109.230.85.1189261328.squirrel@webmail.xs4all.nl> Hi Boris, Boris Kolpackov writes: > Hi Jeroen, > > Jeroen N. Witmond [Bahco] writes: > >> > I took a look and it appears there are some constructs in both 2.3.1 >> > and 3.0.0 that prevent anyType from being customized. I am going to >> > try and fix this for the next release. I can also build you a pre- >> > release binary if you would like to give it a try before the release. >> >> I would like that, but there is no big hurry. :) > > Ok, I've fixed the problem and also added the 'comments' example in > examples/cxx/tree/custom/ which customizes the anyType in order to > preserve/manipulate XML comments. > > I've built a pre-release GNU/Linux binary (hopefully that's what you > are using) for you to test: > > http://www.codesynthesis.com/~boris/tmp/xsd-3.1.0.a1-i686-linux-gnu.tar.bz2 > > Let me know if you encounter any problems. I'm using GNU/Linux, as you guessed, and the newly added 'comments' example works out of the box, as expected. :) Unfortunately, I still get compiler errors on the generated code with this pre-release; see the attached file. Please let me know if you need more information to solve this problem. Jeroen. -------------- next part -------------- cd /home/bahco/Repository/bugreports/codesynthesis/xml-base/custom-intended/ make clean&&make lax.o rm XmlSchema.xsd *.?xx *.o driver rm: cannot remove `driver': No such file or directory make: [clean] Error 1 (ignored) echo "Dummy file which serves as timestap for make. It was generated on `date`." > XmlSchema.xsd /home/bahco/Sandbox/xsd-3.1.0.a1-i686-linux-gnu/bin/xsd cxx-tree --char-type wchar_t --generate-ostream \ --extern-xml-schema XmlSchema.xsd \ ../DOM_association/lax.xsd /home/bahco/Sandbox/xsd-3.1.0.a1-i686-linux-gnu/bin/xsd cxx-tree \ --char-type wchar_t \ --custom-type long=int64_t --custom-type unsignedLong=uint64_t --custom-type integer=int64_t \ --generate-xml-schema \ --custom-type anyType=XmlNamespace/anyType_base \ --hxx-prologue '#include "XmlNamespace-fwd.hpp"'\ --hxx-epilogue '#include "XmlNamespace.hpp"'\ XmlSchema.xsd g++ -g -Wall -W -I/home/bahco/Sandbox/xsd-3.1.0.a1-i686-linux-gnu/libxsd -c -o lax.o lax.cxx lax.cxx: In copy constructor ???metadox::foo_type::foo_type(const metadox::foo_type&, xml_schema::flags, xml_schema::container*)???: lax.cxx:128: error: invalid conversion from ???xml_schema::container*??? to ???xml_schema::type*??? lax.cxx:128: error: initializing argument 3 of ???xml_schema::XmlNamespace::XmlNamespace(const xml_schema::XmlNamespace&, xml_schema::flags, xml_schema::type*)??? lax.cxx: In constructor ???metadox::foo_type::foo_type(const xercesc_2_7::DOMElement&, xml_schema::flags, xml_schema::container*)???: lax.cxx:137: error: invalid conversion from ???xml_schema::container*??? to ???xml_schema::type*??? lax.cxx:137: error: initializing argument 3 of ???xml_schema::XmlNamespace::XmlNamespace(const xercesc_2_7::DOMElement&, xml_schema::flags, xml_schema::type*)??? /home/bahco/Sandbox/xsd-3.1.0.a1-i686-linux-gnu/libxsd/xsd/cxx/tree/elements.txx: In copy constructor ???xsd::cxx::tree::simple_type::simple_type(const xsd::cxx::tree::simple_type&, xsd::cxx::tree::flags, xsd::cxx::tree::type*) [with B = xml_schema::XmlNamespace]???: /home/bahco/Sandbox/xsd-3.1.0.a1-i686-linux-gnu/libxsd/xsd/cxx/tree/types.hxx:79: instantiated from ???xsd::cxx::tree::string::string(const xsd::cxx::tree::string&, xsd::cxx::tree::flags, xsd::cxx::tree::type*) [with C = wchar_t, B = xsd::cxx::tree::simple_type]??? lax.cxx:86: instantiated from here /home/bahco/Sandbox/xsd-3.1.0.a1-i686-linux-gnu/libxsd/xsd/cxx/tree/elements.txx:36: error: invalid conversion from ???xsd::cxx::tree::type*??? to ???xml_schema::type*??? /home/bahco/Sandbox/xsd-3.1.0.a1-i686-linux-gnu/libxsd/xsd/cxx/tree/elements.txx:36: error: initializing argument 3 of ???xml_schema::XmlNamespace::XmlNamespace(const xml_schema::XmlNamespace&, xml_schema::flags, xml_schema::type*)??? /home/bahco/Sandbox/xsd-3.1.0.a1-i686-linux-gnu/libxsd/xsd/cxx/tree/parsing.txx: In constructor ???xsd::cxx::tree::simple_type::simple_type(const xercesc_2_7::DOMElement&, xsd::cxx::tree::flags, xsd::cxx::tree::type*) [with B = xml_schema::XmlNamespace]???: /home/bahco/Sandbox/xsd-3.1.0.a1-i686-linux-gnu/libxsd/xsd/cxx/tree/parsing.txx:329: instantiated from ???xsd::cxx::tree::string::string(const xercesc_2_7::DOMElement&, xsd::cxx::tree::flags, xsd::cxx::tree::type*) [with C = wchar_t, B = xsd::cxx::tree::simple_type]??? lax.cxx:102: instantiated from here /home/bahco/Sandbox/xsd-3.1.0.a1-i686-linux-gnu/libxsd/xsd/cxx/tree/parsing.txx:75: error: invalid conversion from ???xsd::cxx::tree::type*??? to ???xml_schema::type*??? /home/bahco/Sandbox/xsd-3.1.0.a1-i686-linux-gnu/libxsd/xsd/cxx/tree/parsing.txx:75: error: initializing argument 3 of ???xml_schema::XmlNamespace::XmlNamespace(const xercesc_2_7::DOMElement&, xml_schema::flags, xml_schema::type*)??? make: *** [lax.o] Error 1 Compilation exited abnormally with code 2 at Sat Sep 8 16:07:20 From boris at codesynthesis.com Sun Sep 9 11:26:37 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Attempting to access attribute xml:base. In-Reply-To: <23224.194.109.230.85.1189261328.squirrel@webmail.xs4all.nl> References: <20061222093548.GB20058@karelia> <19842.194.109.230.85.1167412462.squirrel@webmail.xs4all.nl> <20061230175234.GB15258@karelia> <23487.194.109.230.85.1168705493.squirrel@webmail.xs4all.nl> <20070116213700.GB16367@karelia> <20371.194.109.230.85.1187897333.squirrel@webmail.xs4all.nl> <20070824081748.GA15774@karelia> <12285.194.109.230.85.1188034766.squirrel@webmail.xs4all.nl> <20070904185239.GB5778@karelia> <23224.194.109.230.85.1189261328.squirrel@webmail.xs4all.nl> Message-ID: <20070909152637.GA14889@karelia> Hi Jeroen, Jeroen N. Witmond [Bahco] writes: > Unfortunately, I still get compiler errors on the generated code with this > pre-release; see the attached file. Please let me know if you need more > information to solve this problem. You need to change xml_schema::type* in XmlNamespace.* to xml_schema::container* as is done in the comments example. After that change I was able to compile your example successfully. Boris From kroiz at hyperroll.com Sun Sep 9 15:44:38 2007 From: kroiz at hyperroll.com (Kroizman Guy) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] polymorphism plus sequence equals slicing objects Message-ID: <1189367078.5848.2.camel@localhost.localdomain> Hi, Is it possible to use polymorphism in a sequence? because a sequence of a base elements is translated to: vector and not: vector and then when (for instance) if we create a derived class from base and push it to the vector it gets sliced. From boris at codesynthesis.com Sun Sep 9 17:19:58 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] polymorphism plus sequence equals slicing objects In-Reply-To: <1189367078.5848.2.camel@localhost.localdomain> References: <1189367078.5848.2.camel@localhost.localdomain> Message-ID: <20070909211958.GA15492@karelia> Hi Kroizman, Kroizman Guy writes: > Is it possible to use polymorphism in a sequence? Yes, it is. > because a sequence of a base elements is translated to: > vector > and not: > vector No, actually it is translated to vector> Where smart_ptr is an implementation-specific smart pointer. When you do a push_back the sequence implementation uses clone() instead of copy constructor to make a complete copy of the object. The sequence also uses iterator adapters so that the result of say *s.begin () is a reference to base, not smart_ptr. > and then when (for instance) if we create a derived class from base > and push it to the vector it gets sliced. Are you create the derived class yourself or is it generated from a schema type by XSD? If it is generated by XSD then everything should work fine. Note also that you need to use polymorphism (the --generate-polymorphic option) in order for such a sequence to be properly serialized to/parsed from XML. Boris From kroiz at hyperroll.com Mon Sep 10 03:41:04 2007 From: kroiz at hyperroll.com (Kroizman Guy) Date: Sun Oct 11 15:33:58 2009 Subject: [Fwd: Re: [xsd-users] polymorphism plus sequence equals slicing objects] Message-ID: <1189410064.6267.13.camel@localhost.localdomain> -------- Forwarded Message -------- From: Kroizman Guy To: Boris Kolpackov Subject: Re: [xsd-users] polymorphism plus sequence equals slicing objects Date: Mon, 10 Sep 2007 10:40:26 +0300 what I am trying to do auto_ptr c; if(condition1()) { c = new Derived1(); } if(condition2()) { c = new Derived2(); } root.item().push_back( c ); can I do that? because what happen is that the overloaded push_back in sequence is not called, instead the push_back of vector gets call. and I guess that is not good. On Mon, 2007-09-10 at 09:40 +0300, Kroizman Guy wrote: > Oh I see, my bad, I did not see the sequence_common. > Thanks. > > On Sun, 2007-09-09 at 23:19 +0200, Boris Kolpackov wrote: > > Hi Kroizman, > > > > Kroizman Guy writes: > > > > > Is it possible to use polymorphism in a sequence? > > > > Yes, it is. > > > > > > > because a sequence of a base elements is translated to: > > > vector > > > and not: > > > vector > > > > No, actually it is translated to > > > > vector> > > > > Where smart_ptr is an implementation-specific smart pointer. When > > you do a push_back the sequence implementation uses clone() instead > > of copy constructor to make a complete copy of the object. The sequence > > also uses iterator adapters so that the result of say *s.begin () is > > a reference to base, not smart_ptr. > > > > > > > and then when (for instance) if we create a derived class from base > > > and push it to the vector it gets sliced. > > > > Are you create the derived class yourself or is it generated from > > a schema type by XSD? If it is generated by XSD then everything > > should work fine. Note also that you need to use polymorphism (the > > --generate-polymorphic option) in order for such a sequence to be > > properly serialized to/parsed from XML. > > > > > > Boris From boris at codesynthesis.com Mon Sep 10 04:17:16 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [Fwd: Re: [xsd-users] polymorphism plus sequence equals slicing objects] In-Reply-To: <1189410064.6267.13.camel@localhost.localdomain> References: <1189410064.6267.13.camel@localhost.localdomain> Message-ID: <20070910081716.GA18866@karelia> Hi Kroizman, Kroizman Guy writes: > what I am trying to do > > auto_ptr c; > > if(condition1()) > { > c = new Derived1(); > } > if(condition2()) > { > c = new Derived2(); > } > > root.item().push_back( c ); > > can I do that? Yes, try changing it to: root.item().push_back( *c ); > because what happen is that the overloaded push_back in sequence is not > called, instead the push_back of vector gets call. and I guess that is > not good. This can't happen because the underlying vector's push_back functions are not part of the sequence's interface. Boris From jnw at xs4all.nl Mon Sep 10 06:58:03 2007 From: jnw at xs4all.nl (Jeroen N. Witmond [Bahco]) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Attempting to access attribute xml:base. In-Reply-To: <20070909152637.GA14889@karelia> References: <20061222093548.GB20058@karelia> <19842.194.109.230.85.1167412462.squirrel@webmail.xs4all.nl> <20061230175234.GB15258@karelia> <23487.194.109.230.85.1168705493.squirrel@webmail.xs4all.nl> <20070116213700.GB16367@karelia> <20371.194.109.230.85.1187897333.squirrel@webmail.xs4all.nl> <20070824081748.GA15774@karelia> <12285.194.109.230.85.1188034766.squirrel@webmail.xs4all.nl> <20070904185239.GB5778@karelia> <23224.194.109.230.85.1189261328.squirrel@webmail.xs4all.nl> <20070909152637.GA14889@karelia> Message-ID: <20456.194.109.230.85.1189421883.squirrel@webmail.xs4all.nl> Hi Boris, Thanks for your hint. With it, I got my example to compile. I did not get it to link, because of deficiencies in my code. I have given up on this example, numbered 4 and named custom-intended, as these deficiencies are in code that is manually copied from code that xsd would generate. Instead I have gotten xsd to generate all required code in a custom type, without making any changes to xsd itself. See the example numbered 6 and named custom-anyType on my page http://www.xs4all.nl/~jnw/codesynthesis/xmlnamespace/index.html (Note to other readers: custom-anyType has been tested only with the prelease 3.1.0.a1 of xsd, and will not work with previous versions.) Now the only code I have to write is the application logic. At the moment this works for xml:base, but it should be trivial to expand this to include the xml:id, xml:lang and xml:space attributes. Also this his been tested only for xsd's --generate-ostream option, but again it should be trivial to expand it to other --generate options. Thanks, Jeroen. Boris Kolpackov writes: > Hi Jeroen, > > Jeroen N. Witmond [Bahco] writes: > >> Unfortunately, I still get compiler errors on the generated code with >> this >> pre-release; see the attached file. Please let me know if you need more >> information to solve this problem. > > You need to change xml_schema::type* in XmlNamespace.* to > xml_schema::container* as is done in the comments example. After that > change I was able to compile your example successfully. > > Boris > > From jnw at xs4all.nl Tue Sep 11 09:56:47 2007 From: jnw at xs4all.nl (Jeroen N. Witmond [Bahco]) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Constructors from xercesc::DOMAttr and std::wstring missing from generated custom type In-Reply-To: <20456.194.109.230.85.1189421884.squirrel@webmail.xs4all.nl> References: <20061222093548.GB20058@karelia> <19842.194.109.230.85.1167412462.squirrel@webmail.xs4all.nl> <20061230175234.GB15258@karelia> <23487.194.109.230.85.1168705493.squirrel@webmail.xs4all.nl> <20070116213700.GB16367@karelia> <20371.194.109.230.85.1187897333.squirrel@webmail.xs4all.nl> <20070824081748.GA15774@karelia> <12285.194.109.230.85.1188034766.squirrel@webmail.xs4all.nl> <20070904185239.GB5778@karelia> <23224.194.109.230.85.1189261328.squirrel@webmail.xs4all.nl> <20070909152637.GA14889@karelia> <20456.194.109.230.85.1189421884.squirrel@webmail.xs4all.nl> Message-ID: <10327.194.109.230.85.1189519007.squirrel@webmail.xs4all.nl> Hi Boris, In using the custom type generated by xsd (see my previous email) in 'real' code, I ran into a problem. The Schema I use contains the following fragment: This generates the following code: pubIdChars:: pubIdChars (const ::xercesc::DOMAttr& a, ::xml_schema::flags f, ::xml_schema::container* c) : ::xml_schema::string (a, f, c) { } pubIdChars:: pubIdChars (const ::std::wstring& s, const ::xercesc::DOMElement* e, ::xml_schema::flags f, ::xml_schema::container* c) : ::xml_schema::string (s, e, f, c) { } However, the code for wrapper_type, the custom type generated from XmlNamespace.xsd, does not contain constructors with xercesc_2_7::DOMAttr or std::wstring as first argument. Do you have a way out of this problem? Thanks, Jeroen. From uri at hyperroll.com Tue Sep 11 10:45:07 2007 From: uri at hyperroll.com (Uri Karagila) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] incomplet xml document handling Message-ID: <783879783B65E44995520FEF376C45380B5A8E@ilexch1.int.hyperroll.com> Hi, While trying to load or dump an incomplete xml document (which is obviously invalid) an exception is being thrown. What options do i have in order to workaround this behavior? Regards Uri From matthew.d.wood at intel.com Tue Sep 11 19:18:49 2007 From: matthew.d.wood at intel.com (Wood, Matthew D) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Extracting text nodes from "any" type mapping Message-ID: I am using XSD version 3.0.0 to manipulate data conforming to the XACML 2.0 policy schema (http://docs.oasis-open.org/xacml/2.0/access_control-xacml-2.0-policy-sc hema-os.xsd). I am translating the schema with the following command line: xsd cxx-tree --generate-wildcard --generate-polymorphic --show-sloc --namespace-map urn:oasis:names:tc:xacml:2.0:policy:schema:os=XACMLPolicyParser --char-type char --root-element Policy --root-element PolicySet access_control-xacml-2.0-policy-schema-os.xsd The complex type "AttributeValueType" is defined as follows: Valid document instances can contain either a Text node or an Element node. XSD maps the "any" type to a collection of DOMElement nodes. When an instance containing only text is parsed, the mapping ignores the Text node completely. What is the best way to work around this limitation? Do I need to parse with the xml_schema::flags::keep_dom flag to access the DOMNode objects and extract the text? Thanks, Matt From sbalasub at qualcomm.com Wed Sep 12 03:25:17 2007 From: sbalasub at qualcomm.com (Balasubramanyam, Shivakumar) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] search path for the xsd include files. Message-ID: Hi, I have a directory structure listed below. ROOTDIR/ Dir1/a.xsd Dir2/b.xsd b.xsd imports Dir1/a.xsd. What is the suggested way to have the import statement as and how do we tell code synthesis when generating the code from b.xsd to find a.xsd in ROOTDIR/Dir1. Basically, I am looking to see if I can provide a list of include paths. Thanks, Shiva From boris at codesynthesis.com Wed Sep 12 03:41:14 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] search path for the xsd include files. In-Reply-To: References: Message-ID: <20070912074114.GC12217@karelia> Hi Shiva, Balasubramanyam, Shivakumar writes: > ROOTDIR/ > Dir1/a.xsd > Dir2/b.xsd > > b.xsd imports Dir1/a.xsd. > > > What is the suggested way to have the import statement as and how do we > tell code synthesis when generating the code from b.xsd to find a.xsd in > ROOTDIR/Dir1. The import statement would have the path as "../Dir1/a.xsd". Unless the path is a full URI, XML Schema processors treat it as relative to the schema document which contains the import/include statement. > Basically, I am looking to see if I can provide a list of include paths. We were thinking about this and it would be trivial to implement in XSD, but decided against it for the following reason: the XML files may be referencing the schemas and in that case there won't be any way to specify extra search paths. Even if we added support for this in the generated code, such XML documents would be unusable with other validating XML parsers. Note also that there is a number of ways to change the generated C++ header include paths using the --include-prefix, --include-regex, and --include-with-brackets options (see the man pages for details). For example, the above import statement by default will be translated to the following #include directive: #include "../Dir1/a.hxx" If you would like to change it to "Dir1/a.hxx" (and add -IROOTDIR to your C++ compiler command line) then you can use the following option: --include-regex '%../(.+)%$1%' Boris From sbalasub at qualcomm.com Wed Sep 12 03:51:12 2007 From: sbalasub at qualcomm.com (Balasubramanyam, Shivakumar) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] search path for the xsd include files. In-Reply-To: <20070912074114.GC12217@karelia> References: <20070912074114.GC12217@karelia> Message-ID: Boris, Appreciate your quick and detailed response. This is what we follow and was wondering if we were doing it right. Thanks for the confirmation. Thanks, Shiva -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Wednesday, September 12, 2007 12:41 AM To: Balasubramanyam, Shivakumar Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] search path for the xsd include files. Hi Shiva, Balasubramanyam, Shivakumar writes: > ROOTDIR/ > Dir1/a.xsd > Dir2/b.xsd > > b.xsd imports Dir1/a.xsd. > > > What is the suggested way to have the import statement as and how do we > tell code synthesis when generating the code from b.xsd to find a.xsd in > ROOTDIR/Dir1. The import statement would have the path as "../Dir1/a.xsd". Unless the path is a full URI, XML Schema processors treat it as relative to the schema document which contains the import/include statement. > Basically, I am looking to see if I can provide a list of include paths. We were thinking about this and it would be trivial to implement in XSD, but decided against it for the following reason: the XML files may be referencing the schemas and in that case there won't be any way to specify extra search paths. Even if we added support for this in the generated code, such XML documents would be unusable with other validating XML parsers. Note also that there is a number of ways to change the generated C++ header include paths using the --include-prefix, --include-regex, and --include-with-brackets options (see the man pages for details). For example, the above import statement by default will be translated to the following #include directive: #include "../Dir1/a.hxx" If you would like to change it to "Dir1/a.hxx" (and add -IROOTDIR to your C++ compiler command line) then you can use the following option: --include-regex '%../(.+)%$1%' Boris From boris at codesynthesis.com Wed Sep 12 03:51:34 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] incomplet xml document handling In-Reply-To: <783879783B65E44995520FEF376C45380B5A8E@ilexch1.int.hyperroll.com> References: <783879783B65E44995520FEF376C45380B5A8E@ilexch1.int.hyperroll.com> Message-ID: <20070912075134.GD12217@karelia> Hi Uri, Uri Karagila writes: > While trying to load or dump an incomplete xml document (which is > obviously invalid) an exception is being thrown. What options do i > have in order to workaround this behavior? I think your best option is to make the document valid :-). Or you can change the schema to allow for "invalid" XML documents. You can then check for the "real" validity in the application when it is required. Even when you disable XML Schema validation in the underlying XML parser (the dont_validate flag), XSD-generated code still contains a number of checks that would prevent construction of an inconsistent object mode. One such check is for the required attribute or element If this check was not present then you could get an object model for which you have no way to test whether a required attribute/element is there and if you tried to access it you would end up with an application crash. I don't think anybody expects this kind of behavior. To give you more information on your particular situation we will need to know which exception is thrown and how invalid the XML document is. Boris From boris at codesynthesis.com Wed Sep 12 04:13:11 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Attempting to access attribute xml:base. In-Reply-To: <20456.194.109.230.85.1189421883.squirrel@webmail.xs4all.nl> References: <20061230175234.GB15258@karelia> <23487.194.109.230.85.1168705493.squirrel@webmail.xs4all.nl> <20070116213700.GB16367@karelia> <20371.194.109.230.85.1187897333.squirrel@webmail.xs4all.nl> <20070824081748.GA15774@karelia> <12285.194.109.230.85.1188034766.squirrel@webmail.xs4all.nl> <20070904185239.GB5778@karelia> <23224.194.109.230.85.1189261328.squirrel@webmail.xs4all.nl> <20070909152637.GA14889@karelia> <20456.194.109.230.85.1189421883.squirrel@webmail.xs4all.nl> Message-ID: <20070912081311.GE12217@karelia> Hi Jeroen, Jeroen N. Witmond [Bahco] writes: > Instead I have gotten xsd to generate all required code in > a custom type, without making any changes to xsd itself. This is a clever trick. I see you use sed to re-map the XML Schema namespace to xml_schema_2 when compiling XmlNamespace.xsd in order to avoid name clashes. You can achieve the same result by adding the following options to the command line: --namespace-map http://www.w3.org/2001/XMLSchema=xml_schema_2 Unfortunately, this whole approach has a number of deficiencies and won't work for the general case, as you have described in your other email. The problem is that anyType is quite a special type. It is a root of the generated type hierarchy and as such is a base for both simple types (i.e., type with only text content) and complex types (i.e., types with attributes and/or elements). Because simple types can be used as attribute and list element types, anyType includes parsing constructors for DOMAttr, etc. On the other hand, complex types cannot be used as attribute or list element types. Because of this restriction, XSD does not generate those constructors (DOMAttr, etc.) for complex types. Now if we look at your XmlNamespace.xsd: This type is a complex type because it contains the xml:base attribute. As a result the attribute/list constructors are not generated. But when you try to use it as anyType, those constructors are required. Boris From boris at codesynthesis.com Wed Sep 12 04:15:04 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Re: Constructors from xercesc::DOMAttr and std::wstring missing from generated custom type In-Reply-To: <10327.194.109.230.85.1189519007.squirrel@webmail.xs4all.nl> References: <23487.194.109.230.85.1168705493.squirrel@webmail.xs4all.nl> <20070116213700.GB16367@karelia> <20371.194.109.230.85.1187897333.squirrel@webmail.xs4all.nl> <20070824081748.GA15774@karelia> <12285.194.109.230.85.1188034766.squirrel@webmail.xs4all.nl> <20070904185239.GB5778@karelia> <23224.194.109.230.85.1189261328.squirrel@webmail.xs4all.nl> <20070909152637.GA14889@karelia> <20456.194.109.230.85.1189421884.squirrel@webmail.xs4all.nl> <10327.194.109.230.85.1189519007.squirrel@webmail.xs4all.nl> Message-ID: <20070912081504.GF12217@karelia> Hi Jeroen, Jeroen N. Witmond [Bahco] writes: > However, the code for wrapper_type, the custom type generated from > XmlNamespace.xsd, does not contain constructors with xercesc_2_7::DOMAttr > or std::wstring as first argument. I believe I have explained what's going on here in my other reply. Let me know if something is still unclear. Boris From boris at codesynthesis.com Wed Sep 12 04:57:46 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Extracting text nodes from "any" type mapping In-Reply-To: References: Message-ID: <20070912085746.GG12217@karelia> Hi Matthew, Wood, Matthew D writes: > > > > > maxOccurs="unbounded"/> > > > > > > > > Valid document instances can contain either a Text node or an Element > node. To be precise, they can contain text fragments and any elements in any order. > XSD maps the "any" type to a collection of DOMElement nodes. When > an instance containing only text is parsed, the mapping ignores the > Text node completely. The "any" particle only matches the elements in your type's content. The text is allowed because of the mixed="true". > What is the best way to work around this limitation? Do I need to parse > with the xml_schema::flags::keep_dom flag to access the DOMNode objects > and extract the text? Yes, this is one of the ways to access text in the mixed content models. This approach is used in the "mixed" example in the examples/cxx/tree/ directory. Alternatively, if you don't want to have the complete DOM tree hanging around just to access text in one element, you can customize the AttributeValueType and extract the text in its parsing constructor. This approach has an added advantage of easily supporting serializations in addition to parsing. The "wildcard" example in the examples/cxx/tree/custom/ directory shows how to do this for wildcard (any and anyAttribute) but the idea is the same for mixed content (you will be looking for DOMText instead of DOMElement or DOMAttr). For more information to type customization see the C++/Tree Mapping Customization Guide: http://wiki.codesynthesis.com/Tree/Customization_guide Boris From Johan.denBoer at NS.NL Wed Sep 12 08:39:51 2007 From: Johan.denBoer at NS.NL (Boer den, Johan J (NSC)) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] help no include path option for xsd files Message-ID: Hello, I have a problem. We have a lot of xsd files and have group the xsd files into subdirectories. Running the xsd program has a problem for finding the xsd files from import in xsd files. The xsd program does not have a --include-path option where to look for imported xsd files. How can I solve this problem Johan den boer Dutch railways ------------------------------------------------------------------------------------------ Deze e-mail, inclusief eventuele bijlage(n), is uitsluitend bestemd voor gebruik door de geadresseerde(n). Indien u dit bericht abusievelijk heeft ontvangen, mag de informatie daarvan niet worden gebruikt of openbaar gemaakt, noch aan derden worden verstrekt. Wij verzoeken u om in dat geval direct contact op te nemen met de afzender en de e-mail te vernietigen. This e-mail, including any appendix or appendices, is intended solely for use by the addressee(s). If you have received this message in error, the information it contains may not be used or disclosed, nor may it be revealed to third parties. In that case, please contact the sender immediately and destroy the e-mail. From boris at codesynthesis.com Wed Sep 12 08:48:37 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] help no include path option for xsd files In-Reply-To: References: Message-ID: <20070912124837.GH12217@karelia> Hi Johan, Boer den, Johan J (NSC) writes: > I have a problem. We have a lot of xsd files and have group the xsd > files into subdirectories. Running the xsd > program has a problem for finding the xsd files from import in xsd > files. The xsd program does not > have a --include-path option where to look for imported xsd files. I have answered a very similar question a couple of hours ago. questions: http://codesynthesis.com/pipermail/xsd-users/2007-September/001204.html answer: http://codesynthesis.com/pipermail/xsd-users/2007-September/001205.html Boris From uri at hyperroll.com Mon Sep 17 11:15:45 2007 From: uri at hyperroll.com (Uri Karagila) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] xsd: cannot compile on HP-UX Message-ID: <783879783B65E44995520FEF376C4538159422@ilexch1.int.hyperroll.com> Hi, HP-UX C++ compiler aCC (HP ANSI C++ B3910B A.03.63) does not compile xsd generated code even with "-AA" flag because of some incompatibility (or extended usage?) of auto_ptr<> template. The same code compiles on Linux with g++ (4.1.1). XSD of version 3.0.0. Stripped example exists. -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com ] Sent: Wed 9/5/2007 8:30 PM To: Uri Karagila Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] xsd: cannot compile on HP-UX Hi Uri, Uri Karagila writes: > We used to compile with default settings (like with the "-AP" flag: > Classic environment). > 1. The XSD generated code cannot be compiled with this option, and our > shared libraries become incompatible with 3rd party products that were > build with "-AP" flag, too. XSD generated code can be compiled with -AP if you add -Aa and use STLPort for standard-conformant C++ standard library, as discussed on this page: http://wiki.codesynthesis.com/XSD/HP-UX_AP Note that you only need to add -Aa while compiling the generated code and code that uses it. > 2. When we've tried to compile the whole code with the "-AA" flag > (Standard environment), the XSD generated files could not be compiled. That's strange. We test and make sure each release works with aCC3. Which version of XSD are you using? If it's other than 2.3.1 or 3.0.0, can your upgrade to either one of these and see if it makes a difference. > We absolutely do not want to use STLport product with "-Aa" Unfortunately that's the only way to use XSD with aCC3 in "Classic mode" (-AP). The problem with "Classic mode" is that the C++ Library provided in this mode is nowhere close to the Standard C++, it has different interfaces and is missing a lot of parts that XSD depends on. That is why you need STLPort. Also note that if you are using third-party libraries that were compiled with -AP then all your code will have to be compiled with -AP. Boris -------------- next part -------------- A non-text attachment was scrubbed... Name: hpux-xsd-aCC-auto_ptr.tar.Z Type: application/x-compress Size: 30720 bytes Desc: hpux-xsd-aCC-auto_ptr.tar.Z Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070917/ba734e61/hpux-xsd-aCC-auto_ptr.tar.bin From boris at codesynthesis.com Tue Sep 18 05:36:35 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] xsd: cannot compile on HP-UX In-Reply-To: <783879783B65E44995520FEF376C4538159422@ilexch1.int.hyperroll.com> References: <783879783B65E44995520FEF376C4538159422@ilexch1.int.hyperroll.com> Message-ID: <20070918093635.GA4897@karelia> Hi Uri, Uri Karagila writes: > HP-UX C++ compiler aCC (HP ANSI C++ B3910B A.03.63) > does not compile xsd generated code even with "-AA" flag > because of some incompatibility (or extended usage?) > of auto_ptr<> template. Thanks for the test case. We have identified and worked around the problem (aCC3 has a non-standard std::auto_ptr). I've build you a pre-release binary with the fix for HP-UX. Can you try it and let me know if you still have any problems? http://codesynthesis.com/~boris/tmp/xsd-3.1.0.a2-hppa-hpux.tar.gz Boris From Michael.Forstner at cpg.de Wed Sep 19 02:52:28 2007 From: Michael.Forstner at cpg.de (Forstner Michael) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Tree-Mapping and xsd:decimal several problems Message-ID: Hi all, I try to parse and serialize financial XML-Documents as specified by ISO20022: http://www.iso20022.org/index.cfm?item_id=60051 I've successfully generated a header and a source (cxx-tree) and it seems to work like a charm but following field is problematic: After parsing a XML-File with following content in a CurrencyAndAmount field, the internal double-value of the generated cxx-tree-class is still uninitialized: 288.35 After serializing to a XML-File, the decimal point is ',' instead of '.' and the setting 'fractionDigits value="2"' is ignored: 278,35000000000002 I am using XSD 3.0 and tried both Xerces-C 2.7 and 2.8. Thanks for any help, Michael Forstner From boris at codesynthesis.com Wed Sep 19 04:05:49 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Tree-Mapping and xsd:decimal several problems In-Reply-To: References: Message-ID: <20070919080549.GC28790@karelia> Hi Michael, Forstner Michael writes: > After parsing a XML-File with following content in a CurrencyAndAmount > field, the internal double-value of the generated cxx-tree-class is > still uninitialized: > > 288.35 > > After serializing to a XML-File, the decimal point is ',' instead of '.' I think your default locale has decimal point facet set to ',' instead of '.'. Since the spec prescribes that the decimal point should always be '.', irrespective of the locale, this is a bug in our parsing/serialization code. I've applied a fix to the 3.0.0 codebase which sets the stream's locale that is used internally by parsing and serialization code to locale::classic (). This locale corresponds to the "C" locale and always has decimal point as '.'. This fix will appear in the next version of XSD (3.1.0). I've also uploaded the changes that can be used with 3.0.0: http://www.codesynthesis.com/~boris/tmp/libxsd-3.0.0-float-locale.tar.gz Simply replace the two files in libxsd with the versions provided in the archive. > and the setting 'fractionDigits value="2"' is ignored: > > 278,35000000000002 The fractionDigits faced is not yet supported in the generated code. One way to overcome this is to customize the generated CurrencyAndAmount class to serialize only 2 fraction digits. For an example on how to customize the generated types, see the custom/ directory in example/cxx/tree/ as well as the C++/Tree Mapping Customization Guide: http://wiki.codesynthesis.com/Tree/Customization_guide In particular, the wildcard example shows how to customize the serialization operator. Also let me know if you would like me to implement the custom CurrencyAndAmount type for you. Boris From Michael.Forstner at cpg.de Wed Sep 19 04:38:21 2007 From: Michael.Forstner at cpg.de (Forstner Michael) Date: Sun Oct 11 15:33:58 2009 Subject: AW: [xsd-users] Tree-Mapping and xsd:decimal several problems In-Reply-To: <20070919080549.GC28790@karelia> References: <20070919080549.GC28790@karelia> Message-ID: Hi Boris, thanks for your fast reply. I'd really appreciate it if you could implement the custom CurrencyAndAmount type for me. Another problem is that after parsing a XML-File the internal double value is still uninitialized. This "bug" would also be fixed with this custom type? Thank you very much, Michael > -----Urspr?ngliche Nachricht----- > Von: Boris Kolpackov [mailto:boris@codesynthesis.com] > Gesendet: Mittwoch, 19. September 2007 10:06 > An: Forstner Michael > Cc: xsd-users@codesynthesis.com > Betreff: Re: [xsd-users] Tree-Mapping and xsd:decimal several problems > > Hi Michael, > > Forstner Michael writes: > > > After parsing a XML-File with following content in a > CurrencyAndAmount > > field, the internal double-value of the generated cxx-tree-class is > > still uninitialized: > > > > 288.35 > > > > After serializing to a XML-File, the decimal point is ',' > instead of '.' > > I think your default locale has decimal point facet set to ',' > instead of '.'. Since the spec prescribes that the decimal point > should always be '.', irrespective of the locale, this is a bug > in our parsing/serialization code. I've applied a fix to the > 3.0.0 codebase which sets the stream's locale that is used internally > by parsing and serialization code to locale::classic (). This locale > corresponds to the "C" locale and always has decimal point as '.'. > > This fix will appear in the next version of XSD (3.1.0). I've also > uploaded the changes that can be used with 3.0.0: > > http://www.codesynthesis.com/~boris/tmp/libxsd-3.0.0-float-loc > ale.tar.gz > > Simply replace the two files in libxsd with the versions provided in > the archive. > > > > and the setting 'fractionDigits value="2"' is ignored: > > > > Ccy="EUR">278,35000000000002 > > The fractionDigits faced is not yet supported in the generated code. > One way to overcome this is to customize the generated > CurrencyAndAmount > class to serialize only 2 fraction digits. For an example on how to > customize the generated types, see the custom/ directory in > example/cxx/tree/ as well as the C++/Tree Mapping Customization Guide: > > http://wiki.codesynthesis.com/Tree/Customization_guide > > In particular, the wildcard example shows how to customize the > serialization operator. Also let me know if you would like me to > implement the custom CurrencyAndAmount type for you. > > Boris > From Michael.Forstner at cpg.de Wed Sep 19 05:33:26 2007 From: Michael.Forstner at cpg.de (Forstner Michael) Date: Sun Oct 11 15:33:58 2009 Subject: AW: [xsd-users] Tree-Mapping and xsd:decimal several problems In-Reply-To: <20070919084719.GE28790@karelia> References: <20070919080549.GC28790@karelia> <20070919084719.GE28790@karelia> Message-ID: Hi Boris, sorry, I missunderstood you last mail so I thought this behaviour is still open. After recompiling my app with your patch and trying it out I saw, that your patch also fixes the uninitialized value. Thanks a lot. Michael > -----Urspr?ngliche Nachricht----- > Von: Boris Kolpackov [mailto:boris@codesynthesis.com] > Gesendet: Mittwoch, 19. September 2007 10:47 > An: Forstner Michael > Cc: Boris Kolpackov > Betreff: Re: [xsd-users] Tree-Mapping and xsd:decimal several problems > > Hi Michael, > > Forstner Michael writes: > > > Another problem is that after parsing a XML-File the > internal double value > > is still uninitialized. This "bug" would also be fixed with > this custom > > type? > > Are you saying there is still no value after applying the fix in: > > http://www.codesynthesis.com/~boris/tmp/libxsd-3.0.0-float-loc > ale.tar.gz > > and recompiling your application? > > > Thanks, > Boris > From boris at codesynthesis.com Wed Sep 19 09:41:14 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Tree-Mapping and xsd:decimal several problems In-Reply-To: References: <20070919080549.GC28790@karelia> Message-ID: <20070919134114.GF28790@karelia> Hi Michael, Forstner Michael writes: > I'd really appreciate it if you could implement the custom > CurrencyAndAmount type for me. Ok, here is the implementation and the test driver: http://www.codesynthesis.com/~boris/tmp/fraction-digits.tar.gz The custom CurrencyAndAmount implementation is in caa-custom.hxx and caa-custom.cxx. The included README file has information on how everything is tied together. Let me know if you have any problems with this code. Boris From drago.krznaric at se.transport.bombardier.com Wed Sep 19 10:56:33 2007 From: drago.krznaric at se.transport.bombardier.com (drago.krznaric@se.transport.bombardier.com) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] serializing without pretty printing Message-ID: Hi, I'm serializing an object models to an output stream and get a nicely formatted xml with blanks, newlines, and indentations. Is there a simple way to get a more compact format? I guess I would like to tell the xerces' dom writer to set the XMLUni:: fgDOMWRTFormatPrettyPrint feuture to false, but I don't see how to do that without changing the code of libxsd. Best regards, Drago _______________________________________________________________________________________________________________ This e-mail communication (and any attachment/s) may contain confidential or privileged information and is intended only for the individual(s) or entity named above and to others who have been specifically authorized to receive it. If you are not the intended recipient, please do not read, copy, use or disclose the contents of this communication to others. Please notify the sender that you have received this e-mail in error by reply e-mail, and delete the e-mail subsequently. Please note that in order to protect the security of our information systems an AntiSPAM solution is in use and will browse through incoming emails. Thank you. _________________________________________________________________________________________________________________ Ce message (ainsi que le(s) fichier(s)), transmis par courriel, peut contenir des renseignements confidentiels ou prot?g?s et est destin? ? l?usage exclusif du destinataire ci-dessus. Toute autre personne est, par les pr?sentes, avis?e qu?il est strictement interdit de le diffuser, le distribuer ou le reproduire. Si vous l?avez re?u par inadvertance, veuillez nous en aviser et d?truire ce message. Veuillez prendre note qu'une solution antipollupostage (AntiSPAM) est utilis?e afin d'assurer la s?curit? de nos syst?mes d'information et qu'elle fur?tera les courriels entrants. Merci. _________________________________________________________________________________________________________________ From boris at codesynthesis.com Wed Sep 19 14:28:48 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] serializing without pretty printing In-Reply-To: References: Message-ID: <20070919182848.GA2506@karelia> Hi Drago, drago.krznaric@se.transport.bombardier.com writes: > Is there a simple way to get a more compact format? I guess I would like > to tell the xerces' dom writer to set the XMLUni:: > fgDOMWRTFormatPrettyPrint > feuture to false, but I don't see how to do that without changing the > code of libxsd. You can serialize the object model to a DOM document and then serialize this document to XML without pretty-printing. For example: #include #include #include #include using namespace xercesc; namespace xml = xsd::cxx::xml; XMLPlatformUtils::Initialize (); { xml::dom::auto_ptr doc = root (x, map); std::ofstream ofs ("out.xml"); serialize (ofs, *doc); } XMLPlatformUtils::Terminate (); In this example, root() is the serialization function corresponding to your document root. serialize() is the function from Q3.2 in C++/Tree Mapping FAQ: http://wiki.codesynthesis.com/Tree/FAQ You will need to change the following line in this function though: writer->setFeature (XMLUni::fgDOMWRTFormatPrettyPrint, true); For more information on serializing your object model to DOM, see Section 4.7, "Serializing to DOM" in the C++/Tree Mapping User Manual: http://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#4.7 Boris From boris at codesynthesis.com Thu Sep 20 05:02:16 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] XSD/e 1.1.0 released Message-ID: <20070920090216.GC7084@karelia> Hi, We have released XSD/e 1.1.0. XSD/e is a validating XML parser and data binding generator for mobile and embedded systems. The NEWS file entries for this release are as follows: * The runtime library now provides parser implementations for all built-in XML Schema types. See Chapter 6, "Built-In XML Schema Type Parsers" in the Embedded C++/Parser Mapping Getting Started Guide for more information. * The mapping now supports automatic generation of sample parser implementations and a test driver. The --generate-noop-impl option triggers generation of a sample implementation with empty function bodies. The --generate-print-impl option triggers generation of a sample implementation that prints the data stored in XML to STDOUT. The --generate-test-driver option trigger generation of a test driver. For more information on this feature see the XSD Compiler Command Line Manual and the generated example in the example/cxx/parser/ directory. Other relevant new options include: --force-overwrite, --root-element-first, --root-element-last, and --root-element. * New example, example/cxx/parser/wildcard, shows how to parse the XML data matched by XML Schema wildcards (any and anyAttribute). * The xml_schema::document parser has been extended with overridable virtual functions start_root_element and end_root_element to support parsing of XML vocabularies with multiple document roots. See the multiroot example in the example/cxx/parser/ directory for more information. * Declaration for built-in parser implementations and the document parser are now automatically included into generated header files. As a result, you do not need to explicitly include the xml-schema-impl.hxx or document.hxx header files. * The default parser skeleton type and file suffixes have changed from _skel to _pskel and from -skel to -pskel, respectively. The --type-suffix and --file-suffix options were renamed to --skel-type-suffix and --skel-file-suffix, respectively. Precompiled binary distributions are available from the product's download page: http://www.codesynthesis.com/products/xsde/download.xhtml Source code for this release is available from the project's web page: http://www.codesynthesis.com/projects/xsde/ SHA1 checksums for the files: cf754b5c72149dacd99f13f5a42f36cb5a4f9251 xsde-1.1.0.tar.bz2 1e04fe0b2b3e3a845dd9283567bdedeb99e9a8a8 xsde-1.1.0-i686-linux-gnu.tar.bz2 2c67bb5d3e771e05d432f04ad7235b55a15d7b3b xsde-1.1.0-sparc-solaris.tar.gz ff901e424fa687d0334898dd088cdcbc2a1c13bb xsde-1.1.0-i686-windows.zip Enjoy, Boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070920/eaa929ae/attachment.pgp From ulbo at nykredit.dk Thu Sep 20 11:11:14 2007 From: ulbo at nykredit.dk (ulbo@nykredit.dk) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Missing elements after serialization using XSD 3.0.0 Message-ID: Hello codesynthesis When I do this... auto_ptr hs (schema::bec::BEC_Handelssystem (istringstream (bec), xsd::cxx::tree::flags::dont_validate)); xml_schema::namespace_infomap map; map[""].name = "http://www.nykredit.dk/schema/bec"; std::ostringstream _xml; schema::bec::BEC_Handelssystem (_xml, *hs, map, "ISO8859-1"); ... I go from (actual example) 620255 O 11 1 2007-08-10 SKV x CZK x x 1907.958973999999900 1893.098974000000000 TRY 6017494.639999999700000 x x 2007-08-13 14.859999999999999 2007-09-14 R R 2007-09-20 0000196934 J D N to 620255 O 11 1 2007-08-10 SKV x CZK x x 1907.9589739999999 1893.098974 TRY 6017494.6399999997 x x So, elements are missing (removed) after serialization - or I'm doing something wrong. This is only a problem in XSD 3.0.0 - in XSD 2.3.1 it works fine. Thanks Ulrich Borowiec From boris at codesynthesis.com Thu Sep 20 11:23:56 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Missing elements after serialization using XSD 3.0.0 In-Reply-To: References: Message-ID: <20070920152356.GA13029@karelia> Hi Ulrich, ulbo@nykredit.dk writes: > So, elements are missing (removed) after serialization - or I'm doing > something wrong. This is only a problem in XSD 3.0.0 - in XSD 2.3.1 it > works fine. Hm, interesting. Can you send me the schema so that I can debug this problem? You can send it to me directly if you don't want to make it public. Thanks Boris From ulbo at nykredit.dk Fri Sep 21 04:07:39 2007 From: ulbo at nykredit.dk (ulbo@nykredit.dk) Date: Sun Oct 11 15:33:58 2009 Subject: Vedr.: Re: [xsd-users] Missing elements after serialization using XSD 3.0.0 In-Reply-To: <20070920152356.GA13029@karelia> Message-ID: Hi again Boris I have found the error - in my code. The element INFO-BEKR in the xml string is not part of the schema I'm using. It is an error in my xslt transformation - the correct name for the element is INFO-BEKR1. In XSD 2.3.1 the element the element is just ignored by the reader (as in the example I gave you). In XSD 3.0.0 the rest of the elements at that level is ignored by the reader, and the error became more visible. Normaly I don't validate against schemas at this point as it seems XSD even with flag dont_validate does a good job validating the structure of the xml, and raising exceptions. But this wrong optional element managed to slip through. My mistake - sorry for the inconvenience! Ulrich Borowiec Boris Kolpackov 20-09-2007 17:23 Til ulbo@nykredit.dk cc xsd-users@codesynthesis.com Emne Re: [xsd-users] Missing elements after serialization using XSD 3.0.0 Hi Ulrich, ulbo@nykredit.dk writes: > So, elements are missing (removed) after serialization - or I'm doing > something wrong. This is only a problem in XSD 3.0.0 - in XSD 2.3.1 it > works fine. Hm, interesting. Can you send me the schema so that I can debug this problem? You can send it to me directly if you don't want to make it public. Thanks Boris From alanchao at comcast.net Sat Sep 22 15:25:49 2007 From: alanchao at comcast.net (Alan Chao) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Problem compiling cxx/tree/hello example for XSD 3.0.0 on Mac OS X (PowerPC) Message-ID: <5D3FC2F7-A849-42C7-A0C3-F8C8E9A6B1C0@comcast.net> Hi, I get the following error when executing % g++ -I /Users/Shared/Tools/xerces-c_2_8_0/include -I../../../../ libxsd -W -Wall -c driver.cxx -o driver.o in the examples/cxx/tree/hello directory: ../../../../libxsd/xsd/cxx/xml/dom/auto-ptr.hxx:157: error: declaration of 'xsd::cxx::xml::dom::auto_ptr::operator X* (xsd::cxx::xml::dom::auto_ptr::*)()const() const' ../../../../libxsd/xsd/cxx/xml/dom/auto-ptr.hxx:109: error: conflicts with previous declaration 'xsd::cxx::xml::dom::auto_ptr::operator xsd::cxx::xml::dom::auto_ptr' ../../../../libxsd/xsd/cxx/xml/dom/auto-ptr.hxx: In instantiation of `xsd::cxx::xml::dom::auto_ptr': ../../../../libxsd/xsd/cxx/tree/elements.hxx:539: instantiated from here ../../../../libxsd/xsd/cxx/xml/dom/auto-ptr.hxx:152: error: declaration of 'xsd::cxx::xml::dom::auto_ptr::operator X* (xsd::cxx::xml::dom::auto_ptr::*)()const() const [with X = xercesc_2_8::DOMDocument]' ../../../../libxsd/xsd/cxx/xml/dom/auto-ptr.hxx:109: error: conflicts with previous declaration 'xsd::cxx::xml::dom::auto_ptr::operator xsd::cxx::xml::dom::auto_ptr' make: *** [driver.o] Error 1 I'm using the binary distribution xsd-3.0.0-powerpc-macosx.tar.bz2 with xerces-c-_2_8_0-powerpc-macosx-gcc_4_0.tar.gz downloaded from xml.apache.org. I'm using Apple's GNU compiler that came with OS X Tiger. % g++ -v Reading specs from /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/specs Configured with: /private/var/tmp/gcc/gcc-4061.obj~8/src/configure -- disable-checking --prefix=/usr --mandir=/share/man --enable- languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^+.-]*$/ s/$/-4.0/ --with-gxx-include-dir=/include/gcc/darwin/4.0/c++ -- build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 -- target=powerpc-apple-darwin8 Thread model: posix gcc version 4.0.0 20041026 (Apple Computer, Inc. build 4061) Please help. Thanks. -Alan From boris at codesynthesis.com Sat Sep 22 18:28:21 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Problem compiling cxx/tree/hello example for XSD 3.0.0 on Mac OS X (PowerPC) In-Reply-To: <5D3FC2F7-A849-42C7-A0C3-F8C8E9A6B1C0@comcast.net> References: <5D3FC2F7-A849-42C7-A0C3-F8C8E9A6B1C0@comcast.net> Message-ID: <20070922222821.GA31142@karelia> Hi Alan, Alan Chao writes: > I get the following error when executing > > [...] > > % g++ -v > gcc version 4.0.0 20041026 (Apple Computer, Inc. build 4061) This seems to be a compiler problem. We have tested 3.0.0 on both PowerPC and x86 with g++ 4.0.1 (Apple Computer, Inc. build 5363) which comes standard on the Tiger CDs. I suggest that you upgrade to this or later version. You can get the latest version from Apple's website: http://developer.apple.com/tools/xcode/ We will probably remove the problematic code in the next release of XSD. If you must use g++ 4.0.0, let me know and I will build you a pre-release binary. Boris From alanchao at comcast.net Sun Sep 23 01:06:22 2007 From: alanchao at comcast.net (Alan Chao) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Problem compiling cxx/tree/hello example for XSD 3.0.0 on Mac OS X (PowerPC) In-Reply-To: <20070922222821.GA31142@karelia> References: <5D3FC2F7-A849-42C7-A0C3-F8C8E9A6B1C0@comcast.net> <20070922222821.GA31142@karelia> Message-ID: Hi Boris, Thanks. I'll upgrade the compiler. -Alan On Sep 22, 2007, at 6:28 PM, Boris Kolpackov wrote: > Hi Alan, > > Alan Chao writes: > >> I get the following error when executing >> >> [...] >> >> % g++ -v >> gcc version 4.0.0 20041026 (Apple Computer, Inc. build 4061) > > This seems to be a compiler problem. We have tested 3.0.0 on both > PowerPC and x86 with g++ 4.0.1 (Apple Computer, Inc. build 5363) > which comes standard on the Tiger CDs. I suggest that you upgrade > to this or later version. You can get the latest version from > Apple's website: > > http://developer.apple.com/tools/xcode/ > > We will probably remove the problematic code in the next release > of XSD. If you must use g++ 4.0.0, let me know and I will build > you a pre-release binary. > > Boris > From Ryan.Prather at peterson.af.mil Tue Sep 25 12:17:24 2007 From: Ryan.Prather at peterson.af.mil (Prather, Ryan C SSgt DMSG/WMTS) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Invalid Element Message-ID: I am getting the following error: Element 'SF_Lat' is not valid for content model: ... I have three sets of latitude and longitude arrays and after finishes outputing all three arrays I get the error. The SF_Lat and SF_Lon set are the very first set that run. Thanks Ryan From boris at codesynthesis.com Tue Sep 25 13:24:03 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Invalid Element In-Reply-To: References: Message-ID: <20070925172403.GD5265@karelia> Hi Ryan, Prather, Ryan C SSgt DMSG/WMTS writes: > I am getting the following error: > > Element 'SF_Lat' is not valid for content model: ... > > I have three sets of latitude and longitude arrays and after finishes > outputing all three arrays I get the error. The SF_Lat and SF_Lon set > are the very first set that run. Are you saying that the error is detected too late so that hooks for elements after the error point are executed or that the error itself is wrong? Can you provide a small schema and XML document that I can use to reproduce your problem? Thanks, Boris From david.r.moss at selex-comms.com Wed Sep 26 06:54:31 2007 From: david.r.moss at selex-comms.com (david.r.moss@selex-comms.com) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] In-memory validation In-Reply-To: <20070925172403.GD5265@karelia> Message-ID: Boris, A while ago there was talk of in-memory validation as outlined in an example below. Example code: // Load will fail when content is invalid. auto_ptr rt( root( "in-memory-validation-test.xml" ) ); // Modify with a valid value (range is 20-80 inclusive). rt->bounded_int( 50 ); cout << *rt << endl; rt->bounded_int( 100 ); // Ideally, this should fail (throw exception - as initial file load would) cout << *rt << endl; I believe this kind of capability was on your 'to do' list at one point; is this still the case and, if so, do you have an idea of time-scales?! Cheers, Dave. Dave Moss SELEX Communications Grange Road Christchurch Dorset BH23 4JE United Kingdom Tel: + 44 (0) 1202 404841 Email: david.r.moss@selex-comms.com ------------------------------------------------------------ This email and any attached files contains company confidential information which may be legally privileged. It is intended only for the person(s) or entity to which it is addressed and solely for the purposes set forth therein. If you are not the intended recipient or have received this email in error please notify the sender by return, delete it from your system and destroy any local copies. It is strictly forbidden to use the information in this email including any attachment or part thereof including copying, disclosing, distributing, amending or using for any other purpose. In addition the sender excludes all liabilities (whether tortious or common law) for damage or breach arising or related to this email including but not limited to viruses and libel. SELEX Communications Limited is a Private Limited Company registered in England and Wales under Company Number 964533 and whose Registered Office is Marconi House, New Street, CHELMSFORD, Essex. CM1 1PL. England. -------------- next part -------------- A non-text attachment was scrubbed... Name: in-memory-validation.xsd Type: application/octet-stream Size: 518 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070926/819f817b/in-memory-validation.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: in-memory-validation-test.xml Type: application/octet-stream Size: 282 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070926/819f817b/in-memory-validation-test.obj From boris at codesynthesis.com Wed Sep 26 08:33:33 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Re: In-memory validation In-Reply-To: References: <20070925172403.GD5265@karelia> Message-ID: <20070926123333.GC7763@karelia> Hi David, david.r.moss@selex-comms.com writes: > // Load will fail when content is invalid. > auto_ptr rt( root( "in-memory-validation-test.xml" ) ); > > // Modify with a valid value (range is 20-80 inclusive). > rt->bounded_int( 50 ); > cout << *rt << endl; > > rt->bounded_int( 100 ); // Ideally, this should fail (throw exception - as > initial file load would) > cout << *rt << endl; > > I believe this kind of capability was on your 'to do' list at one point; > is this still the case and, if so, do you have an idea of time-scales?! The plan has evolved a bit over time. The main problem with the in- memory validation is that the mapping of the XML Schema model to object model as implemented in C++/Tree will not allow certain kinds of structure validation that can be found in schema definitions. Without going into much detail, consider the following schema fragment: The C++/Tree mapping maps the there elements in the above construct to three independent sequences. It will be next to impossible to make sure the content in the object model matches the structure in the above schema. Note that this "loose" mapping is a trade-off between ease of use and exact content representation that we feel is preferable in most use-cases (most users don't want an object model that is as hard to use as DOM). As a result, the current plan is as follows: 1. Implement a subset of XML Schema validation in C++/Tree. The feature that we plan to support are for datatype-related validation (e.g., facets, etc.). The nice thing about this types of checks is that they are cheap, fast and allow instant error detection, as you have shown in your example above. 2. We are also working on another in-memory (or more precisely, hybrid in-memory/even-driven) mapping that will be more "low-level" compared to C++/Tree. It will support high-performance XML Schema structure and datatype validation during both parsing and serialization. Note also that for (1), some check are already supported in the generated code. For example enumeration facets are enforced for string-based types. The other checks will be implemented as requested by the users. So it would be helpful if you could provide me with a list XML Schema constructs that you would like validated in the generated code. We probably can support some of them for the next release of XSD. There is no definite time-frame for (2). The current plan is to release it some time in the first quarter of 2008. Boris From rlischner at proteus-technologies.com Wed Sep 26 10:43:50 2007 From: rlischner at proteus-technologies.com (Ray Lischner) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Poor performance of Unicode conversion Message-ID: In our performance measures, we see that a significant amount of time is spent transcoding UTF-8 to UTF-16 and vice versa. This is complete, total, 100% waste. Our code would be simpler, smaller, and faster if we could work purely with UTF-8, and skip all transcoding. I realize that Xerces is the source of the problem. Have you investigated any other XML libraries that might not have this performance penalty? We use cxx-tree and need to manipulate the DOM at times. -- Ray Lischner, Proteus Technologies From boris at codesynthesis.com Wed Sep 26 11:05:00 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Poor performance of Unicode conversion In-Reply-To: References: Message-ID: <20070926150500.GE7763@karelia> Hi Ray, Ray Lischner writes: > In our performance measures, we see that a significant amount of time > is spent transcoding UTF-8 to UTF-16 and vice versa. Do you know if the bulk of it is spent in the XML-to-DOM stage or the DOM-to-object model stage? Or is it your own manipulation of DOM? I am also somewhat surprised since the transcoding should be very fast. > Our code would be simpler, smaller, and faster if we could work purely > with UTF-8, and skip all transcoding. > > I realize that Xerces is the source of the problem. Have you investigated > any other XML libraries that might not have this performance penalty? We > use cxx-tree and need to manipulate the DOM at times. The only other viable (stability and maturity-wise) candidate that I can think of is libxml2. There are a number of problems, however: 1. XML Schema validation support in libxml2 is not usable. 2. It's a C library and its DOM-like representation is very low-level. I am not sure how usable it will be. 3. I find the documentation unreadable. We are also working on another in-memory (or rather hybrid in-memory/ event-driven) mapping that will address this and other issues. It won't be based on DOM but there will still be a way to get under the hood with an even-driven API similar to SAX (it will be based on the C++/Parser mapping). Do you think this will be a viable approach for you in the long run? Boris From david.r.moss at selex-comms.com Wed Sep 26 11:04:54 2007 From: david.r.moss at selex-comms.com (david.r.moss@selex-comms.com) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Re: In-memory validation In-Reply-To: <20070926123333.GC7763@karelia> Message-ID: Boris, At the moment, datatype-related validation is the primary thing we're looking for. In addition to enumerations, I'd like to see validation for: * uniqueness i.e. can't add data that would break schema uniqueness constraints. * numeric ranges (e.g. min, max facets) * string length and pattern facets * list length (both min / max occurrence of an element in a sequence as well as min / max items in a xsd list type) * boolean * date and time ranges - mapping to boost::date_time would help with this i guess. Cheers, Dave. Dave Moss SELEX Communications Grange Road Christchurch Dorset BH23 4JE United Kingdom Tel: + 44 (0) 1202 404841 Email: david.r.moss@selex-comms.com Boris Kolpackov 09/26/07 01:33 PM To david.r.moss@selex-comms.com cc xsd-users@codesynthesis.com Subject Re: In-memory validation Hi David, david.r.moss@selex-comms.com writes: > // Load will fail when content is invalid. > auto_ptr rt( root( "in-memory-validation-test.xml" ) ); > > // Modify with a valid value (range is 20-80 inclusive). > rt->bounded_int( 50 ); > cout << *rt << endl; > > rt->bounded_int( 100 ); // Ideally, this should fail (throw exception - as > initial file load would) > cout << *rt << endl; > > I believe this kind of capability was on your 'to do' list at one point; > is this still the case and, if so, do you have an idea of time-scales?! The plan has evolved a bit over time. The main problem with the in- memory validation is that the mapping of the XML Schema model to object model as implemented in C++/Tree will not allow certain kinds of structure validation that can be found in schema definitions. Without going into much detail, consider the following schema fragment: The C++/Tree mapping maps the there elements in the above construct to three independent sequences. It will be next to impossible to make sure the content in the object model matches the structure in the above schema. Note that this "loose" mapping is a trade-off between ease of use and exact content representation that we feel is preferable in most use-cases (most users don't want an object model that is as hard to use as DOM). As a result, the current plan is as follows: 1. Implement a subset of XML Schema validation in C++/Tree. The feature that we plan to support are for datatype-related validation (e.g., facets, etc.). The nice thing about this types of checks is that they are cheap, fast and allow instant error detection, as you have shown in your example above. 2. We are also working on another in-memory (or more precisely, hybrid in-memory/even-driven) mapping that will be more "low-level" compared to C++/Tree. It will support high-performance XML Schema structure and datatype validation during both parsing and serialization. Note also that for (1), some check are already supported in the generated code. For example enumeration facets are enforced for string-based types. The other checks will be implemented as requested by the users. So it would be helpful if you could provide me with a list XML Schema constructs that you would like validated in the generated code. We probably can support some of them for the next release of XSD. There is no definite time-frame for (2). The current plan is to release it some time in the first quarter of 2008. Boris ------------------------------------------------------------ This email and any attached files contains company confidential information which may be legally privileged. It is intended only for the person(s) or entity to which it is addressed and solely for the purposes set forth therein. If you are not the intended recipient or have received this email in error please notify the sender by return, delete it from your system and destroy any local copies. It is strictly forbidden to use the information in this email including any attachment or part thereof including copying, disclosing, distributing, amending or using for any other purpose. In addition the sender excludes all liabilities (whether tortious or common law) for damage or breach arising or related to this email including but not limited to viruses and libel. SELEX Communications Limited is a Private Limited Company registered in England and Wales under Company Number 964533 and whose Registered Office is Marconi House, New Street, CHELMSFORD, Essex. CM1 1PL. England. From rlischner at proteus-technologies.com Wed Sep 26 11:40:45 2007 From: rlischner at proteus-technologies.com (Ray Lischner) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Poor performance of Unicode conversion References: <20070926150500.GE7763@karelia> Message-ID: > Do you know if the bulk of it is spent in the XML-to-DOM stage or > the DOM-to-object model stage? Or is it your own manipulation of DOM? > I am also somewhat surprised since the transcoding should be very > fast. DOM-to-object model stage. Some of our schemas are predominantly strings. > 1. XML Schema validation support in libxml2 is not usable. That's a show-stopper. I've noticed how libxml2 says an XML document is valid when Xerces says it isn't. With only one exception, Xerces has been correct and libxml2 has been wrong. > 2. It's a C library and its DOM-like representation is very low-level. > I am not sure how usable it will be. The Xerces library is extremely C-like. (No destructors, so everything needs a formal release call. Test node type by checking node-type field that contains an enumerated value. Raw pointers passed everywhere. No UTF-16 string type, so raw XMLCh* pointers passed around. And so on.) > 3. I find the documentation unreadable. I agree, but I also find the Apache Xerces-C++ documentation to be unusable. I spend a lot of time experimenting to understand what the library actually does. > We are also working on another in-memory (or rather hybrid in-memory/ > event-driven) mapping that will address this and other issues. It won't > be based on DOM but there will still be a way to get under the hood with > an even-driven API similar to SAX (it will be based on the C++/Parser > mapping). Do you think this will be a viable approach for you in the > long run? Maybe. We need to manipulate document trees when we don't always have a schema. But if the interface is event-driven, I would need to invent my own DOM-like model to store the tree. Maybe that would be best, however. -- Ray Lischner, Proteus Technologies LLC From rlischner at proteus-technologies.com Wed Sep 26 12:08:43 2007 From: rlischner at proteus-technologies.com (Ray Lischner) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Poor performance of Unicode conversion References: <20070926150500.GE7763@karelia> Message-ID: > The only other viable (stability and maturity-wise) candidate that I can > think of is libxml2. There are a number of problems, however: Have you heard of Poco? http://www.appinf.com/poco They claim to have SAX and DOM support. I haven't tried it yet--just stumbled across it recently. -- Ray Lischner, Proteus Technologies LLC From rlischner at proteus-technologies.com Wed Sep 26 12:16:17 2007 From: rlischner at proteus-technologies.com (Ray Lischner) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Poor performance of Unicode conversion References: <20070926150500.GE7763@karelia> Message-ID: > Have you heard of Poco? http://www.appinf.com/poco > They claim to have SAX and DOM support. Never mind. I see that validation is on the "to do" list. -- Ray Lischner, Proteus Technologies LLC From Michael.Caruso at itt.com Wed Sep 26 13:14:43 2007 From: Michael.Caruso at itt.com (Caruso, Michael - AES) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] XDR Message-ID: <7DB20341F654384C8541A8E2FF63CCD702DD7662@01HRNMX09-1.aes.de.ittind.com> Is there XDR support in xsd? Thanks, Mike ***************************************************************** This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Corporation. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail. ******************************************************************* From boris at codesynthesis.com Wed Sep 26 13:53:56 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] XDR In-Reply-To: <7DB20341F654384C8541A8E2FF63CCD702DD7662@01HRNMX09-1.aes.de.ittind.com> References: <7DB20341F654384C8541A8E2FF63CCD702DD7662@01HRNMX09-1.aes.de.ittind.com> Message-ID: <20070926175356.GF7763@karelia> Hi Michael, Caruso, Michael - AES writes: > Is there XDR support in xsd? Yes, XDR is supported from XSD 3.0.0. The usage is very similar to the ACE CDR. Here is an example (taken from the XDR example for the next release of XSD): #include // std::memcpy #include #include #include extern "C" int overflow (char* p, char* buf, int n) { xml_schema::buffer* dst (reinterpret_cast (p)); std::size_t size (dst->size ()); std::size_t capacity (dst->capacity ()); // Implement exponential growth. // if (size + n > capacity && size + n < capacity * 2) dst->capacity (capacity * 2); dst->size (size + n); std::memcpy (dst->data () + size, buf, n); return n; } struct underflow_info { xml_schema::buffer* buf; std::size_t pos; }; extern "C" int underflow (char* p, char* buf, int n) { underflow_info* ui (reinterpret_cast (p)); std::size_t size (ui->buf->size () - ui->pos); n = size > n ? n : size; std::memcpy (buf, ui->buf->data () + ui->pos, n); ui->pos += n; return n; } int main () { xml_schema::buffer buf; // Write // { type& obj = ... // object model XDR xdr; xdrrec_create (&xdr, 0, 0, reinterpret_cast (&buf), 0, &overflow); xdr.x_op = XDR_ENCODE; xml_schema::ostream oxdr (xdr); oxdr << obj; xdrrec_endofrecord (&xdr, true); // flush the data. xdr_destroy (&xdr); } // Read // { underflow_info ui; ui.buf = &buf; ui.pos = 0; XDR xdr; xdrrec_create (&xdr, 0, 0, reinterpret_cast (&ui), &underflow, 0); xdr.x_op = XDR_DECODE; xdrrec_skiprecord (&xdr); xml_schema::istream ixdr (xdr); type* obj = new type (ixdr); xdr_destroy (&xdr); } } Boris From boris at codesynthesis.com Wed Sep 26 14:12:44 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Poor performance of Unicode conversion In-Reply-To: References: <20070926150500.GE7763@karelia> Message-ID: <20070926181244.GG7763@karelia> Ray, Ray Lischner writes: > DOM-to-object model stage. Some of our schemas are predominantly > strings. Ok, good. I am going to profile this and see if anything can be optimized. I will get back to you with the results. BTW, have you upgraded to Xerces-C++ 2.8.0? We've done some optimizations to the XML-to-DOM parsing code which results in 25-30% speedup. > That's a show-stopper. I've noticed how libxml2 says an XML document > is valid when Xerces says it isn't. With only one exception, Xerces > has been correct and libxml2 has been wrong. Yes, their XML Schema support is nowhere near production quality and the person who has started the development in that area is not working on it anymore. So there is little hope for the near future. > The Xerces library is extremely C-like. (No destructors, so everything > needs a formal release call. Test node type by checking node-type field > that contains an enumerated value. Raw pointers passed everywhere. No > UTF-16 string type, so raw XMLCh* pointers passed around. And so on.) That's all true but I think there is still a big gap between Xerces-C++ API and libxml2, especially if one is using custom smart pointers. > I agree, but I also find the Apache Xerces-C++ documentation to be > unusable. I spend a lot of time experimenting to understand what the > library actually does. At least there are examples and some basic introductory documentation in the Programming Guide. Libxml2 has no examples (you are supposed to study tests instead) and the only documentation is the API reference. > We need to manipulate document trees when we don't always have a > schema. But if the interface is event-driven, I would need to invent > my own DOM-like model to store the tree. Maybe that would be best, > however. The reason why DOM is so complex and often slow is because it has to support all cases, however insane they are. If your documents don't use mixed content (and that's the case for probably 90% of all XML vocabularies out there), a tree-like in-memory representation of XML becomes very simple. I agree that it should be fairly straightforward to add support for basic XML trees. We may even distribute something like this as part of the XSD runtime if there is demand. The reason why we don't want to base this mapping on a tree-like XML representation is because we want to be able to handle XML documents that are larger that the available RAM. Boris From Michael.Caruso at itt.com Wed Sep 26 14:54:43 2007 From: Michael.Caruso at itt.com (Caruso, Michael - AES) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] XDR In-Reply-To: <20070926175356.GF7763@karelia> References: <7DB20341F654384C8541A8E2FF63CCD702DD7662@01HRNMX09-1.aes.de.ittind.com> <20070926175356.GF7763@karelia> Message-ID: <7DB20341F654384C8541A8E2FF63CCD702DD77B9@01HRNMX09-1.aes.de.ittind.com> Does the xml_schema::buffer implementation keep everything in memory and write out to a file at the end of serialization or does it progressively write to a file? -Mike -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Wednesday, September 26, 2007 12:54 PM To: Caruso, Michael - AES Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] XDR Hi Michael, Caruso, Michael - AES writes: > Is there XDR support in xsd? Yes, XDR is supported from XSD 3.0.0. The usage is very similar to the ACE CDR. Here is an example (taken from the XDR example for the next release of XSD): #include // std::memcpy #include #include #include extern "C" int overflow (char* p, char* buf, int n) { xml_schema::buffer* dst (reinterpret_cast (p)); std::size_t size (dst->size ()); std::size_t capacity (dst->capacity ()); // Implement exponential growth. // if (size + n > capacity && size + n < capacity * 2) dst->capacity (capacity * 2); dst->size (size + n); std::memcpy (dst->data () + size, buf, n); return n; } struct underflow_info { xml_schema::buffer* buf; std::size_t pos; }; extern "C" int underflow (char* p, char* buf, int n) { underflow_info* ui (reinterpret_cast (p)); std::size_t size (ui->buf->size () - ui->pos); n = size > n ? n : size; std::memcpy (buf, ui->buf->data () + ui->pos, n); ui->pos += n; return n; } int main () { xml_schema::buffer buf; // Write // { type& obj = ... // object model XDR xdr; xdrrec_create (&xdr, 0, 0, reinterpret_cast (&buf), 0, &overflow); xdr.x_op = XDR_ENCODE; xml_schema::ostream oxdr (xdr); oxdr << obj; xdrrec_endofrecord (&xdr, true); // flush the data. xdr_destroy (&xdr); } // Read // { underflow_info ui; ui.buf = &buf; ui.pos = 0; XDR xdr; xdrrec_create (&xdr, 0, 0, reinterpret_cast (&ui), &underflow, 0); xdr.x_op = XDR_DECODE; xdrrec_skiprecord (&xdr); xml_schema::istream ixdr (xdr); type* obj = new type (ixdr); xdr_destroy (&xdr); } } Boris ***************************************************************** This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Corporation. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail. ******************************************************************* From boris at codesynthesis.com Wed Sep 26 14:56:51 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] XDR In-Reply-To: <7DB20341F654384C8541A8E2FF63CCD702DD77B9@01HRNMX09-1.aes.de.ittind.com> References: <7DB20341F654384C8541A8E2FF63CCD702DD7662@01HRNMX09-1.aes.de.ittind.com> <20070926175356.GF7763@karelia> <7DB20341F654384C8541A8E2FF63CCD702DD77B9@01HRNMX09-1.aes.de.ittind.com> Message-ID: <20070926185651.GA9573@karelia> Hi Michael, Caruso, Michael - AES writes: > Does the xml_schema::buffer implementation keep everything in memory and > write out to a file at the end of serialization or does it progressively > write to a file? The example I provided doesn't write anything to a file. xml_schema::buffer is a simple memory buffer abstraction (it is used for base64Binary and hexBinary built-in XML Schema types). The example shows how to serialize the object model into a dynamically expanding memory buffer and then read from it. If you want to read/write from/to a file, simply change the overflow() function to write to a file and the underflow() functions to read from a file. You can pass the file descriptor as the first argument. Boris From boris at codesynthesis.com Sun Sep 30 04:32:21 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] XSD 3.0.0 binary for Mac OS on x86 available Message-ID: <20070930083221.GA8758@karelia> Hi, We have released a precompiled binary of XSD 3.0.0 for Mac OS X on Intel processors. It can be downloaded from the usual place: http://www.codesynthesis.com/products/xsd/download.xhtml The SHA1 checksum for the file is as follows: 4d2c48adbff8253dcac76ef5cf9512dbc32d5d89 xsd-3.0.0-i686-macosx.tar.bz2 Enjoy, Boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070930/6c691ac8/attachment.pgp From yue.nicholas at gmail.com Sun Sep 30 23:14:22 2007 From: yue.nicholas at gmail.com (Nicholas Yue) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Importing element Message-ID: Hi, In XSD, how do I tell the program to retrieve an external schema? I tried looking for the information in the FAQ and user guide but could not find any. I might be using the wrong keyword. XSD fails on parsing this line in my schema "Gsml.xsd: error: 'http://schemas.opengis.net/gml/3.1.1/base/gml.xsd' is not a valid filesystem path" The original schema came from here https://www.seegrid.csiro.au/subversion/GeoSciML/trunk/schema/ I was trying to process Gsml.xsd Regards