From dv7777 at gmail.com Fri Apr 1 07:17:37 2011 From: dv7777 at gmail.com (dv) Date: Fri Apr 1 07:17:47 2011 Subject: [xsde-users] deb/rpm package? Message-ID: <4D95B451.6060603@gmail.com> Hello, is a .deb package of XSD/e planned for the future? It seems a bit odd that XSD has packages for the major Linux distributions while XSD/e has not. From boris at codesynthesis.com Fri Apr 1 10:06:05 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Apr 1 10:08:06 2011 Subject: [xsde-users] deb/rpm package? In-Reply-To: <4D95B451.6060603@gmail.com> References: <4D95B451.6060603@gmail.com> Message-ID: Hi, dv writes: > is a .deb package of XSD/e planned for the future? It seems a bit odd > that XSD has packages for the major Linux distributions while XSD/e has > not. There was an attempt to create a Debian package for XSD/e. The problem is that the runtime library configuration is very target-specific (some need STL, others don't, some need C++ exceptions, others don't, etc.). So it normally makes sense to get the source code for the runtime and build a custom configuration rather than get a pre-built package. But I guess for more general-purpose applications that use XSD/e a "max" configuration (i.e., everything enabled) could make sense. So If you would like to package XSD/e and upload it to the Debian repository, then that would definitely be welcome. Boris From dv7777 at gmail.com Mon Apr 4 07:24:37 2011 From: dv7777 at gmail.com (dv) Date: Mon Apr 4 07:24:47 2011 Subject: [xsde-users] problem with classes derived from long_base Message-ID: <4D99AA75.7030309@gmail.com> Hi, I looked at the autogenerated code, and classes that derive from long_base only have a copy constructor. They do not have assignment operators or constructors that accept long/long long. This means that I have to upcast to long_base to make use of these facilities. Am I missing something? Perhaps overlooked a command-line switch? regards From boris at codesynthesis.com Mon Apr 4 08:51:20 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 4 08:53:37 2011 Subject: [xsde-users] problem with classes derived from long_base In-Reply-To: <4D99AA75.7030309@gmail.com> References: <4D99AA75.7030309@gmail.com> Message-ID: Hi, dv writes: > I looked at the autogenerated code, and classes that derive from > long_base only have a copy constructor. They do not have assignment > operators or constructors that accept long/long long. This means that I > have to upcast to long_base to make use of these facilities. Am I > missing something? You can use the base_value() accessors/modifier. For example: MyLong l; // MyLong is derived from long_base l.base_value (123L); This is covered in Chapter, 5 "Mapping for Built-In XML Schema Types" in the C++/Hybrid Mapping Getting Started Guide: http://www.codesynthesis.com/projects/xsde/documentation/cxx/hybrid/guide/#5 Boris From dv7777 at gmail.com Mon Apr 4 09:17:33 2011 From: dv7777 at gmail.com (dv) Date: Mon Apr 4 09:17:42 2011 Subject: [xsde-users] base class for complextype classes? Message-ID: <4D99C4ED.5020309@gmail.com> Hello, XSD/e generates classes out of complextypes specified in the XML schema, just like in http://www.codesynthesis.com/projects/xsde/documentation/cxx/hybrid/guide/#2.1 . However, the generated class does not have a base class - in XSD, it does (xml_schema::type). This is bad, because I have been using xml_schema::type in some template specialization code: template < typename T > struct DataTraits < T , typename boost::enable_if < boost::is_base_of< typename ::xml_schema::type, T> >::type > { .... }; T would be one of the generated classes. This code does not work with code generated XSD/e code, since the classes have no common base. Is there a way to specify a base class for all complex types? I looked into the polymorphism options, but I am not sure they give me what I want. regards From boris at codesynthesis.com Tue Apr 5 09:18:09 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Apr 5 09:20:33 2011 Subject: [xsde-users] base class for complextype classes? In-Reply-To: <4D99C4ED.5020309@gmail.com> References: <4D99C4ED.5020309@gmail.com> Message-ID: Hi, dv writes: > However, the generated class does not have a base class - in XSD, it > does (xml_schema::type). This is bad We didn't introduce a common base class (which would probably need to define virtual functions to be useful) to avoid overhead. So while this is "bad" for you, it might not be "bad" for the majority of the XSD/e users. > Is there a way to specify a base class for all complex types? There are two ways that I can think of: 1. Introduce a common base type in the schema. 2. Customize every generated type to derive from a common base. You could probably use a wrapper class template to achieve this. See the --custom-type option and the relevant sections in the manual. > I looked into the polymorphism options, but I am not sure they give > me what I want. No, this won't help you. Boris From matthias.maschek at uma.at Wed Apr 6 11:27:48 2011 From: matthias.maschek at uma.at (Matthias Maschek) Date: Wed Apr 6 10:29:40 2011 Subject: [xsde-users] Regex for Class-renaming Message-ID: <1a4900e27aea1b68.4d9ca294@uma.at> Hi! I'm trying to generate my code and to rename all generated classes to start with uppercase. As i was searching through the documentation i only found that option for anonymous types. Any tipps how to achive it for all classes? My commandline at the moment: xsde cxx-hybrid --generate-parser --generate-aggregate --include-prefix XML/ --hxx-suffix .h --cxx-suffix .cpp --anonymous-regex '%.* .* (.+/)*(.+)%\u$2%' --anonymous-regex-trace myxsd.xsd And an example what i want: .... ->The generated class should be called Instance. Thanks, Matthias From boris at codesynthesis.com Wed Apr 6 14:13:17 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Apr 6 14:15:49 2011 Subject: [xsde-users] Regex for Class-renaming In-Reply-To: <1a4900e27aea1b68.4d9ca294@uma.at> References: <1a4900e27aea1b68.4d9ca294@uma.at> Message-ID: Hi Matthias, Matthias Maschek writes: > I'm trying to generate my code and to rename all generated classes > to start with uppercase. As i was searching through the documentation > i only found that option for anonymous types. Any tipps how to achive > it for all classes? For named types XSD/e does not perform any name transformations and uses the original name as is. So the only way to achieve this is to change the type names in the schema to start with a capital letter. Boris From Sebastian.Friebe at xfab.com Wed Apr 13 08:27:28 2011 From: Sebastian.Friebe at xfab.com (Sebastian Friebe) Date: Wed Apr 13 08:27:38 2011 Subject: [xsde-users] How to serialize just a single element of an schema Message-ID: <0LJL00HELBXUY930@mail.drs.xfab.de> Hi folks, I'm working the first time with xsde. I've got a huge XML schemata which I compiled successfully to C++ code. Creating an element tree in memory and serialization of the whole structure starting with the ROOT element is working fine. Besides this I want to serialize just single elements (complex) to a streambuf, but I don't know how to achieve this. Do you have any suggestions? Thanks in advance From ivan.lelann at free.fr Wed Apr 13 09:14:32 2011 From: ivan.lelann at free.fr (Ivan Le Lann) Date: Wed Apr 13 09:14:41 2011 Subject: [xsde-users] How to serialize just a single element of an schema In-Reply-To: <0LJL00HELBXUY930@mail.drs.xfab.de> Message-ID: <118140382.2197031302700472623.JavaMail.root@zimbra36-e6.priv.proxad.net> ----- "Sebastian Friebe" a ?crit : > > Creating an element tree in memory and serialization of the whole > structure starting with the ROOT element is working fine. > > Besides this I want to serialize just single elements (complex) to a > streambuf, but I don't know how to achieve this. > > > > Do you have any suggestions? > If I understand correctly what you're trying to do, you should use "--root-element my_non_root_element" command line option. Ivan From boris at codesynthesis.com Wed Apr 13 09:20:58 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Apr 13 09:24:13 2011 Subject: [xsde-users] How to serialize just a single element of an schema In-Reply-To: <118140382.2197031302700472623.JavaMail.root@zimbra36-e6.priv.proxad.net> References: <0LJL00HELBXUY930@mail.drs.xfab.de> <118140382.2197031302700472623.JavaMail.root@zimbra36-e6.priv.proxad.net> Message-ID: Hi Sebastian, Ivan Le Lann writes: > If I understand correctly what you're trying to do, you should use > "--root-element my_non_root_element" command line option. If this is a global element, then, yes, that's probably the easiest way to do it. If, however, the element is local (that is, you want to serialize an instance of some complex type), then this approach won't work. What you need to do is generate a serializer aggregate for such a type using the --root-type option. As an example, let's say we want to serialize an instance of the 'author' type from the 'library' example (cxx/hybrid/library/). When compiling 'library.xsd' we add "--root-type author": xsde cxx-hybrid --generate-serializer --generate-aggregate \ --root-type author library.xsd Then our code looks very similar to the version that serializes the root element: author_saggr author_s; xml_schema::document_simpl doc_s ( author_s.root_serializer (), "author"); // Root element name. author_s.pre (*a); doc_s.serialize (cout, xml_schema::document_simpl::pretty_print); author_s.post (); Boris From boris at codesynthesis.com Wed Apr 13 09:50:21 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Apr 13 09:53:35 2011 Subject: [xsde-users] How to serialize just a single element of an schema In-Reply-To: References: <0LJL00HELBXUY930@mail.drs.xfab.de> <118140382.2197031302700472623.JavaMail.root@zimbra36-e6.priv.proxad.net> Message-ID: Hi Sebastian, Sebastian Friebe writes: > With using the --root-type option I was able to serialize a local complex > type of my schema. > > What about a parser for that type? Is it already created properly by using > the --root-type option? Yes, if you have the --generate-parser option then the parser aggregate is also generated. And the same principle applies to parsing as to serialization. Boris From dv7777 at gmail.com Fri Apr 15 10:28:52 2011 From: dv7777 at gmail.com (dv) Date: Fri Apr 15 10:29:02 2011 Subject: [xsde-users] Expat replacement? Message-ID: <4DA85624.4070803@gmail.com> Hi, is Expat hard-coded into XSD/e? Is it possible to use an alternative XML parser? For some internal projects we'd like to use RapidXML, of course validation would not be an option. regards From Sebastian.Friebe at xfab.com Wed Apr 13 09:36:57 2011 From: Sebastian.Friebe at xfab.com (Sebastian Friebe) Date: Sun Apr 17 16:01:01 2011 Subject: [xsde-users] How to serialize just a single element of an schema In-Reply-To: References: <0LJL00HELBXUY930@mail.drs.xfab.de> <118140382.2197031302700472623.JavaMail.root@zimbra36-e6.priv.proxad.net> Message-ID: Hi Boris, thanks a lot. That's what I was looking for. With using the --root-type option I was able to serialize a local complex type of my schema. What about a parser for that type? Is it already created properly by using the --root-type option? best regards, Sebastian From boris at codesynthesis.com Mon Apr 18 09:54:50 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 18 09:58:38 2011 Subject: [xsde-users] Expat replacement? In-Reply-To: <4DA85624.4070803@gmail.com> References: <4DA85624.4070803@gmail.com> Message-ID: Hi, dv writes: > is Expat hard-coded into XSD/e? Yes, though it is fairly isolated. So it shouldn't be very hard to customize the XSD/e runtime (libxsde) to use an alternative SAX- like parser. The Expat-specific code is in the libxsde/xsde/cxx/parser/expat/ directory. You will need to provide a similar functionality based on your parser. Other that that, there is just a handful of references in libxsde/xsde/cxx/parser/{error.?xx, exceptions.?xx, context.hxx}. The easiest way to integrate another parser would probably be to make it "pretend" to be Expat. That is, place it into libxsde/xsde/cxx/parser/expat/, call the files the same as in the Expat implementation, and provide the types and functions that are expected outside (those are just: xml_error type, xml_error_text() function, and XML_Parser type). Should be fairly easy. > For some internal projects we'd like to use RapidXML You know if it not a real XML parser[1], right? > of course validation would not be an option. You can still have XML Schema validation if you want to, as long as the parser does the well-formedness checking. [1] http://www.codesynthesis.com/~boris/blog/2008/05/19/real-xml-parser/ Boris From dv7777 at gmail.com Mon Apr 18 10:27:05 2011 From: dv7777 at gmail.com (dv) Date: Mon Apr 18 10:27:01 2011 Subject: [xsde-users] custom dateTime and time types? Message-ID: <4DAC4A39.9080501@gmail.com> Hi, with XSD, I can use --custom_type dateTime and --custom_type time to tell the generator not to use the built-in xsd cxx types for dateTime and time - in the generated header, it just writes "class time;" and "class date_time;" , which is what I want. XSD/e does not do the same. It simply ignores these options, and still writes "::xsde::cxx::time" and "::xse::cxx::date_time". Is there a way to achieve the desired behavior with XSD/e? regards From boris at codesynthesis.com Tue Apr 19 10:32:30 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Apr 19 10:36:23 2011 Subject: [xsde-users] custom dateTime and time types? In-Reply-To: <4DAC4A39.9080501@gmail.com> References: <4DAC4A39.9080501@gmail.com> Message-ID: Hi, dv writes: > with XSD, I can use --custom_type dateTime and --custom_type time to > tell the generator not to use the built-in xsd cxx types for dateTime > and time - in the generated header, it just writes "class time;" and > "class date_time;" , which is what I want. > > XSD/e does not do the same. It simply ignores these options, and still > writes "::xsde::cxx::time" and "::xse::cxx::date_time". Is there a way > to achieve the desired behavior with XSD/e? In XSD/e you can only customize generated types. If your schema does not use the date/time types in too many places, then you may want to customize types that contain them to return the desired objects. Boris From dv7777 at gmail.com Tue Apr 26 15:03:32 2011 From: dv7777 at gmail.com (dv) Date: Tue Apr 26 15:03:43 2011 Subject: [xsde-users] copy constructors & expat error output Message-ID: <4DB71704.9070109@gmail.com> Hi, I have two questions: 1. Is it possible to have XSD/e generate copy constructors for the complex types? The next best thing I've found is the --generate-clone switch. 2. When an XML file violates the XSD schema, the parser reports an error. However, it reports no details, only that there was a schema error. Is there a way to get the XML parser to output more detailed errors? regards From madhurikalkhamb at gmail.com Wed Apr 27 03:17:20 2011 From: madhurikalkhamb at gmail.com (Madhuri Kalkhamb) Date: Wed Apr 27 04:59:15 2011 Subject: [xsde-users] Query regarding xsde/e for iOS Message-ID: Hi, Thanks for providing the open source library. I want to use that library on iOS platform. I could successfully compile that libraries for various config like (Simulator-Debug/Release OR Device Debug/Release) and can build a sample application using "libxsde-d.a". I could create fat libraries after following steps mentioned in the Read Me file for iOS. I just have query regarding compiling my schemas to C++ with the XSD/e compiler (xsd-x-y.z/xsde) which is mentioned in the read me file for iOS. How can I get those C++ files to include to my sample iphone application? Please provide me steps to compile my schema to C++ with the XSD/e compiler or any sample application which is using this library on iOS platform. Steps to use the library in my iPhone application? Thanks, Madhuri From boris at codesynthesis.com Wed Apr 27 10:41:57 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Apr 27 10:24:20 2011 Subject: [xsde-users] copy constructors & expat error output In-Reply-To: <4DB71704.9070109@gmail.com> References: <4DB71704.9070109@gmail.com> Message-ID: Hi, dv writes: > 1. Is it possible to have XSD/e generate copy constructors for the > complex types? The next best thing I've found is the --generate-clone > switch. Copy constructors are provided (by the C++ compiler) for fixed-length types. Variable-length types are always dynamically allocated so clone() is the preferred mechanism to use with such types. > 2. When an XML file violates the XSD schema, the parser reports an > error. However, it reports no details, only that there was a schema > error. You get the position and the error description. If you are using C++ exceptions, see, the 'hello' example for how to access this information. Otherwise, see the 'minimal' example. Boris From boris at codesynthesis.com Wed Apr 27 10:48:30 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Apr 27 10:30:53 2011 Subject: [xsde-users] Query regarding xsde/e for iOS In-Reply-To: References: Message-ID: Hi Madhuri, Madhuri Kalkhamb writes: > I just have query regarding compiling my schemas to C++ with the XSD/e > compiler (xsd-x-y.z/xsde) > which is mentioned in the read me file for iOS. > How can I get those C++ files to include to my sample iphone application? > Please provide me steps to compile my schema to C++ with the XSD/e compiler > or any sample application which is using this library on iOS platform. The simplest way to compile your schemas is to open a terminal and run something like this (here .../bin/xsde refers to the path to the XSD/e compiler inside the XSD/e distribution): .../bin/xsde cxx-hybrid --generate-parser --generate-serializer --generate-aggregate myfile.xsd This will produce a set of C++ files: Object model: myfile.hxx myfile.cxx Parser skeletons and implementations: myfile-pskle.hxx myfile-pskle.cxx myfile-pimpl.hxx myfile-pimpl.cxx Serializer skeletons and implementations: myfile-sskle.hxx myfile-sskle.cxx myfile-simpl.hxx myfile-simpl.cxx Copy these files to your XCode project's directory and add them to the project. Boris