From E.de.Koster at dutchspace.nl Thu Dec 3 04:49:04 2009 From: E.de.Koster at dutchspace.nl (Koster, Erik de) Date: Thu Dec 3 06:41:34 2009 Subject: [xsde-users] Help me get rid of std::type_info Message-ID: <77EFCF662C40C747970A7CEC5D4718511AF13D@kb-mail.dutchspace.nl> Dear all, On the target platform we want to use XSD/E for the std::type_info is not available for casting. Can the XSD/e parser (non validating) be commanded to not use this class? Kind regards, Erik de Koster -- ---------------------------------------------------------------------- Dutch Space B.V. te Leiden. KvK nummer: 28086907. Dutch Space B.V., Leiden, The Netherlands. Chamber of Commerce number 28086907 -- ---------------------------------------------------------------------- This communication is intended for use by the addressee and may contain confidential or privileged information. If you receive this communication unintentionally, please notify us immediately and delete the message from your computer without making any copies. -- ---------------------------------------------------------------------- Please consider the environment before printing this email -- ---------------------------------------------------------------------- From boris at codesynthesis.com Thu Dec 3 06:55:41 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Dec 3 06:49:01 2009 Subject: [xsde-users] Help me get rid of std::type_info In-Reply-To: <77EFCF662C40C747970A7CEC5D4718511AF13D@kb-mail.dutchspace.nl> References: <77EFCF662C40C747970A7CEC5D4718511AF13D@kb-mail.dutchspace.nl> Message-ID: Hi Erik, Koster, Erik de writes: > On the target platform we want to use XSD/E for the std::type_info is > not available for casting. Can the XSD/e parser (non validating) be > commanded to not use this class? XSD/e doesn't use std::type_info directly. It may use dynamic_cast for polymorphism support if you configure it to use the mixin-style parser/serializer reuse (by default it is tiein-style). Can you provide more information on where in the code you see std::type_info being used? Boris From boris at codesynthesis.com Tue Dec 8 09:39:22 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Dec 8 09:32:22 2009 Subject: [xsde-users] Re: Type mapping In-Reply-To: <20091207104706.44aba425@streamteam.de> References: <20091207104706.44aba425@streamteam.de> Message-ID: Hi Thomas, Thomas Frenzel (TomSun) writes: > 1. Template base classes > i am not sure, but i think it is possible to replace a generated type > by a self implemented type, right?. Yes, see Section 4.8, "Customizing the Object Model" in the Embedded C++/Hybrid Mapping Getting Started Guide: http://www.codesynthesis.com/projects/xsde/documentation/cxx/hybrid/guide/#4.8 > Is it also possible to create a type mapping to a template type? You can map it to an instantiation of a template, but not to a template itself. In other words, if you have: template class wrapper { ... }; Then you can re-map a type in the object model to something like wrapper. > What i would like to do is the following: > > I create a schema with an empty base complex type and several derived type. > In the code generation i want to replace the empty base type by an self > implemented template type. So i would need a posibility to define the > template parameters foreach derived type. > > One use case for this scenario would be: > Each derived complex type implements a Value attribute. But the Value > attributes have a different types (e.g. int, float, long, etc.) > My template class implements some operators (e.g. +, -, etc.) You could use the wrapper template as shown above. That is, you would ask the XSD/e compiler to still generate the types but with different names (say for type A it would be A_base). Then you re-map the type to wrapper. The wrapper template could inherit from its argument and provide some extra functionality, like +/- operators. > > 2. overriding, abstract definition > Another feature would be nice, too. If i could define a attribute or > element as abstract in the base complex type and define an element > with the same name but with an default value in the derived type, > i could provide something like metadata for my generated types. This is illegal in XML Schema and you will get a redefinition error in the derived type. > With this solution i could determine without any casting of which > type the current instance in a list of "MyBase" is. Have you looked at the --generate-typeinfo option? With this option each generated type gets the following two functions: virtual const std::string& _dynamic_type () const; static const std::string& _static_type (); Then you can do: base* b = ... if (b->_dynamic_type () == derived_a::_static_type ()) { // Got derived_a. } See Section 4.9, "Polymorphic Object Models" for details: http://www.codesynthesis.com/projects/xsde/documentation/cxx/hybrid/guide/#4.8 Boris From tftomsun at streamteam.de Mon Dec 7 05:47:06 2009 From: tftomsun at streamteam.de (Thomas Frenzel (TomSun)) Date: Tue Dec 8 23:36:12 2009 Subject: [xsde-users] Type mapping Message-ID: <20091207104706.44aba425@streamteam.de> Hi Boris, 1. Template base classes i am not sure, but i think it is possible to replace a generated type by a self implemented type, right?. Is it also possible to create a type mapping to a template type? What i would like to do is the following: I create a schema with an empty base complex type and several derived type. In the code generation i want to replace the empty base type by an self implemented template type. So i would need a posibility to define the template parameters foreach derived type. One use case for this scenario would be: Each derived complex type implements a Value attribute. But the Value attributes have a different types (e.g. int, float, long, etc.) My template class implements some operators (e.g. +, -, etc.) What i could do now is simply calculate with the generated types, without having to implement the operators for each of the generated types. Is there already a possibility to do that? Do you think this would be useful or would you suggest another way to use schema generated types in a generic way? 2. overriding, abstract definition Another feature would be nice, too. If i could define a attribute or element as abstract in the base complex type and define an element with the same name but with an default value in the derived type, i could provide something like metadata for my generated types. For example: I define an simple type enumeration "MyType" with three values ("TypeA","TypeB","TypeC") I define a base complex type "MyBase" with an abstract Attribute "Type" of type "MyType" I define three complex types "MyTypeA","MyTypeB","MyTypeC" that derive from my base complex types And now i override the "Type" attribute and assign the default or fixed value foreach derived type. MyTypeA.Type = MyType::TypeA MyTypeB.Type = MyType::TypeB MyTypeC.Type = MyType::TypeC With this solution i could determine without any casting of which type the current instance in a list of "MyBase" is. Alot of questions... :) Thank you in advance for your answer. Regards, Tom From boris at codesynthesis.com Thu Dec 10 07:37:23 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Dec 10 07:30:20 2009 Subject: [xsde-users] Help me get rid of std::type_info In-Reply-To: References: <77EFCF662C40C747970A7CEC5D4718511AF13D@kb-mail.dutchspace.nl> Message-ID: Hi, Koster, Erik de writes: > On the target platform we want to use XSD/E for the std::type_info is > not available for casting. Can the XSD/e parser (non validating) be > commanded to not use this class? Just a heads up in you case anyone else is experiencing this problem: I have done some investigating and it appears that while the code in XSD/e does not use type_info directly, the type information generated by the g++ compiler does depend on this symbol. I was able to resolve this issue by compiling the XSD/e runtime, the generated code, and the application code with the -fno-rtti option to disable generation of RTTI. You can try this by adding this option to the CXXFLAGS variable in your config.make and then rebuilding the XSD/e runtime (make clean && make). You will also need to use this option while compiling the generated code and your application code, unless you are already doing this. Boris From tftomsun at streamteam.de Tue Dec 15 05:00:20 2009 From: tftomsun at streamteam.de (Thomas Frenzel (TomSun)) Date: Tue Dec 15 05:00:30 2009 Subject: [xsde-users] =?iso-8859-1?q?Error_during_serialization_of_the_ch?= =?iso-8859-1?q?aracter_=27=FC=27?= Message-ID: <20091215100020.6cb6ea39@streamteam.de> Hi Boris, i created a xml schema which describes logging data. One log entry has a message, time stamp, log level ... etc. When i try to log a message with the character '?' i get an xml_schema::serializer_exception with the text "illegal UTF-8 character" and what "xml error" The create the message string like that: LOG_ERROR("An error occured during the call of the method '%s'.?",lastMethodName); the lastmethod name will be inserted in the message string using the vsprintf_s function. Afterwar When i remove the last character (the '?'), i don't get the exception. Code: messageLength = _vscprintf( messagePattern, messageArguments ) + 1; // terminating '\0' message = new char[messageLength]; printResult = vsprintf_s( message,messageLength, messagePattern, messageArguments); message[messageLength-1] = 0; LogEntryData* logEntry = new LogEntryData(); logEntry->Message(message); And this is my common serialization code: XmlWriter writer(xmlStream); this->m_serializer.pre (*data); writer.write(encodingInfo,strlen(encodingInfo)); this->m_documentSerializer->serialize (writer, xml_schema::document_simpl::pretty_print); this->m_serializer.post (); Encoding info is the following string: this->encodingInfo = "\n"; My Project is build with the UNICODE preprocessor command. What i am doing wrong? Like i said, just removing the ? from the message helps. But normaly this should not be a problem in an UTF-8 world. Thanks in advance, Tom From boris at codesynthesis.com Tue Dec 15 07:57:48 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Dec 15 07:50:40 2009 Subject: [xsde-users] Re: Error during =?iso-8859-1?q?serialization_of_the_character_?= =?iso-8859-1?q?=27=FC=27?= In-Reply-To: <20091215100020.6cb6ea39@streamteam.de> References: <20091215100020.6cb6ea39@streamteam.de> Message-ID: Hi Thomas, Thomas Frenzel (TomSun) writes: > When i try to log a message with the character '?' i get an > xml_schema::serializer_exception with the text "illegal UTF-8 character" > and what "xml error" XSD/e expects all the text that you supply to it (e.g, in the object model or with the C++/Serializer mapping) to be in UTF-8. The proper encoding for letter '?' in UTF-8 is a two-byte sequence "\0xC3\0xBC". Putting the Unicode value for '?' in a UTF-8 string (which is what you are doing) results in an invalid encoding since in UTF-8 such a value is only expected as part of a multi-byte sequence. We are planning to add support for ISO-8859-1 (where '?' is represented as its Unicode value) in addition to UTF-8 as the object model encoding (you will still be able to serialize in UTF-8). If you only need to support Western-European languages then this encoding might be a better choice since it will be easier to work with. Let me know if you would like to try it. Boris From tftomsun at streamteam.de Tue Dec 15 10:55:18 2009 From: tftomsun at streamteam.de (Thomas Frenzel (TomSun)) Date: Tue Dec 15 10:55:27 2009 Subject: [xsde-users] =?iso-8859-1?q?Re=3A_Error_during_serialization_of_?= =?iso-8859-1?q?the_character_=27=FC=27?= In-Reply-To: boris.20091215144240@codesynthesis.com Message-ID: <20091215155518.75beee6b@streamteam.de> Hi Boris, thanks for your fast reply. Quote: Putting the Unicode value for '?' in a UTF-8 string (which is what you are doing) results in an invalid encoding since in UTF-8 such a value is only expected as part of a multi-byte sequence. Does this mean, i would not have the problem if i build my project without the UNICODE preprocessor command? Or if i build my project with UNICODE would it work if i convert the string to multibyte format using the win api function wcstombs? Quote: We are planning to add support for ISO-8859-1 (where '?' is represented as its Unicode value) in addition to UTF-8 as the object model encoding (you will still be able to serialize in UTF-8). If you only need to support Western-European languages then this encoding might be a better choice since it will be easier to work with. Let me know if you would like to try it. Yes, i just need support for the western european languages. Regards, Tom _____ From: Boris Kolpackov [mailto:boris@codesynthesis.com] To: Thomas Frenzel (TomSun) [mailto:tftomsun@streamteam.de] Cc: xsde-users@codesynthesis.com Sent: Tue, 15 Dec 2009 13:57:48 +0100 Subject: Re: Error during serialization of the character '?' Hi Thomas, Thomas Frenzel (TomSun) writes: > When i try to log a message with the character '?' i get an > xml_schema::serializer_exception with the text "illegal UTF-8 character" > and what "xml error" XSD/e expects all the text that you supply to it (e.g, in the object model or with the C++/Serializer mapping) to be in UTF-8. The proper encoding for letter '?' in UTF-8 is a two-byte sequence "\0xC3\0xBC". Putting the Unicode value for '?' in a UTF-8 string (which is what you are doing) results in an invalid encoding since in UTF-8 such a value is only expected as part of a multi-byte sequence. We are planning to add support for ISO-8859-1 (where '?' is represented as its Unicode value) in addition to UTF-8 as the object model encoding (you will still be able to serialize in UTF-8). If you only need to support Western-European languages then this encoding might be a better choice since it will be easier to work with. Let me know if you would like to try it. Boris From boris at codesynthesis.com Wed Dec 16 06:08:57 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Dec 16 15:05:03 2009 Subject: [xsde-users] Re: Error during =?iso-8859-1?q?serialization_of_the_character_?= =?iso-8859-1?q?=27=FC=27?= In-Reply-To: <20091215155518.75beee6b@streamteam.de> References: <20091215155518.75beee6b@streamteam.de> Message-ID: Hi Thomas, Thomas Frenzel (TomSun) writes: > Does this mean, i would not have the problem if i build my project > without the UNICODE preprocessor command? Or if i build my project > with UNICODE would it work if i convert the string to multibyte > format using the win api function wcstombs? XSD/e doesn't know anything about the UNICODE macro, so it doesn't matter, as far as the generated code is concerned, whether you define this macro or not. Windows wcstombs API does not support UTF-8. You will need to use WideCharToMultiByte/MultiByteToWideChar with CP_UTF8 for that. Of course, this API is Windows-specific and won't be portable. > Yes, i just need support for the western european languages. Ok, I will let you know when support for ISO-8859-1 is ready. It will probably only be after Christmas, though. Boris From E.de.Koster at dutchspace.nl Wed Dec 16 10:33:18 2009 From: E.de.Koster at dutchspace.nl (Koster, Erik de) Date: Thu Dec 17 02:09:26 2009 Subject: [xsde-users] Help me Windows XP validation libraries requirements In-Reply-To: <6D8DE89717DDDF4C919EC6A53EA12DC1C0793E@kb-mail.dutchspace.nl> References: <6D8DE89717DDDF4C919EC6A53EA12DC1C0793E@kb-mail.dutchspace.nl> Message-ID: <77EFCF662C40C747970A7CEC5D4718512B5BD5@kb-mail.dutchspace.nl> Dear staff, In a project we are reviewing XSD/e to generate data binding C++ code for XML Schemas. For our customer it is important to have detailed knowledge on the libraries that are required to run an application that uses the XSD/e parser generated from our XML Schemas. Can you provide the list of run time libraries (and if possible the DLLs required)? We will use this application under Windows XP. Kind regards, Erik de Koster -- ---------------------------------------------------------------------- Dutch Space B.V. te Leiden. KvK nummer: 28086907. Dutch Space B.V., Leiden, The Netherlands. Chamber of Commerce number 28086907 -- ---------------------------------------------------------------------- This communication is intended for use by the addressee and may contain confidential or privileged information. If you receive this communication unintentionally, please notify us immediately and delete the message from your computer without making any copies. -- ---------------------------------------------------------------------- Please consider the environment before printing this email -- ---------------------------------------------------------------------- From boris at codesynthesis.com Thu Dec 17 02:53:14 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Dec 17 02:46:02 2009 Subject: [xsde-users] Help me Windows XP validation libraries requirements In-Reply-To: <77EFCF662C40C747970A7CEC5D4718512B5BD5@kb-mail.dutchspace.nl> References: <6D8DE89717DDDF4C919EC6A53EA12DC1C0793E@kb-mail.dutchspace.nl> <77EFCF662C40C747970A7CEC5D4718512B5BD5@kb-mail.dutchspace.nl> Message-ID: Hi Erik, Koster, Erik de writes: > For our customer it is important to have detailed knowledge on the > libraries that are required to run an application that uses the XSD/e > parser generated from our XML Schemas. Can you provide the list of run > time libraries (and if possible the DLLs required)? The XSD/e runtime and generated code do not depend on any external libraries except for the C and C++ runtime libraries which every C++ program would depend on. With VC++ you can select whether to use the DLL versions of these runtime libraries or to link them statically with the /M* options: http://msdn.microsoft.com/en-us/library/2kzt1wy3(VS.71).aspx For example, if you are using VC++ 2005 (8.0) and compile the XSD/e runtime library, generated code, and your application code with the /MD option, then your application will depend on MSVCR80.DLL (C runtime) and MSVCP80.DLL (C++ runtime). On the other hand, if you use the /MT option, then these libraries will be linked statically into the resulting executable. If you decide to use the DLL versions of these runtime libraries, then Microsoft provides redistributable packages that contain the libraries for various versions of VC++: http://www.microsoft.com/downloads/details.aspx?FamilyId=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en Boris