From wduffy at videologyinc.com Fri Jun 3 15:45:07 2011 From: wduffy at videologyinc.com (William Duffy) Date: Fri Jun 3 15:45:48 2011 Subject: [xsd-users] Running resultant CodeSynthesis XSD executable on an embedded ARM-9 Linux 2.26.30 system? Message-ID: We are considering using the CodeSynthesis XSD to generate code that will be compiled for and run on an embedded ARM-9 SOC with the Linux 2.26.30 OS. I typically use Visual Studio 2008 as the IDE to write the code (and test some features within the Windows environment), we then cross-compile the code on an Ubuntu Linux system with the ARM-9 as our target device. The executables (and libraries) are then built (or copied) into the embedded system's image and executed therein. To help us get started, what are the steps required to support the resulting code from CodeSynthesis XSD. I assume these steps are required: Cross-compile the xerces-c++ runtime libraries to execute on the ARM-9 target Cross-compile the CodeSynthesis XSD runtime libraries to execute on the ARM-9 target Build the project source code using the CodeSynthesis XSD running on Visual Studio Cross-compile the resulting code for the ARM-9 target copy all libraries and project executable to the target system. If such is possible, is there a guide available for cross-compiling and installing the runtime libraries for both packages? Are there install packages available for embedded ARM-9 systems? Thanks and best regards, Bill Duffy From boris at codesynthesis.com Sat Jun 4 14:16:32 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sat Jun 4 12:00:09 2011 Subject: [xsd-users] Running resultant CodeSynthesis XSD executable on an embedded ARM-9 Linux 2.26.30 system? In-Reply-To: References: Message-ID: Hi William, William Duffy writes: > We are considering using the CodeSynthesis XSD to generate code that > will be compiled for and run on an embedded ARM-9 SOC with the Linux > 2.26.30 OS. While you can use XSD if your target has a fairly complete Linux setup, XSD/e is normally better suited for mobile/embedded systems. In particular, the C++/Hybrid mapping in XSD/e is similar to C++/Tree in XSD: http://www.codesynthesis.com/products/xsde/ > I typically use Visual Studio 2008 as the IDE to write the code (and > test some features within the Windows environment), we then > cross-compile the code on an Ubuntu Linux system with the ARM-9 as our > target device. The executables (and libraries) are then built (or > copied) into the embedded system's image and executed therein. > > To help us get started, what are the steps required to support the > resulting code from CodeSynthesis XSD. > I assume these steps are required: > Cross-compile the xerces-c++ runtime libraries to execute on the > ARM-9 target Yes, you will need to build Xerces-C++ for this target. Xerces-C++ uses the standard autotools-based build system and the configure command line will look along these lines: ./configure --host= CFLAGS=-O2 CXXFLAGS=-O2 \ CC= CXX= Some people run into trouble with building/using Xerces-C++ on stripped- down embedded Linux systems because some of the dependencies are not available or are not fully functional. The common example is the iconv library used for character conversion. But if you have a fairly complete Linux setup on your target, then this should work without any problems. > Cross-compile the CodeSynthesis XSD runtime libraries to execute on > the ARM-9 target The XSD runtime (libxsd) is a header-only library so this step is not necessary. > Build the project source code using the CodeSynthesis XSD running on > Visual Studio Yes, you will want to compile your schemas on your Windows box since that's where you will be doing the development. Then you can copy the generated code to the Ubuntu box for cross-compilation to the target. You could also compile the schemas on the Ubuntu box. > Cross-compile the resulting code for the ARM-9 target > copy all libraries and project executable to the target system. Yes, this will be the last step. > If such is possible, is there a guide available for cross-compiling and > installing the runtime libraries for both packages? There is no dedicated guide but the above instructions should generally be sufficient. If you decide to go with XSD/e, then the whole process will be much simpler since there are no external dependencies in XSD/e (e.g., to Xerces-C++). All you will need to do is build the XSD/e runtime library (libxsde) which is quite easy to do for both VC++ and a cross-compilation target (see the INSTALL file inside the XSD/e distribution for details). > Are there install packages available for embedded ARM-9 systems? We don't provide such packages but some distributions might. For example, Debian has a Xerces-C++ package for their armel target. Boris From c_xsdcxx at jonc.me.uk Mon Jun 6 04:59:28 2011 From: c_xsdcxx at jonc.me.uk (Jonathan Cooper) Date: Mon Jun 6 05:00:03 2011 Subject: [xsd-users] Extracting line number information from C++/Tree mapping objects Message-ID: <4DEC96F0.4000106@jonc.me.uk> Hi, I'm having to do additional semantic validation on a document parsed using C++/Tree, and would like to be able to report line & column number from the original XML file. As far as I can tell, it seems like the only way to do this is to maintain the DOM association and add user-data containing the information to the DOM nodes during parsing, which seems pretty evil especially using Xerces. Is there an easier way I'm missing? Has anyone done this already and can provide sample code? Many thanks, Jonathan From boris at codesynthesis.com Mon Jun 6 14:00:40 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jun 6 11:44:10 2011 Subject: [xsd-users] Extracting line number information from C++/Tree mapping objects In-Reply-To: <4DEC96F0.4000106@jonc.me.uk> References: <4DEC96F0.4000106@jonc.me.uk> Message-ID: Hi Jonathan, Jonathan Cooper writes: > I'm having to do additional semantic validation on a document parsed > using C++/Tree, and would like to be able to report line & column number > from the original XML file. As far as I can tell, it seems like the only > way to do this is to maintain the DOM association and add user-data > containing the information to the DOM nodes during parsing, which seems > pretty evil especially using Xerces. Is there an easier way I'm > missing? The other approach would be to customize the xml_schema::type class (which is a base for all the generated classes) and add the line and column information there. > Has anyone done this already and can provide sample code? There is an example that shows how to do this (see the README file inside for details): http://www.codesynthesis.com/~boris/tmp/linecol.tar.gz Boris From jiri at krutil.com Tue Jun 7 04:31:04 2011 From: jiri at krutil.com (Jiri Krutil) Date: Tue Jun 7 05:06:52 2011 Subject: [xsd-users] Preserving element order with groups when writing XML Message-ID: <20110607103104.15442ys9ra4pggqo@webmail.active24.cz> Hi In a previous post called "Bug with groups and occurence", someone described the same problem I am having now - order of elements is lost when working with xsd:groups. I have complexTypes representing binary and ternary operators, which may have different operands. The order of operands matters. Both operator and operand types are defined using xsd:group. In the old thread I mentioned, Boris describes a workaround involving DOM association, which allows to read such XML in order. My question is: is there a similar workaround for *writing* such XML documents? (I cannot change the schema.) Does it involve type customization? Could you please point me to a piece of docs or an example? Many thanks Jiri From boris at codesynthesis.com Tue Jun 7 07:30:55 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jun 7 05:14:22 2011 Subject: [xsd-users] Preserving element order with groups when writing XML In-Reply-To: <20110607103104.15442ys9ra4pggqo@webmail.active24.cz> References: <20110607103104.15442ys9ra4pggqo@webmail.active24.cz> Message-ID: Hi Jiri, Jiri Krutil writes: > I have complexTypes representing binary and ternary operators, which may > have different operands. The order of operands matters. Both operator and > operand types are defined using xsd:group. > > In the old thread I mentioned, Boris describes a workaround involving > DOM association, which allows to read such XML in order. > > My question is: is there a similar workaround for *writing* such XML > documents? (I cannot change the schema.) Does it involve type > customization? Could you please point me to a piece of docs or an > example? The following message in the archives provides a nice overview of the problem and the available workarounds: http://www.codesynthesis.com/pipermail/xsd-users/2010-March/002741.html In the case when you need to serialize the XML, the DOM association approach doesn't work and you have these three options: 1. Use type customization (links to further resources in the post above). 2. Change schema. 3. Use C++/Hybrid from XSD/e. Boris From c_xsdcxx at jonc.me.uk Tue Jun 7 06:04:12 2011 From: c_xsdcxx at jonc.me.uk (Jonathan Cooper) Date: Tue Jun 7 06:04:46 2011 Subject: [xsd-users] Extracting line number information from C++/Tree mapping objects In-Reply-To: References: <4DEC96F0.4000106@jonc.me.uk> Message-ID: <4DEDF79C.3030105@jonc.me.uk> On 06/06/2011 19:00, Boris Kolpackov wrote: > Hi Jonathan, > > Jonathan Cooper writes: >> Has anyone done this already and can provide sample code? > There is an example that shows how to do this (see the README file inside > for details): > > http://www.codesynthesis.com/~boris/tmp/linecol.tar.gz Thanks Boris, that looks perfect! Best wishes, Jonathan From gavin.s.davies at gmail.com Sat Jun 11 20:02:00 2011 From: gavin.s.davies at gmail.com (Gavin Davies) Date: Sun Jun 12 05:01:04 2011 Subject: [xsd-users] pthread issues when compiling libxsd-frontend Message-ID: Hi All, Please help. I have been trying to install xsd from source and have followed the build instructions using a pre-installed boost and xerces_c and specifying their src_root and out_root in the interactive configuration. I receive the following error when building libxsd-frontend: ld /nova/app/users/gsdavies/art/xsd-3.3.0/examples/cxx/tree/embedded/xsdbin /nusoft/app/externals/xerces_c/v3_1_1/Linux64bit+2.6-2.5-gcc45/lib/libxerces-c.a(PosixMutexMgr.o): In function `xercesc_3_1::PosixMutexMgr::create(xercesc_3_1::MemoryManager*)': /archives/nova/novasoft/xerces_c/v3_1_1/source/xerces-c-3.1.1/src/xercesc/util/MutexManagers/PosixMutexMgr.cpp:60: undefined reference to `pthread_mutexattr_init' /archives/nova/novasoft/xerces_c/v3_1_1/source/xerces-c-3.1.1/src/xercesc/util/MutexManagers/PosixMutexMgr.cpp:61: undefined reference to `pthread_mutexattr_settype' /archives/nova/novasoft/xerces_c/v3_1_1/source/xerces-c-3.1.1/src/xercesc/util/MutexManagers/PosixMutexMgr.cpp:66: undefined reference to `pthread_mutexattr_destroy' collect2: ld returned 1 exit status make: *** [/nova/app/users/gsdavies/art/xsd-3.3.0/examples/cxx/tree/embedded/xsdbin] Error 1 >From what I gather it is because I am may be missing a link to the pthread library but I can't seem to link this anywhere in the build of libxsd-frontend. Any help/insight? Cheers, Gavin From boris at codesynthesis.com Sun Jun 12 07:49:38 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Jun 12 05:33:02 2011 Subject: [xsd-users] pthread issues when compiling libxsd-frontend In-Reply-To: References: Message-ID: Hi Gavin, Gavin Davies writes: > Hi All, > > Please help. I have been trying to install xsd from source and have followed > the build instructions using a pre-installed boost and xerces_c and > specifying their src_root and out_root in the interactive configuration. > I receive the following error when building libxsd-frontend: > > [...] > > From what I gather it is because I am may be missing a link to the pthread > library but I can't seem to link this anywhere in the build of > libxsd-frontend. Right, because you are linking to the static Xerces-C++ library which was configured with threads enabled, any library/executable that links to Xerces-C++ will also need to explicitly link to the pthread library. The way to do this is to enter -lpthread when asked for extra C++ libraries during the configuration phase. If you don't want to reconfigure everything, you can just edit the build/cxx/configuration-dynamic.make and add this value to the cxx_extra_libs variable. Boris From gavin.s.davies at gmail.com Sun Jun 12 15:38:56 2011 From: gavin.s.davies at gmail.com (Gavin Davies) Date: Mon Jun 13 01:41:03 2011 Subject: [xsd-users] pthread issues when compiling libxsd-frontend In-Reply-To: References: Message-ID: Hi Boris, That did indeed help. Thank you! Gavin On Sun, Jun 12, 2011 at 6:49 AM, Boris Kolpackov wrote: > Hi Gavin, > > Gavin Davies writes: > > > Hi All, > > > > Please help. I have been trying to install xsd from source and have > followed > > the build instructions using a pre-installed boost and xerces_c and > > specifying their src_root and out_root in the interactive configuration. > > I receive the following error when building libxsd-frontend: > > > > [...] > > > > From what I gather it is because I am may be missing a link to the > pthread > > library but I can't seem to link this anywhere in the build of > > libxsd-frontend. > > Right, because you are linking to the static Xerces-C++ library which > was configured with threads enabled, any library/executable that links > to Xerces-C++ will also need to explicitly link to the pthread library. > > The way to do this is to enter -lpthread when asked for extra C++ > libraries during the configuration phase. If you don't want to > reconfigure everything, you can just edit the > build/cxx/configuration-dynamic.make and add this value to the > cxx_extra_libs variable. > > Boris > From mjklaim at gmail.com Mon Jun 13 05:23:35 2011 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Mon Jun 13 05:23:43 2011 Subject: [xsd-users] Differencies between xsd and xsde Message-ID: Hi, I've been using xsd for some time but I've just discovered xsde. There is no comparison page but from what I understand from reading the docs so far: 1. it targets embedded softwares 2. you have more control on what C++ features/costs exactly will be used in the generated cost 3. it have no dependencies (not even xerces, can even work without using STL) Can you confirm 3. ? If it's correct, it might be more interesting for me than using xsd. Are there other differences? Maybe in the kind of interfaces generated? xsd generate STL-like code, I find it useful. If using RTTI and STL makes me keep this kind of interface, I'll be happy with it. Last question : I don't find a way to specify something else than auto_ptr as smart-pointer type for root objects. Is there a way? I'd like to use std::unique_ptr (I'm using recent compilers) or std::shared_ptr. Or maybe a raw pointer in case I want all objects to be maintained by a "manager" class (or a factory classe or something that hold them all). If it's not possible at the moment, it might be worth considering (and it's a bit off-topic to the initial question...but oh well) I'm sorry I cannot test it yet to answer my own questions, I can't check at my dayjob. I prefer to ask before investigating more and not loose too much time at home. Jo?l Lamotte From mjklaim at gmail.com Mon Jun 13 05:31:00 2011 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Mon Jun 13 05:31:07 2011 Subject: [xsd-users] Re: Differencies between xsd and xsde In-Reply-To: References: Message-ID: 2011/6/13 Klaim - Jo?l Lamotte > 3. it have no dependencies (not even xerces, can even work without using > STL) > > Can you confirm 3. ? > > I've answered my own question by reading the answer to this thread : "Running resultant CodeSynthesis XSD executable on an embedded ARM-9 Linux 2.26.30 system?" > If such is possible, is there a guide available for cross-compiling and > > installing the runtime libraries for both packages? > There is no dedicated guide but the above instructions should generally > be sufficient. If you decide to go with XSD/e, then the whole process > will be much simpler since there are no external dependencies in XSD/e > (e.g., to Xerces-C++). All you will need to do is build the XSD/e > runtime library (libxsde) which is quite easy to do for both VC++ > and a cross-compilation target (see the INSTALL file inside the XSD/e > distribution for details). Excellent! From tomasonimattia at googlemail.com Mon Jun 13 08:58:12 2011 From: tomasonimattia at googlemail.com (Mattia Tomasoni) Date: Mon Jun 13 11:08:03 2011 Subject: [xsd-users] memory leak in serializer.hxx Message-ID: Dear codesynthesis users, I am using a method of the class serializer (examples/cxx/tree/streaming/serializer.hxx) to write an xml file: template inline void serializer:: next (const std::string& ns, const std::string& name, const T& x) { xsd::cxx::xml::dom::auto_ptr e (create (ns, name)); *e << x; serialize (*e); } the namespace, name of the element and the element itself are passed as parameters. A pointer to a DOMElement is created, filled with the information coming from the templetized parameter, and serialized (the method serialize invokes DOMLSSerializer::write). The above is invoked over an over on all the nodes of my document: as those get written, the RAM starts filling up until the program is killed (for big enough files). If I comment the line: *e << x; no memory leak occurs and the output xml file is filled with empty elements (with the specified name and namespace). My guess: "e" points to an area of memory that is modified (in some unorthodox way) by the "<<" operator and serialized to file. Once the job is done, a delete on the pointer "e" will cause a memory fault. To obviate the problem, codesynthesis created their own version of an auto_ptr that returns responsibility to the programmer (by using release) instead of freeing the memory. What to do? Thank you for your time! -- Mattia From boris at codesynthesis.com Tue Jun 14 06:04:10 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jun 14 03:47:33 2011 Subject: [xsd-users] memory leak in serializer.hxx In-Reply-To: References: Message-ID: Hi Mattia, Mattia Tomasoni writes: > The above is invoked over an over on all the nodes of my document: as those > get written, the RAM starts filling up until the program is killed (for big > enough files). > If I comment the line: > *e << x; > no memory leak occurs and the output xml file is filled with empty elements > (with the specified name and namespace). > > My guess: "e" points to an area of memory that is modified (in some > unorthodox way) by the "<<" operator and serialized to file. Once the job is > done, a delete on the pointer "e" will cause a memory fault. To obviate the > problem, codesynthesis created their own version of an auto_ptr that returns > responsibility to the programmer (by using release) instead of freeing the > memory. No, this is now what happens. dom::auto_ptr does release the DOM node. However, in Xerces-C++, the memory used by such a node is not freed immediately. Rather, the DOMDocument instance maintains its own heap of such memory blocks which it tries to reuse later. With this logic it is possible to have a situation where DOM cannot reuse any of the existing blocks and keeps allocating more and more memory. For example, if your application progressively serializes bigger and bigger elements, then DOM won't be able to reuse any of the existing memory blocks and will be forced to continuously allocate new ones. This situation is unlikely but possible. One way to resolve this is to free the DOMDocument instance after a certain number of elements have been serialized. This will force the freeing of all the allocated memory. Here is how you can do this: 1. Add the "size_t count_;" member after doc_ in the serializer_impl class in serializer.cxx. 2. Initialize it to 0 in the serializer_impl constructor. 3. Modify the two create() functions by adding the following code at the beginning of each of them: if (count_++ > 1000) { doc_.reset (dom_impl_.createDocument ()); count_ = 0; } Boris From boris at codesynthesis.com Tue Jun 14 06:18:48 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jun 14 04:02:10 2011 Subject: [xsd-users] Differencies between xsd and xsde In-Reply-To: References: Message-ID: Hi Jo?l, Klaim - Jo?l Lamotte writes: > 1. it targets embedded softwares Yes, though it can be used for general-purpose software as well. Quite a few people use it in such setups for various reasons. > 2. you have more control on what C++ features/costs exactly will be used in > the generated cost Correct. XSD/e is highly configurable when it comes to C++ features used as well as features provided by XSD/e (things like validation, regex support, etc). > 3. it have no dependencies (not even xerces, can even work without using > STL) Correct. > Are there other differences? Compared to XSD, XSD/e is more light-weight but also not as powerful as XSD. Some of the more advanced/convenience features found XSD are not available in XSD/e. > Maybe in the kind of interfaces generated? C++/Hybrid in XSD/e is similar but not the same as C++/Tree in XSD. > xsd generate STL-like code, I find it useful. If using RTTI and STL makes me > keep this kind of interface, I'll be happy with it. C++/Hybrid in XSD/e uses STL in the interface (e.g., to represent strings, etc) if enabled. Also, iterators in C++/Hybrid conform to the STL interface. > Last question : I don't find a way to specify something else than auto_ptr > as smart-pointer type for root objects. > Is there a way? I'd like to use std::unique_ptr (I'm using recent compilers) > or std::shared_ptr. This is a question about XSD, not XSD/e, right? XSD/e does not use auto_ptr. There is no way to change that in XSD but you can always "strip off" auto_ptr with the release function. Let's say root() is the parsing function. Then you can write: std::unique_ptr r (root (...).release ()); Also, std::shared_ptr has a constructor that takes std::auto_ptr. So you don't even need to call release() in this case: std::shared_ptr r (root (...)); Boris From ivan.lelann at free.fr Tue Jun 14 04:43:32 2011 From: ivan.lelann at free.fr (Ivan Le Lann) Date: Tue Jun 14 04:43:41 2011 Subject: [xsd-users] Differencies between xsd and xsde In-Reply-To: <1360762097.802791308040963566.JavaMail.root@zimbra36-e6.priv.proxad.net> Message-ID: <390757524.802951308041012011.JavaMail.root@zimbra36-e6.priv.proxad.net> ----- "Klaim - Jo?l Lamotte" a ?crit : > Hi, > > I've been using xsd for some time but I've just discovered xsde. > > There is no comparison page but from what I understand from reading > the docs > so far: > > 1. it targets embedded softwares > 2. you have more control on what C++ features/costs exactly will be > used in > the generated cost > 3. it have no dependencies (not even xerces, can even work without > using > STL) > > Can you confirm 3. ? > If it's correct, it might be more interesting for me than using xsd. > > Are there other differences? > Maybe in the kind of interfaces generated? > xsd generate STL-like code, I find it useful. If using RTTI and STL > makes me > keep this kind of interface, I'll be happy with it. The code is very similar, but still you cannot switch from xsd to xsde without changing your code in some places: no more auto_ptr and optional. To be able to switch between xsd and xsde, I had to write few simple macros: XSD_DETACH, XSD_OPTIONAL_PRESENT, XSD_OPTIONAL_MAKE_PRESENT, etc. Nothing difficult, but not exactly pretty. Also a few one-line functions to deal with raw pointer/auto_ptr differences ("create", "move_ptr") and a "eval" for transparent xsd::optional handling. By the way, I wonder if xsde should not return pointers for optional members. That would be more similar to xsd's optional. > > Last question : I don't find a way to specify something else than > auto_ptr > as smart-pointer type for root objects. > Is there a way? I'd like to use std::unique_ptr (I'm using recent > compilers) > or std::shared_ptr. If you're talking about XSD/e Hybrid, I have written a patch that allow you to specify the type of pointer used for any type by template specialization. This is poorly tested (ie. only by me), not really used, and highly unlikely to be merged in XSD/e. Anyway: http://bitbucket.org/liukahr/xsde Ivan From mjklaim at gmail.com Tue Jun 14 07:39:40 2011 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Tue Jun 14 07:39:48 2011 Subject: [xsd-users] Differencies between xsd and xsde In-Reply-To: References: Message-ID: Thank you for your 2011/6/14 Boris Kolpackov > > > Are there other differences? > > Compared to XSD, XSD/e is more light-weight but also not as powerful as > XSD. Some of the more advanced/convenience features found XSD are not > available in XSD/e. > > I've tried to naively convert my current xsd use to xsde and now I see wich features I use that xsde don't provide. The main problem I have with xsd is that I'm having trouble organising CMake, xsd and Xerces to work together as the xsd CMake files don't seem to be enough to make sure Xerces is available on Windows. It's another problem anyway. > > > Maybe in the kind of interfaces generated? > > C++/Hybrid in XSD/e is similar but not the same as C++/Tree in XSD. > > I've just looked at the generated code. Obviously it's far easier to read for people not used to STL/Boost libs interfaces. That's really an excellent idea to provide xsd AND xsde, fills all the needs I guess. > > > Last question : I don't find a way to specify something else than > auto_ptr > > as smart-pointer type for root objects. > > Is there a way? I'd like to use std::unique_ptr (I'm using recent > compilers) > > or std::shared_ptr. > > This is a question about XSD, not XSD/e, right? XSD/e does not use > auto_ptr. > > Oh ok, that's not what I understood. I've seen some references to smart pointer somewhere in the docs, but I might have mixed up. > There is no way to change that in XSD but you can always "strip off" > auto_ptr with the release function. Let's say root() is the parsing > function. Then you can write: > > std::unique_ptr r (root (...).release ()); > > Also, std::shared_ptr has a constructor that takes std::auto_ptr. So > you don't even need to call release() in this case: > > std::shared_ptr r (root (...)); > Ok that's what I use at the moment, I just thought you would provide a way to specify a poitner type replacement. But I see Ivan's mail with a patch so I guess it's a wanted feature. Thank you, you've been really helpful :) Jo?l Lamotte From mjklaim at gmail.com Tue Jun 14 07:46:22 2011 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Tue Jun 14 07:46:30 2011 Subject: [xsd-users] Differencies between xsd and xsde In-Reply-To: <390757524.802951308041012011.JavaMail.root@zimbra36-e6.priv.proxad.net> References: <1360762097.802791308040963566.JavaMail.root@zimbra36-e6.priv.proxad.net> <390757524.802951308041012011.JavaMail.root@zimbra36-e6.priv.proxad.net> Message-ID: 2011/6/14 Ivan Le Lann > > The code is very similar, but still you cannot switch from xsd to xsde > without changing your code in some places: no more auto_ptr and > optional. > To be able to switch between xsd and xsde, I had to write few simple > macros: > XSD_DETACH, XSD_OPTIONAL_PRESENT, XSD_OPTIONAL_MAKE_PRESENT, etc. > Nothing difficult, but not exactly pretty. > That's interesting! > > Also a few one-line functions to deal with raw pointer/auto_ptr differences > ("create", "move_ptr") and a "eval" for transparent xsd::optional handling. > > By the way, I wonder if xsde should not return pointers for optional > members. > That would be more similar to xsd's optional. > I agree. > > > > > Last question : I don't find a way to specify something else than > > auto_ptr > > as smart-pointer type for root objects. > > Is there a way? I'd like to use std::unique_ptr (I'm using recent > > compilers) > > or std::shared_ptr. > > If you're talking about XSD/e Hybrid, I have written a patch that allow you > to > specify the type of pointer used for any type by template specialization. > This is poorly tested (ie. only by me), not really used, and highly > unlikely > to be merged in XSD/e. Anyway: http://bitbucket.org/liukahr/xsde > > Thanks Ivan, that's really helpful! I'll not use xsde in the end but it's a patch that I'd like to see in xsd too. So there ARE smart pointers generated in some cases in xsd/e, right? Jo?l Lamotte From Vladimir.Michl at barclayscapital.com Wed Jun 15 13:54:21 2011 From: Vladimir.Michl at barclayscapital.com (Vladimir.Michl@barclayscapital.com) Date: Thu Jun 16 02:47:53 2011 Subject: [xsd-users] Hybrid between XSD and XSD/e - parsing serialisation approach from XSD/e, but feature set and interface of XSD Message-ID: Hello, I am looking at XSD and XSD/e and I really like the way how both are written and the generated code, unfortunately the code is too slow when parsing or serialising. I have compared XSD with XSD/e and XSD/e slightly more then twice as quick when parsing and about 3 times faster during serialisation. I have already done all the tips for XSD speedup from WIKI pages (Xerces initialisation, etc.). What makes XSD slow is that transformation to DOM and then to C++ objects. XSD/e on the other side does not have all the features I would require. Is there any way to pick best of both from XSD and XSD/e? E.g. The parsing/serialisation approach from XSD/e, but feature set and interface from XSD? And both the way that I do not need to write any glue in between them? Regards Vladimir _______________________________________________ This e-mail may contain information that is confidential, privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means. Please delete it and any attachments and notify the sender that you have received it in error. Unless specifically indicated, this e-mail is not an offer to buy or sell or a solicitation to buy or sell any securities, investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Barclays. Any views or opinions presented are solely those of the author and do not necessarily represent those of Barclays. This e-mail is subject to terms available at the following link: www.barcap.com/emaildisclaimer. By messaging with Barclays you consent to the foregoing. Barclays Capital is the investment banking division of Barclays Bank PLC, a company registered in England (number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP. This email may relate to or be sent from other members of the Barclays Group. _______________________________________________ From boris at codesynthesis.com Thu Jun 16 05:17:44 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 16 03:01:05 2011 Subject: [xsd-users] Hybrid between XSD and XSD/e - parsing serialisation approach from XSD/e, but feature set and interface of XSD In-Reply-To: References: Message-ID: Hi Vladimir, Vladimir.Michl@barclayscapital.com writes: > What makes XSD slow is that transformation to DOM and then to C++ objects. > XSD/e on the other side does not have all the features I would require. > > Is there any way to pick best of both from XSD and XSD/e? E.g. The > parsing/serialisation approach from XSD/e, but feature set and > interface from XSD? No, unfortunately there is no easy way combine the two. C++/Hybrid in XSD/e is pretty similar conceptually to C++/Tree in XSD, especially if C++ exceptions and STL are enabled in XSD/e. What are the specific features of XSD that are missing in XSD/e and that you need? Also, you may want to consider using the binary representation of the object model. For example, you can use it internally in your application and export to XML only if/when needed for compatibility with third party systems. Another alternative would be to have a "fat" format where both the binary and XML representations are present. Binary parsing/serialization is about an order of magnitude faster than XML parsing/serialization. For more information see section 5.2, "Binary Serialization" in the C++/Tree Mapping User Manual: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#5.2 Boris From Vladimir.Michl at barclayscapital.com Thu Jun 16 04:58:26 2011 From: Vladimir.Michl at barclayscapital.com (Vladimir.Michl@barclayscapital.com) Date: Thu Jun 16 07:04:22 2011 Subject: [xsd-users] Hybrid between XSD and XSD/e - parsing serialisation approach from XSD/e, but feature set and interface of XSD In-Reply-To: References: Message-ID: Hi Boris, Thank you for your suggestions. At the moment there is need to use XML as format, but get it as quick as possible. Following features are missing for me from XSD/e: - when validation is switched off, there is really not validation at all. XSDe provides at least some so invalid objects are not constructed. This is mainly about extensibility, being able to add new fields without need to recompile all receivers. - any and anyAttribute are ignored - IDREF no static typing available. - optional attributes should be returned as optional type rather then need to ask using XXX_present function. - function naming - would have preferred to have java naming available. Regards Vladimir -- Vladimir Michl Global Technology - FX Cash (BARX, DEVON) Barclays Capital, 5 The South Colonnade, E14 4BB Tel: +44 20313 46373 -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: 16 June 2011 10:18 To: Michl, Vladimir: IT (LDN) Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] Hybrid between XSD and XSD/e - parsing serialisation approach from XSD/e, but feature set and interface of XSD Hi Vladimir, Vladimir.Michl@barclayscapital.com writes: > What makes XSD slow is that transformation to DOM and then to C++ objects. > XSD/e on the other side does not have all the features I would require. > > Is there any way to pick best of both from XSD and XSD/e? E.g. The > parsing/serialisation approach from XSD/e, but feature set and > interface from XSD? No, unfortunately there is no easy way combine the two. C++/Hybrid in XSD/e is pretty similar conceptually to C++/Tree in XSD, especially if C++ exceptions and STL are enabled in XSD/e. What are the specific features of XSD that are missing in XSD/e and that you need? Also, you may want to consider using the binary representation of the object model. For example, you can use it internally in your application and export to XML only if/when needed for compatibility with third party systems. Another alternative would be to have a "fat" format where both the binary and XML representations are present. Binary parsing/serialization is about an order of magnitude faster than XML parsing/serialization. For more information see section 5.2, "Binary Serialization" in the C++/Tree Mapping User Manual: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#5.2 Boris _______________________________________________ This e-mail may contain information that is confidential, privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means. Please delete it and any attachments and notify the sender that you have received it in error. Unless specifically indicated, this e-mail is not an offer to buy or sell or a solicitation to buy or sell any securities, investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Barclays. Any views or opinions presented are solely those of the author and do not necessarily represent those of Barclays. This e-mail is subject to terms available at the following link: www.barcap.com/emaildisclaimer. By messaging with Barclays you consent to the foregoing. Barclays Capital is the investment banking division of Barclays Bank PLC, a company registered in England (number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP. This email may relate to or be sent from other members of the Barclays Group. _______________________________________________ From boris at codesynthesis.com Thu Jun 16 09:37:22 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 16 07:20:42 2011 Subject: [xsd-users] Hybrid between XSD and XSD/e - parsing serialisation approach from XSD/e, but feature set and interface of XSD In-Reply-To: References: Message-ID: Hi Vladimir, Vladimir.Michl@barclayscapital.com writes: > Following features are missing for me from XSD/e: > - when validation is switched off, there is really not validation at all. > XSDe provides at least some so invalid objects are not constructed. This > is mainly about extensibility, being able to add new fields without need > to recompile all receivers. XSD/e actually provides explicit support for schema evolution. See the examples in the examples/cxx/hybrid/evolution/ directory in the XSD/e distribution. > - any and anyAttribute are ignored You can handle wildcard content using object model, parser, and serializer customization. See the 'wildcard' and 'custom/wildcard' examples for details. With some effort, you can even store the content in a DOM-like format (see the xml.* files in the evolution/ directory mentioned above. > - IDREF no static typing available. > - optional attributes should be returned as optional type rather then need > to ask using XXX_present function. > - function naming - would have preferred to have java naming available. Agree about these three. Though they are more of inconveniences rather than missing functionality. Boris From draymon6 at csc.com.au Thu Jun 16 20:01:06 2011 From: draymon6 at csc.com.au (David Raymond) Date: Fri Jun 17 03:05:03 2011 Subject: [xsd-users] ld: 0711-317 ERROR: Undefined symbol: xsd::cxx::parser::xerces::flags::no_multiple_imports Message-ID: I get a few undefined symbol errors when trying to compile examples. Platform is AIX 5.3 xlC compiler version 6.0 Make command is: makeit CXX=/usr/vacpp/bin/xlC_r CPPFLAGS="-I/sms/xsd-3.3.0-powerpc-aix/libxsd -I/sms/xerces-c-3.1.1/src" LDFLAGS="-L/sms/xerces-c-3.1.1/src/.libs" Falls over on the first example - cxx/parser/generated errors: ld: 0711-317 ERROR: Undefined symbol: xsd::cxx::ro_string::npos ld: 0711-317 ERROR: Undefined symbol: xsd::cxx::parser::xerces::flags::dont_initialize ld: 0711-317 ERROR: Undefined symbol: xsd::cxx::parser::xerces::flags::dont_validate ld: 0711-317 ERROR: Undefined symbol: xsd::cxx::parser::xerces::flags::no_multiple_imports From boris at codesynthesis.com Fri Jun 17 14:47:46 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 17 12:31:05 2011 Subject: [xsd-users] ld: 0711-317 ERROR: Undefined symbol: xsd::cxx::parser::xerces::flags::no_multiple_imports In-Reply-To: References: Message-ID: Hi David, David Raymond writes: > I get a few undefined symbol errors when trying to compile examples. > > Platform is AIX 5.3 > > xlC compiler version 6.0 The earliest version of XL C++ compiler that we support is 7.0[1]. 6.0 is missing too many standard C++ features that XSD relies on (you've hit the lack of support for class template static data members but I am sure there will be others). If you cannot upgrade, you may want to consider XSD/e[2] instead. It was designed to work with legacy C++ compilers. [1] http://www.codesynthesis.com/products/xsd/platforms.xhtml [2] http://www.codesynthesis.com/products/xsde/ Boris From mjklaim at gmail.com Sun Jun 19 04:54:10 2011 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Sun Jun 19 04:54:18 2011 Subject: [xsd-users] License and Portability Message-ID: Hi, I'm working on a cross-platform (win/mac/nix) tool project and I have two questions: 1. The xsd license is GPL even for generated code, right? As my project's license is MIT and I wish companies to build over my code, using xsd to generate code forces me and other companies using or selling my tool to provide the source code or to have a commercial license with your company? Am I correct? 2. The CMake files in the wiki don't look like they are portable - but I'm not a CMake specialist. Is there a more general portable xsd CMake file that you might know? Jo?l Lamotte From bschindler at inf.ethz.ch Sun Jun 19 05:00:44 2011 From: bschindler at inf.ethz.ch (Benjamin Schindler) Date: Sun Jun 19 05:01:53 2011 Subject: [xsd-users] License and Portability In-Reply-To: References: Message-ID: <4DFDBABC.9040605@inf.ethz.ch> Hi I'm not a legal expert, so I cannot answer the first. But for the second question - I use my script on linux and windows but not on the mac. Cheers Benjamin On 19.06.2011 10:54, Klaim - Jo?l Lamotte wrote: > Hi, > > I'm working on a cross-platform (win/mac/nix) tool project and I have two > questions: > > 1. The xsd license is GPL even for generated code, right? > As my project's license is MIT and I wish companies to build over my code, > using xsd to generate code forces me and other companies using or selling my > tool > to provide the source code or to have a commercial license with your > company? > Am I correct? > > 2. The CMake files in the wiki don't look like they are portable - but I'm > not a CMake specialist. > Is there a more general portable xsd CMake file that you might know? > > > Jo?l Lamotte From mjklaim at gmail.com Sun Jun 19 05:07:32 2011 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Sun Jun 19 05:07:38 2011 Subject: [xsd-users] License and Portability In-Reply-To: <4DFDBABC.9040605@inf.ethz.ch> References: <4DFDBABC.9040605@inf.ethz.ch> Message-ID: 2011/6/19 Benjamin Schindler > I'm not a legal expert, so I cannot answer the first. But for the second > question - I use my script on linux and windows but not on the mac. > > Hi, I'm pleased to see the author of this one script here because I'm really not a CMake expert and as your script lacks comments I'm lost in some parts. What I can't find in your script is how do you use it to link with Xerces? I think I'm missing something... Jo?l Lamotte From bschindler at inf.ethz.ch Sun Jun 19 05:15:18 2011 From: bschindler at inf.ethz.ch (Benjamin Schindler) Date: Sun Jun 19 05:16:27 2011 Subject: [xsd-users] License and Portability In-Reply-To: References: <4DFDBABC.9040605@inf.ethz.ch> Message-ID: <4DFDBE26.2000801@inf.ethz.ch> Hi Okay, I'm not claiming everything is production ready, but this is how we use it: In case of windows, you can link against the libs pointed at in XSD_LIBRARIES. In case of linux, this variable stays empty because distributions often ship a version of xerces as part of the system install. Since this is the recommended way of linking on linux, I use a separate find script (attached) to find xerces on linux. Ideally, I would break these two into separate parts (using xsd and linking against xerces), but on windows, this is not really possible as there is no system xerces-c... I hope it helps Cheers Benjamin On 19.06.2011 11:07, Klaim - Jo?l Lamotte wrote: > > > 2011/6/19 Benjamin Schindler > > > I'm not a legal expert, so I cannot answer the first. But for the > second question - I use my script on linux and windows but not on > the mac. > > > Hi, > > I'm pleased to see the author of this one script here because I'm > really not a CMake expert and as your script lacks comments I'm lost > in some parts. > > What I can't find in your script is how do you use it to link with > Xerces? > > I think I'm missing something... > > Jo?l Lamotte -------------- next part -------------- # - Find Xerces-C # Find the Xerces-C includes and library # # XERCESC_INCLUDE_DIR - Where to find xercesc include sub-directory. # XERCESC_LIBRARIES - List of libraries when using Xerces-C. # XERCESC_FOUND - True if Xerces-C found. FIND_PATH(XERCESC_INCLUDE_DIR xercesc/util/XercesVersion.hpp) SET(XERCESC_NAMES ${XERCESC_NAMES} xerces-c xerces-c_2) FIND_LIBRARY(XERCESC_LIBRARY NAMES ${XERCESC_NAMES}) # Handle the QUIETLY and REQUIRED arguments and set XERCESC_FOUND to # TRUE if all listed variables are TRUE. INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS( XERCESC DEFAULT_MSG XERCESC_LIBRARY XERCESC_INCLUDE_DIR ) IF(XERCESC_FOUND) SET(XERCESC_LIBRARIES ${XERCESC_LIBRARY}) ENDIF(XERCESC_FOUND) MARK_AS_ADVANCED(XERCESC_LIBRARY XERCESC_INCLUDE_DIR) From mjklaim at gmail.com Sun Jun 19 05:21:10 2011 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Sun Jun 19 05:21:24 2011 Subject: [xsd-users] License and Portability In-Reply-To: <4DFDBE26.2000801@inf.ethz.ch> References: <4DFDBABC.9040605@inf.ethz.ch> <4DFDBE26.2000801@inf.ethz.ch> Message-ID: 2011/6/19 Benjamin Schindler > ** > > I hope it helps > Thanks! I have to go now so I'll try that later but now I understand better why I found this script to be strange! I'm a linux noob too... From boris at codesynthesis.com Sun Jun 19 12:21:28 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Jun 19 10:04:43 2011 Subject: [xsd-users] License and Portability In-Reply-To: References: Message-ID: Hi Jo?l, Klaim - Jo?l Lamotte writes: > 1. The xsd license is GPL even for generated code, right? > As my project's license is MIT and I wish companies to build over my code, > using xsd to generate code forces me and other companies using or selling my > tool to provide the source code or to have a commercial license with your > company? Am I correct? In addition to the GPL we also have the Free/Libre and Open Source Software (FLOSS) exception which, provided you actually build something useful on top of the generated code, allows you to effectively re-license the generated code under other open-source licenses, including MIT. For more information see the FLOSSE text which has a nice "Intent" section including more detail on situations where it can and cannot be used: http://www.codesynthesis.com/projects/xsd/FLOSSE > 2. The CMake files in the wiki don't look like they are portable - but I'm > not a CMake specialist. Is there a more general portable xsd CMake file > that you might know? I assume Benjamin answered this for your (thanks, Benjamin!) Boris From mjklaim at gmail.com Sun Jun 19 10:53:28 2011 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Sun Jun 19 10:53:36 2011 Subject: [xsd-users] License and Portability In-Reply-To: References: Message-ID: Hi Boris, 2011/6/19 Boris Kolpackov > > In addition to the GPL we also have the Free/Libre and Open Source Software > (FLOSS) exception which, provided you actually build something useful on > top > of the generated code, allows you to effectively re-license the generated > code > under other open-source licenses, including MIT. For more information see > the > FLOSSE text which has a nice "Intent" section including more detail on > situations where it can and cannot be used: > > http://www.codesynthesis.com/projects/xsd/FLOSSE Yes, I've read it after my first mail and now I'm just not sure if I'm in case a) or b). I'll describe in details my current way of using xsd : In my project (under MIT) I have several parts currently : - aosl : an xsd file (everything depends on it) - aoslcpp : a C++ (dynamic) library providing the XML parsing, model (all generated by xsd) and data requests (functions I'm adding) - aosdesigner : a C++/Qt application (executable) using aoslcpp and providing a graphic edition tool What I need is : 1. to be able to provide all the sources for free - OK 2. to allow anyone to take any part of my project to make : a) a variant of the edition tool (aosdesigner) b) an additional tool that would use aoslcpp 3. I need 2 to be allowed for some companies wishing to derive my work for their own need and be able to sell it. >From what I understand that you're saying, all that is allowed, right? Because, when I read the FLOSSE document, I'm not sure if 3 is allowed or if it requires me that I change the organisation of the project? 2.a. Is required because what I'm building is a mountage tool that generate an abstract description of something and I need anyone to be able to build a "player" from it. Or even to "generate" an executable from the edited xml files. So using aoslcpp(that is mainly code generated via xsd) as library to build such generator or player will help greatly implementations. So, in this specific case, am I allowed to continue like this or should I make aoslcpp a static library or something? I'm a bit lost now... Jo?l Lamotte From boris at codesynthesis.com Sun Jun 19 13:37:45 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Jun 19 11:21:02 2011 Subject: [xsd-users] License and Portability In-Reply-To: References: Message-ID: Hi Jo?l, Klaim - Jo?l Lamotte writes: > - aoslcpp : a C++ (dynamic) library providing the XML parsing, model (all > generated by xsd) and data requests (functions I'm adding) This part is tricky. From your description it sounds like this library can be used by itself without the aosdesigner application. If that's the case the question is how much and what kind of functionality you add (the data requests part). Will the users of this library be using the generated code directly or will they use it through the functions that you are adding? If the functionality you are adding is not substantial and the primary purpose of aoslcpp is to provide XML access (via XSD-generated code) then the FLOSSE probably won't apply. Boris From mjklaim at gmail.com Sun Jun 19 11:55:34 2011 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Sun Jun 19 11:55:41 2011 Subject: [xsd-users] License and Portability In-Reply-To: References: Message-ID: 2011/6/19 Boris Kolpackov > Hi Jo?l, > > Klaim - Jo?l Lamotte writes: > > > - aoslcpp : a C++ (dynamic) library providing the XML parsing, model > (all > > generated by xsd) and data requests (functions I'm adding) > > This part is tricky. From your description it sounds like this library > can be used by itself without the aosdesigner application. If that's > the case the question is how much and what kind of functionality you > add (the data requests part). Will the users of this library be using > the generated code directly or will they use it through the functions > that you are adding? If the functionality you are adding is not > substantial and the primary purpose of aoslcpp is to provide XML > access (via XSD-generated code) then the FLOSSE probably won't apply. > > Boris > Well, I need to add several (tons of!) functions that will work like xqueries or xpath requests or whatever (because there is no xpath/xquery implementation at the moment, right? I've followed leesa library but it don't seem to be finished yat), to gathers specific data. The first main use is to build the "views" in aosdesigner of the data in the xml. I also need to provide the model to be able to build extensions (the generators/exporters) to aosdesigner and players (separate, but most of them will certainly not be in C++ anyway). So, both additional functions/structures (from me) and the model/parsing/serialization (from xsd) are necessary for all projects using aoslcpp. The model alone is only partially useful. I want to have it in C++ only for allowing other tools to be built without Qt dependency. In added quantity, I can't be precise now as I didn't linked aosdesigner and and aoslcpp yet (because of CMake usage hell). I'm mainly working on the GUI side at the moment but I'm getting to the parts where I need the data to insert in the views. What I can say is that in aosdesigner I'm building at least 10 "views" (visually) of different aspects of the xml data, most of them requiring at least 2 different read-only "queries". The modifications of aosl data will be both by: 1. manipulating the model where micro-changes have to be made (like changing the name property of an object, or changing graphic position of graphic objects) 2. using a modification request for more general changes or in cases where the modification should imply a specific logic (like when you move a node in a scene-partition in graphics, you have to make sure the node didn't got out of it's partition and if it did you have to unlist it from it and add it in it's new space partition) One basic example of 2. is that I have graphic (and non-graphic) objects that are organized in hierarchy, so if I translate one object I need to make sure all the sub-objects are translated too. That can't be done without a little loop in an algorithm so it'll be one of those modifying "requests". I'll use serialization/parsing for saving/loading files. I don't have a generator implementation but the idea is to analyse the model to generate "something" : a stand-alone player or a converted format that can be read by a specific player implementation. An aosl player will directly read the aosl file, so that requires the model if it's in C++ (but as said, most players will not be C++ anyway). Both will use the query functions and certainly will require additional specific queries (for analysing) so that's why I need to expose the model too. So I'm not sure if it's enough added value? Did I provide enough informations or should I be more specific on some points? What if I make sure any interesting read-only or writing query is implemented in aoslcpp? Jo?l Lamotte From mjklaim at gmail.com Sun Jun 19 12:00:59 2011 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Sun Jun 19 12:01:07 2011 Subject: [xsd-users] License and Portability In-Reply-To: References: Message-ID: 2011/6/19 Klaim - Jo?l Lamotte > What I can say is that in aosdesigner I'm building at least 10 "views" > (visually) of different aspects of the xml data, most of them requiring at > least 2 different read-only "queries". Just to be precise : this part isn't exactly correct. Most of the views will show data interpreted from the xmls but lots of them will show data that are derived from those initial data are very different. It's exactly the same difference between code and executed code, if you see what I mean? AOSL is a declaration but once executed, the interpreter will have a state that is not predictable by a computer without running it. To be short: AOSL is turing-complete (it seems) and aosdesigner needs to present different possible states of the same AOSL file "played" with different "branches". I'm not sure if I'm clear... Jo?l Lamotte. From mjklaim at gmail.com Sun Jun 19 12:04:23 2011 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Sun Jun 19 12:04:30 2011 Subject: [xsd-users] License and Portability In-Reply-To: References: Message-ID: I forgot to add something : the motivations I'm making this project MIT because I need to build aosdesigner as an "example" for some companies to build over (with or without reusing my code) because I'm trying to fix a problem in a specific domain that is really important to me (digital comics - google for "turbo media" if you're interested in the subject). So, I still need others to be able to do better than my product and provide variants and platform-specific exporters (html/javascript, flash, iOSapp, android app, etc.) without bothering about my tool's license. I'm not sure if that's important. Jo?l Lamotte From mjklaim at gmail.com Sun Jun 19 14:22:57 2011 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Sun Jun 19 14:23:04 2011 Subject: [xsd-users] License and Portability In-Reply-To: References: Message-ID: Sorry for the multiples mails, I just remembered one detail that my play a part in all this : I'm not actually delivering/publishing the code generated by xsd, only the script that allows you to generate it. I prefer this code to be generated depending on the .xsd version, instead of having histories of generated files in my repository. It makes developers requires to install the xsd compiler to be able to work on the projects. So currently in the aoslcpp sources folder I only have my specific code in the repository. You have to execute a python script to get the full code. Not sure if it changes something. Jo?l Lamotte From boris at codesynthesis.com Sun Jun 19 17:07:41 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Jun 19 14:50:58 2011 Subject: [xsd-users] License and Portability In-Reply-To: References: Message-ID: Hi Jo?l, It sounds like you will be adding quite a few transformation algorithms on top of the generated code so I believe you should be fine using the FLOSS exception. However, you will need to run the XSD compiler yourself and include the generated code into the library (probably along with the libxsd headers). If users of your library compile the schemas themselves then they will be getting the generated code under the GPL. Regarding XPath, currently you can run XPath on the object model using the DOM association feature (see the 'xpath' example for details). The major limitation of this approach is that it only works on unmodified object models. For the next release of XSD we are considering adding native XPath execution that will remove this limitation. Boris From mjklaim at gmail.com Sun Jun 19 15:13:54 2011 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Sun Jun 19 15:14:01 2011 Subject: [xsd-users] License and Portability In-Reply-To: References: Message-ID: 2011/6/19 Boris Kolpackov > Hi Jo?l, > > It sounds like you will be adding quite a few transformation > algorithms on top of the generated code so I believe you should > be fine using the FLOSS exception. However, you will need to > run the XSD compiler yourself and include the generated code > into the library (probably along with the libxsd headers). If > users of your library compile the schemas themselves then > they will be getting the generated code under the GPL. > So it's an important point... I'll simply put the generated code into the repository and only change it for major xsd revisions I guess. Thanks for telling me, it's really helpful. :) > > Regarding XPath, currently you can run XPath on the object model > using the DOM association feature (see the 'xpath' example for > details). The major limitation of this approach is that it only > works on unmodified object models. For the next release of XSD > we are considering adding native XPath execution that will remove > this limitation. > > I obviously missed that part... As I need to be able to modify the model, I guess I'll consider replacing some of my requests with XPath queries once this new version is released. Thank you very much for those informations! Jo?l Lamotte From mjklaim at gmail.com Tue Jun 28 08:07:20 2011 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Tue Jun 28 08:07:29 2011 Subject: [xsd-users] Shared library and exported symbols problem Message-ID: Hi, my project using xsd is still work in progress but the code is available there : http://code.google.com/p/art-of-sequence/ I'm having trouble linking my Qt based executable, aosdesigner, to my partially xsd generated shared library, aoslcpp. I can link a simple console test application to the dll (on windows, using VS2010+SP1). But trying to link that dll to aosdesigner generates linking errors about multiple symbols: 2>aoslcpp.lib(aoslcpp.dll) : error LNK2005: "public: __thiscall std::basic_string,class std::allocator >::~basic_string,class std::allocator >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in Context.obj 2>aoslcpp.lib(aoslcpp.dll) : error LNK2005: "public: __thiscall std::basic_string,class std::allocator >::basic_string,class std::allocator >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in Project.obj 2>E:\Projects\Art_Of_Sequence\public\aos_default\Build\Debug\aosdesigner.exe : fatal error LNK1169: one or more multiply defined symbols found At the moment, my way of exporting the symbols is the following : 1. you can read in the xsd code generation configuration file : http://code.google.com/p/art-of-sequence/source/browse/tools/aoslcpp/script/generate_cpp.cfg that I set : # The export/import symbol to use --export-symbol AOSLCPP_API and # Include common compilation config header --hxx-prologue-file generated_header_prologue.txt --cxx-prologue-file generated_source_prologue.txt 2. in this prologue file I include aoslcpp/common.h : http://code.google.com/p/art-of-sequence/source/browse/tools/aoslcpp/script/generated_header_prologue.txt 3. in the header you can read : http://code.google.com/p/art-of-sequence/source/browse/tools/aoslcpp/include/aoslcpp/common.h I define AOSLCPP_API to be dllexport or dllimport depending on AOSLCPP_SOURCE is defined or not. 4. in the cpp prologue file I defined AOSLCPP_SOURCE. That way the generated code doess export the generated code symbols. So now I'm not sure where to look for the problem, that's why I expose it here. It seems that std::string is exported while it shouldn't be. My first assumption is that : maybe it's not a good idea to generate inline functions in case of shared library? Or maybe there is something I don't know about the generated code or options? Any suggestion is welcome, I'm a bit lost by this one because I can't find exactly where std::string is used in the generated code. Jo?l Lamotte From boris at codesynthesis.com Tue Jun 28 10:48:13 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jun 28 10:50:54 2011 Subject: [xsd-users] Shared library and exported symbols problem In-Reply-To: References: Message-ID: Hi Jo?l, Klaim - Jo?l Lamotte writes: > It seems that std::string is exported while it shouldn't be. In a nutshell, VC++ automatically exports base classes if the derived class is exported. Some built-in and generated types may derive, directly or indirectly, from std::string which can cause this problem. The thread that starts from this post discuses this issue in detail: http://www.codesynthesis.com/pipermail/xsd-users/2010-September/003010.html This post provides the instructions for how to resolve it: http://www.codesynthesis.com/pipermail/xsd-users/2010-September/003011.html Boris From bo-ba at mail.ru Tue Jun 28 11:52:45 2011 From: bo-ba at mail.ru (Bo Ba) Date: Tue Jun 28 11:52:53 2011 Subject: [xsd-users] setting xsd code generation with xcode In-Reply-To: References: Message-ID: Hello, Is there a description for xsd code generation in XCODE? Similar to this: http://wiki.codesynthesis.com/Using_XSD_with_Eclipse_CDT Thanks. --8 From Abdul_G_Khan-NR at raytheon.com Tue Jun 28 18:49:47 2011 From: Abdul_G_Khan-NR at raytheon.com (Abdul G Khan) Date: Tue Jun 28 18:50:05 2011 Subject: [xsd-users] base type not found Message-ID: Hello, I am having an issue trying to generate code using the following sequence of commands: curl http://newsroom.gsfc.nasa.gov/esi/schemas/SSWAgentResponse.xsd > SSWAgentResponse.xsd curl http://newsroom.gsfc.nasa.gov/esi/schemas/ESIAgentResponse.xsd > ESIAgentResponse.xsd curl http://newsroom.gsfc.nasa.gov/esi/schemas/ESIAgentResponseInternal.xsd > ESIAgentResponseInternal.xsd xsd cxx-tree --location-map http://newsroom.gsfc.nasa.gov/esi/schemas/SSWAgentResponse.xsd=SSWAgentResponse.xsd --location-map http://newsroom.gsfc.nasa.gov/esi/schemas/ESIAgentResponse.xsd=ESIAgentResponse.xsd ESIAgentResponseInternal.xsd ESIAgentResponse.xsd:39:48: error: base type 'agentResponse' not found ESIAgentResponse.xsd:75:44: error: base type 'Exception' not found Some things that may be causing this issue: 1, ESIAgentResponseInternal imports ESIAgentResponse which imports SSWAgentResponse (three levels of imports) 2. SSWAgentResponse does not have a namespace (agentResponse and Exception are defined in SSWAgentResponse) The schemas successfully generate Java code using JAXB's xjc. xsd works when generating the SSWAgentResponse and the ESIAgentResponse schemas with the following warning: xsd cxx-tree SSWAgentResponse.xsd SSWAgentResponse.xsd: warning T004: generating parsing functions for 2 global elements SSWAgentResponse.xsd: info: use --root-element-* options to specify document root(s) I would really appreciate any ideas that may help me get rid of the above errors. Thanks, Abdul From mjklaim at gmail.com Tue Jun 28 19:12:12 2011 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Tue Jun 28 19:12:22 2011 Subject: [xsd-users] Shared library and exported symbols problem In-Reply-To: References: Message-ID: I just figured I answered privately instead of to the public list, fixing that 2011/6/28 Boris Kolpackov > Hi Jo?l, > > Klaim - Jo?l Lamotte writes: > > > It seems that std::string is exported while it shouldn't be. > > In a nutshell, VC++ automatically exports base classes if the derived > class is exported. Some built-in and generated types may derive, > directly or indirectly, from std::string which can cause this problem. > > The thread that starts from this post discuses this issue in detail: > > http://www.codesynthesis.com/pipermail/xsd-users/2010-September/003010.html > > This post provides the instructions for how to resolve it: > > http://www.codesynthesis.com/pipermail/xsd-users/2010-September/003011.html > > Boris > Thanks Boris, that explains the problem. Now, I'm not sure I've understood all the solutions but in a nutshell I have almost the right configuration to make it work : # We need to add export/import symbols to make it a dll --export-xml-schema # The export/import symbol to use --export-symbol AOSLCPP_API So it seems that now I just need to include xml-schema.hxx in all my cpp files. Did I understood correctly? (Sorry I can't check yet, I'm not home yet.) Jo?l Lamotte -------------------------------- 2011/6/28 Klaim - Jo?l Lamotte > So it seems that now I just need to include xml-schema.hxx in all my cpp > files. Did I understood correctly? > > I tried to include xsd/cxx/parser/xml-schema.hxx in all generated cpp (in doubt) but it generates exactly the same link error. I also tried with all hpp but it fails too. I'll search more see if something in the configuration makes things wrong. Jo?l From boris at codesynthesis.com Wed Jun 29 08:45:48 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 29 08:48:28 2011 Subject: [xsd-users] setting xsd code generation with xcode In-Reply-To: References: Message-ID: Hi, Bo Ba writes: > Is there a description for xsd code generation in XCODE? > > Similar to this: > http://wiki.codesynthesis.com/Using_XSD_with_Eclipse_CDT Unfortunately not. If you are willing contribute one, then that would be great. Generally, it should be pretty easy to use XSD with any IDE if you don't need automatic schema compilation from within the IDE itself. In other words, if you compile your schemas separately (e.g., from the command line or via a script), then all you have to do is (1) add the generated code to your project, (2) add include directories for Xerces-C++ and libxsd, and (3) link to the Xerces-C++ library. If you also want schema compilation from the IDE, then things can be a bit more complicated. The idea here is to find the "custom build step" facility within the IDE (most IDEs have that and the common example that they give is how to set up the flexx/yacc compilation). If you can find that, then the rest is just a matter of adding a custom build step to invoke the XSD compiler to compile your schemas. Normally you would also specify the input/output files so that the IDE can keep track of when things get out of date (e.g., if the schema changes or the generated files get deleted) and run the custom build step again. Boris From boris at codesynthesis.com Wed Jun 29 12:52:12 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 29 12:54:54 2011 Subject: [xsd-users] base type not found In-Reply-To: References: Message-ID: Hi Abdul, Abdul G Khan writes: > ESIAgentResponse.xsd:39:48: error: base type 'agentResponse' not found > ESIAgentResponse.xsd:75:44: error: base type 'Exception' not found This was a bug in Xerces-C++. I've fixed it and with the fix I was able to compile your schemas without any other problems. I can build you an XSD binary with the fix (just let me know which platform you need) and provide a patch for the latest version of Xerces-C++. Thanks for reporting this. Boris From Abdul_G_Khan-NR at raytheon.com Wed Jun 29 13:01:47 2011 From: Abdul_G_Khan-NR at raytheon.com (Abdul G Khan) Date: Wed Jun 29 13:02:17 2011 Subject: [xsd-users] base type not found In-Reply-To: References: Message-ID: Hi Boris, Thanks for the quick response! I am using the xsd-3.3.0-x86_64-linux-gnu distribution. I would really appreciate you sending the new xsd binary, so I can integrate the generated source into my code. uname -a Linux d4cbl01 2.6.18-128.1.1.el5 #1 SMP Mon Jan 26 13:58:24 EST 2009 x86_64 x86_64 x86_64 GNU/Linux Abdul From: Boris Kolpackov To: Abdul G Khan Cc: xsd-users@codesynthesis.com Date: 06/29/2011 12:55 PM Subject: Re: [xsd-users] base type not found Hi Abdul, Abdul G Khan writes: > ESIAgentResponse.xsd:39:48: error: base type 'agentResponse' not found > ESIAgentResponse.xsd:75:44: error: base type 'Exception' not found This was a bug in Xerces-C++. I've fixed it and with the fix I was able to compile your schemas without any other problems. I can build you an XSD binary with the fix (just let me know which platform you need) and provide a patch for the latest version of Xerces-C++. Thanks for reporting this. Boris -------------- next part -------------- A non-text attachment was scrubbed... Name: graycol.gif Type: image/gif Size: 105 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20110629/974190e4/graycol.gif -------------- next part -------------- A non-text attachment was scrubbed... Name: ecblank.gif Type: image/gif Size: 45 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20110629/974190e4/ecblank.gif From cristiano_di_buduo at hotmail.com Wed Jun 29 12:37:16 2011 From: cristiano_di_buduo at hotmail.com (Cristiano Di Buduo) Date: Wed Jun 29 13:22:34 2011 Subject: [xsd-users] New user has trouble getting some of the data out of doxygen-generated xml. Message-ID: Hi, i recently started using xsd and am glad it's around. But i have two minor usage issues: One is that i have two .xsd files which need interface classes, but they both define the type "DoxygenType", which results in duplicate identifier errors in the generated code. I tried to put them into separate namespaces, but that caused a whole new bunch of problems. Is there a way to get around this? The second issue is that i cannot seem to access some of the data. Code example: ----- ----- ----- ----- ----- ----- ----- ----- auto_ptr b(doxygen("xml/main_8cpp.xml",xml_schema::flags::keep_dom)); for(DoxygenType::compounddef_const_iterator i = b->compounddef().begin(); i!= b->compounddef().end(); i++) { for(compounddefType::sectiondef_const_iterator j = i->sectiondef().begin(); j!=i->sectiondef().end(); j++) { cout<kind()<memberdef().begin(); k!= j->memberdef().end(); k++) { //cout<type()<argsstring()< References: Message-ID: Hi Abdul, The binary is available here: http://codesynthesis.com/~boris/tmp/xsd/xsd-4.0.0.a8-x86_64-linux-gnu.tar.bz2 You will also need to patch Xerces-C++ that you are linking to your application (unless you have validation disabled). The patch is in Xerces-C++ SVN but I also uploaded it here: http://codesynthesis.com/~boris/tmp/xerces-c-3.1.1-namespace-scope.patch Boris From boris at codesynthesis.com Wed Jun 29 13:36:05 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 29 13:38:43 2011 Subject: [xsd-users] New user has trouble getting some of the data out of doxygen-generated xml. In-Reply-To: References: Message-ID: Hi Cristiano, Cristiano Di Buduo writes: > One is that i have two .xsd files which need interface classes, but > they both define the type "DoxygenType", which results in duplicate > identifier errors in the generated code. I tried to put them into > separate namespaces, but that caused a whole new bunch of problems. Separate namespaces are the best solution. Simply add --namespace-map =schema1 when compiling the fist schema and --namespace-map =schema2 when compiling the second schema. There should be no problems, at least not in the generated code. > //cout<type()< //cout<argsstring()< > [...] > > You'll notice i passed keep_dom. I tried to get the value through _node. > The DOMNode's there, as i verified its node name to be correct, but > getting the node value returns null, even though there's a value in > the xml. The 'type' element above is of mixed content and 'argstring' is of anyType so there is no representation for them in the object model. You were on the correct path when you tried to use the underlying DOM. The value must be there (it is a DOMText node which is a child of DOMElement that you are getting). Check some of the examples that show how to get it (e.g., 'mixed'). Alternatively, you can fix the schema to assign some sane types to these element (e.g., string). Boris