From werner.haug at agfa.com Wed Jun 12 05:49:22 2013 From: werner.haug at agfa.com (Werner Haug) Date: Wed Jun 12 05:49:31 2013 Subject: [xsde-users] No polymorphism without substitutionGroup? Message-ID: It seems xsde generates no polymorphic code when there is no substitutionGroup. When generating code with xsde.exe cxx-hybrid --generate-parser --generate-serializer --generate-aggregate --generate-polymorphic --generate-typeinfo --root-element root --polymorphic-type root --output-dir src --no-long-long test.xsd from root_paggr::polymorphic () is false How can I generate code that is able to serialize the following? From jaky000000 at gmail.com Wed Jun 12 05:07:55 2013 From: jaky000000 at gmail.com (kai jiang) Date: Wed Jun 12 09:02:04 2013 Subject: [xsde-users] Bug report Message-ID: Dear Mr. / Mrs, my name is Kai Jiang, I am a student in TU munich. Recently I try to use your xsde library to parse and serilize my xml file. The xsde lib is really a great work, it's very fast and easy to use. However, I have just got an error when I parse my xml file. The error happens when I parse the XML file with xsde library. For example, if I parse the "E01_error_384340_25.xml"-file (under "testXMLfile" folder in the zip file), the error message is as follows: "Could not parse file: invalid double value:schema error:384340:25" The content at rows 384340, column 25 of the XML file is as follows: "-1" If I change the value "-1" to "-1.0" or "1", then the program works fine. The same content ("-1") also appears at row 628, and there is no error at this position. I have tested the program on Windows 7 and QNX 6.5 system, the error happens the same. The test program (as eclipse project) and test xml files are included in the zip file, to compile the test program, please include the local xsde header files and libraries in the includes- and library-path of your project. I have tried to debug and review the source code of xsde lib for several days, but I still could not find the reason. May I ask, if you have time, could you try the test porgram to see if it is problem in the lib. Thank you very much. Best wishes, Kai Jiang -------------- next part -------------- A non-text attachment was scrubbed... Name: testProgram.zip Type: application/zip Size: 794753 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsde-users/attachments/20130612/d7678f76/testProgram-0001.zip From boris at codesynthesis.com Wed Jun 12 09:21:51 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 12 09:20:33 2013 Subject: [xsde-users] Bug report In-Reply-To: References: Message-ID: Hi Kai, kai jiang writes: > "Could not parse file: invalid double value:schema error:384340:25" > > The content at rows 384340, column 25 of the XML file is as follows: > "-1" > > If I change the value "-1" to "-1.0" or "1", then the program works fine. > > The same content ("-1") also appears at row 628, and there > is no error at this position. I am pretty sure this is a known bug that we have already fixed. Can you try this patch and see if it helps: http://www.codesynthesis.com/~boris/tmp/xsde-3.2.0-numeric-parser.tar.gz Simply override the files in libxsde with the ones in the archive, then rebuild libxsde and your application. Boris From boris at codesynthesis.com Wed Jun 12 09:27:05 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 12 09:25:47 2013 Subject: [xsde-users] No polymorphism without substitutionGroup? In-Reply-To: References: Message-ID: Hi Werner, Werner Haug writes: > It seems xsde generates no polymorphic code when there is no > substitutionGroup. Without substitution groups XSD/e doesn't know which types are polymorphic and which are not. And generating polymorphism support for all types would be wasteful. > --polymorphic-type root Two problems with this: Firstly, there is no type named 'root' in your schema. That's an element name and the type name is 'root_type'. But even if you fix this you still won't get the desired behavior because it is not this type that you need to mark as polymorphic. Rather, it is 'base'. So what you need is: --polymorphic-type base XSD/e will also automatically treat all types derived from 'base' as polymorphic. Boris From werner.haug at agfa.com Wed Jun 12 10:38:50 2013 From: werner.haug at agfa.com (Werner Haug) Date: Wed Jun 12 10:38:59 2013 Subject: [xsde-users] No polymorphism without substitutionGroup? In-Reply-To: References: Message-ID: Thank you, that helped. The example was from the codesynthesis cxx/tree documentation. In my "real world" XSD the polymorphic base type is defined with abstract="true". In the original file I got, there was no root element. The serialized XML element should have the name of the base type. If I add an element with the name of the base type, no pre() and post() functions are generated. Is that correct? Example: The resulting serialized XML should be: any name 1 How do I have to treat such a case? Is the pre() and post() not necessary in that case? From boris at codesynthesis.com Wed Jun 12 11:41:02 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 12 11:39:44 2013 Subject: [xsde-users] No polymorphism without substitutionGroup? In-Reply-To: References: Message-ID: Hi Werner, Werner Haug writes: > > any name > 1 > > > How do I have to treat such a case? Take a look at the 'polyroot' example in the examples/cxx/hybrid/ directory. It shows how to handle XML vocabulary with polymorphic root elements. Boris From jaky000000 at gmail.com Wed Jun 12 11:02:59 2013 From: jaky000000 at gmail.com (kai jiang) Date: Wed Jun 12 11:40:15 2013 Subject: [xsde-users] Bug report In-Reply-To: References: Message-ID: Dear Boris, thank you very much for writing back so quickly. I have override the files in the libxsde folder, rebuild the libsxde and my program, the error in one of my xml disappears ("E02_error_187683_25.xml"), however, the error in the other xml file - "E01_error_384340_25.xml" retain the same. Could you help me to try it again. Thank you very much. Kai On Wed, Jun 12, 2013 at 3:21 PM, Boris Kolpackov wrote: > Hi Kai, > > kai jiang writes: > > > "Could not parse file: invalid double value:schema error:384340:25" > > > > The content at rows 384340, column 25 of the XML file is as follows: > > > "-1" > > > > If I change the value "-1" to "-1.0" or "1", then the program works fine. > > > > The same content ("-1") also appears at row 628, and > there > > is no error at this position. > > I am pretty sure this is a known bug that we have already fixed. Can you > try this patch and see if it helps: > > http://www.codesynthesis.com/~boris/tmp/xsde-3.2.0-numeric-parser.tar.gz > > Simply override the files in libxsde with the ones in the archive, then > rebuild libxsde and your application. > > Boris > From boris at codesynthesis.com Wed Jun 12 11:57:35 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 12 11:56:17 2013 Subject: [xsde-users] Bug report In-Reply-To: References: Message-ID: Hi Kai, kai jiang writes: > however, the error in the other xml file - "E01_error_384340_25.xml" > retain the same. If you look more carefully, you will see that the error is not the same. Here is what I get for E01_error_384340_25.xml: Could not parse file: mismatched tag:xml error:385207:2 If you now look at the root element tags in E01_error_384340_25.xml, you will see that the opening tag is while the closing tag is . Once I fixed this, the file parsed without any problems. Boris From jaky000000 at gmail.com Thu Jun 13 01:57:46 2013 From: jaky000000 at gmail.com (kai jiang) Date: Thu Jun 13 11:48:42 2013 Subject: [xsde-users] Bug report In-Reply-To: References: Message-ID: Hi Boris, sorry, it's my fault. Now it works perfect for me. Thank you very very much for your time and help. Best wishes, Kai On Wed, Jun 12, 2013 at 5:57 PM, Boris Kolpackov wrote: > Hi Kai, > > kai jiang writes: > > > however, the error in the other xml file - "E01_error_384340_25.xml" > > retain the same. > > If you look more carefully, you will see that the error is not the > same. Here is what I get for E01_error_384340_25.xml: > > Could not parse file: mismatched tag:xml error:385207:2 > > If you now look at the root element tags in E01_error_384340_25.xml, > you will see that the opening tag is while the closing > tag is . Once I fixed this, the file parsed without any > problems. > > Boris > From werner.haug at agfa.com Fri Jun 14 07:44:19 2013 From: werner.haug at agfa.com (Werner Haug) Date: Fri Jun 14 07:44:29 2013 Subject: [xsde-users] No polymorphism without substitutionGroup? In-Reply-To: References: Message-ID: Hi Boris, finally I could adapt the example to my case and am able to compile and run the code. But as usual, the next problem arises: The resulting XML should be something like E but is E. If I omit the mapping namespace, I run into an exception in your file context.cxx, where there is the comment "//@@ TODO: what if prefix is not found?" because of a NULL prefix pointer. What do I have to do to get xmlns="ns1.ns2" and E instead xmlns:ns="ns1.ns2" and E Kind regards, Werner From boris at codesynthesis.com Fri Jun 14 10:33:46 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 14 10:32:27 2013 Subject: [xsde-users] No polymorphism without substitutionGroup? In-Reply-To: References: Message-ID: Hi Werner, Werner Haug writes: > What do I have to do to get > xmlns="ns1.ns2" and E > instead > xmlns:ns="ns1.ns2" and E Pass the empty string as a prefix to indicate you are mapping the default namespace: doc_s.add_prefix ("", "ns1.ns2"); Boris From werner.haug at agfa.com Fri Jun 14 11:19:08 2013 From: werner.haug at agfa.com (Werner Haug) Date: Fri Jun 14 11:19:15 2013 Subject: [xsde-users] No polymorphism without substitutionGroup? In-Reply-To: References: Message-ID: Serializer exception: default namespace in an unqualified element From boris at codesynthesis.com Fri Jun 14 11:48:17 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 14 11:46:59 2013 Subject: [xsde-users] No polymorphism without substitutionGroup? In-Reply-To: References: Message-ID: Hi Werner, Werner Haug writes: > Serializer exception: default namespace in an unqualified element This means your XML vocabulary uses both qualified and unqualified elements (most likely root is qualified and all the inner elements are unqualified). It therefore cannot be used with the default namespace. One way to resolve this would be to make all your elements qualified by adding the elementFormDefault="qualified" attribute to the root element of your schema (i.e., xs:schema). Boris From nshaik_mj at yahoo.com Wed Jun 19 17:49:20 2013 From: nshaik_mj at yahoo.com (Nazeer Shaik) Date: Wed Jun 19 17:49:28 2013 Subject: [xsde-users] xsd/e for tandem Message-ID: <1371678560.15690.YahooMailNeo@web160703.mail.bf1.yahoo.com> Hi Folks, How are you all doing? I wanted to know if anyone has tried xsd/e on tandem, if you can yo pls help? Thanks Nazeer From boris at codesynthesis.com Thu Jun 20 08:59:54 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 20 09:00:01 2013 Subject: [xsde-users] xsd/e for tandem In-Reply-To: <1371678560.15690.YahooMailNeo@web160703.mail.bf1.yahoo.com> References: <1371678560.15690.YahooMailNeo@web160703.mail.bf1.yahoo.com> Message-ID: Hi Nazeer, Nazeer Shaik writes: > I wanted to know if anyone has tried xsd/e on tandem While we haven't tried it ourselves, you shouldn't have any problems with using XSD/e on Tanden, at least in the minimal configuration. Just take the standard configuration file, change the C and C++ compiler names/flags and then disable C++ features (e.g., STL, exceptions, etc.) that are not supported on Tandem (or that are not needed by your application). Boris From boris at codesynthesis.com Fri Jun 21 08:32:28 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 21 08:32:34 2013 Subject: [xsde-users] xsd/e for tandem In-Reply-To: <1371747998.67840.YahooMailNeo@web160702.mail.bf1.yahoo.com> References: <1371678560.15690.YahooMailNeo@web160703.mail.bf1.yahoo.com> <1371747998.67840.YahooMailNeo@web160702.mail.bf1.yahoo.com> Message-ID: Hi Nazeer, In the future please keep your replies CC'ed to the xsde-users mailing list as discussed in the posting guidelines: http://www.codesynthesis.com/support/posting-guidelines.xhtml Nazeer Shaik writes: > I have to design a solution using web-services and XML on tandem. I am new > to tandem, but if it UNIX flavored system I could have moved smoothly. Now > let me explain how the current web-server is architectured. The server has > a generic wsdl with one request and one response. the data type of the > request and response is a string which should be xml in itself. > > I gave a though and this is what I though would be a basic design. > > Since there is an xml with in xml ( I am sure the internal xml will be > encoded to translate the < > and other symbols). I need a XML parser and XML > serializer. The XML parser would parse and create an object in a predefined > xsd format. and the serializer would take a class object and forms a plan > string xml. > > As far as communication between the web-service client and the web-server > can be gSOAP or NonStop Soap ( comes with tandem, or apache made it for > tandem). > > I hope xsd/e is a good option for this task. Give me some ideas if am > going/not going in the right direction. Yes, XSD/e should be able to handle the XML parsing/serialization part. Boris From werner.haug at agfa.com Mon Jun 24 07:03:40 2013 From: werner.haug at agfa.com (Werner Haug) Date: Mon Jun 24 07:03:52 2013 Subject: [xsde-users] No polymorphism without substitutionGroup? In-Reply-To: References: Message-ID: Hi Boris, I don't see, what is going wrong. Here is an example. The two XSDs are as follows: Msg.xsd: ValueSets.xsd: To generate the code I use the following command: xsde.exe cxx-hybrid --generate-parser --generate-serializer --generate-aggregate --generate-polymorphic --generate-typeinfo --root-element MSG --polymorphic-type MSG --output-dir src --no-long-long --namespace-map XTest.XBase.Domain=XTest::XBase::Domain --namespace-map XTest.XBase.Domain.Msg=XTest::XBase::Domain::Msg --namespace-map XTest.XBase.Domain.Model=XTest::XBase::Domain::Model --namespace-map XTest.XBase.Domain.Model.Enumerations=XTest::XBase::Domain::Model::Enumerations Msg.xsd ValueSets.xsd The software (which I included in a ZIP file) produces the following output on serializing: 1 2013-06-24T11:31:45 Sender Receiver 1.3.51.1234.1001.20130624.1113145 1 true true true When parsing the just serialized XML, I get the Parser_exception in line 1, column 163: schema error. unexpected element encountered (which is the xsi:type="msg:MSG_Prep"). This is the XML I would expect: 1 2013-06-24T11:31:45 SPX_1 1.3.51.1234.1001.20130624.1113145 1 false false Can you help? Many thanks, Werner -------------- next part -------------- A non-text attachment was scrubbed... Name: XSDTest.zip Type: application/zip Size: 10216 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsde-users/attachments/20130624/c3c5ebab/XSDTest.zip From boris at codesynthesis.com Mon Jun 24 07:54:49 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jun 24 07:55:12 2013 Subject: [xsde-users] No polymorphism without substitutionGroup? In-Reply-To: References: Message-ID: Hi Werner, Werner Haug writes: > The software (which I included in a ZIP file) produces the following > output on serializing: > > > This is the XML I would expect: > > In your code I see the following two lines: xml_schema::document_simpl doc_s (*msgSSkel, msgSAggr.root_name (), true, MSG_sskel::_static_type ()); doc_s.add_prefix("msg", "XTest.XBase.Domain.Msg"); The first line tells XSD/e that the root element is unqualified, which is not correct in your case. So we need to change it to pass the root element namespace in addition to its name: xml_schema::document_simpl doc_s (*msgSSkel, msgSAggr.root_namespace (), msgSAggr.root_name (), true, MSG_sskel::_static_type ()); The second line maps the 'XTest.XBase.Domain.Msg' namespace to the 'msg' prefix while we want it to be mapped to "no prefix" (default namespace). So we need to change this lime like so: doc_s.add_prefix("", "XTest.XBase.Domain.Msg"); Boris From werner.haug at agfa.com Mon Jun 24 08:26:31 2013 From: werner.haug at agfa.com (Werner Haug) Date: Mon Jun 24 08:26:40 2013 Subject: [xsde-users] No polymorphism without substitutionGroup? In-Reply-To: References: Message-ID: Hi Boris, thank you, that helped. Now there are still lines like " References: Message-ID: Hi Werner, Werner Haug writes: > Now there are still lines like " When adding > doc_s.add_prefix("", "XTest.XBase.Domain"); > I get > Serializer exception: xml error. duplicate prefix You cannot have two default namespaces in the same XML document. That's XML 101. Boris From werner.haug at agfa.com Mon Jun 24 09:46:37 2013 From: werner.haug at agfa.com (Werner Haug) Date: Mon Jun 24 09:46:46 2013 Subject: [xsde-users] No polymorphism without substitutionGroup? In-Reply-To: References: Message-ID: Hi Boris, unfortunately it's not my schema and it works with XSD2Code on C#, which is my counterpart. I'll see what I can do in this case. Thank you very much for your help, Werner