From Hicham.ELMOUADDINE-prestataire at ca-cib.com Thu Nov 7 05:16:26 2013 From: Hicham.ELMOUADDINE-prestataire at ca-cib.com (EL MOUADDINE, Hicham (Prestataire)) Date: Thu Nov 7 06:21:46 2013 Subject: [xsde-users] Polymorphism and multiple schema files Message-ID: <7AD626C7FE8626438D202B64D510E2D50250DB@EMMXPA019.emea.cib> Hello Boris, I 'm having some issues when serializating objects where dynamic_type is different from static_type. Here are my generating options for xsde (from schema file to cpp classes): xsde cxx-hybrid --generate-parser --generate-serializer --suppress-validation --no-long-long --generate-polymorphic --polymorphic-type abstractPivot --generate-aggregate --root-element pricingContext container.xsd testPackage.xsd first.xsd and the code I'm using to serialize : //I'm trying to serialize pricingContext container::pricingContext pc; //doesn't work: testPackage::standardOption inherits from testPackage::unitaryPayoff testPackage::standardOption * stdOption = new testPackage::standardOption(); //work //testPackage::unitaryPayoff * stdOption = new testPackage::unitaryPayoff(); //unitaryPayoff is a sequence of testPackage::unitaryPayoff which is the static type of unitaryPayoff pc.unitaryPayOff().push_back(stdOption); //I'm using agregation container::pricingContext_saggr contextAggr; xml_schema::document_simpl doc_s (contextAggr.root_serializer (), contextAggr.root_name (),true); //doc_s.add_no_namespace_schema ("container.xsd"); // doc_s.add_no_namespace_schema ("testPackage.xsd"); //doc_s.add_no_namespace_schema ("first.xsd"); contextAggr.pre(pc); // test::writer w("containerSerialization.xml"); w.Open(); std::cout<<"Serializing"< References: <7AD626C7FE8626438D202B64D510E2D50250DB@EMMXPA019.emea.cib> Message-ID: Hi, EL MOUADDINE, Hicham (Prestataire) writes: > --suppress-validation You may want to enable validation to see if there are any issues detected. > When the static type is the same as dynamic type for the pushed object > in unitaryPayOff(), this code works, but when I'm using standardOption > which is a concrete class of unitaryPayoff, the execution stops when > calling doc_s.serialize(w). What do you mean by "execution stops"? Exception is thrown? Nothing gets written? Be more specific otherwise all I can do is guess. Boris From Hicham.ELMOUADDINE-prestataire at ca-cib.com Fri Nov 8 10:32:22 2013 From: Hicham.ELMOUADDINE-prestataire at ca-cib.com (EL MOUADDINE, Hicham (Prestataire)) Date: Fri Nov 8 12:47:10 2013 Subject: [xsde-users] Polymorphism and multiple schema files In-Reply-To: References: <7AD626C7FE8626438D202B64D510E2D50250DB@EMMXPA019.emea.cib> Message-ID: <7AD626C7FE8626438D202B64D510E2D5025346@EMMXPA019.emea.cib> Hello Boris, Thank you for the answer: I will try to remove the --suppress-validation. For the meaning of "execution stops" : Nothing gets written and no exception is thrown. Best Regards. Hicham. -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Friday, November 08, 2013 8:10 AM To: EL MOUADDINE, Hicham (Prestataire) Cc: xsde-users@codesynthesis.com Subject: Re: [xsde-users] Polymorphism and multiple schema files Hi, EL MOUADDINE, Hicham (Prestataire) writes: > --suppress-validation You may want to enable validation to see if there are any issues detected. > When the static type is the same as dynamic type for the pushed object > in unitaryPayOff(), this code works, but when I'm using standardOption > which is a concrete class of unitaryPayoff, the execution stops when > calling doc_s.serialize(w). What do you mean by "execution stops"? Exception is thrown? Nothing gets written? Be more specific otherwise all I can do is guess. Boris This message and any attachments are intended for the sole use of its addressee. If you are not the addressee, please immediately notify the sender and then destroy the message. As this message and/or any attachments may have been altered without our knowledge, its content is not legally binding on Cr?dit Agricole Corporate and Investment Bank. All rights reserved. Ce message et ses pi?ces jointes sont destin?s ? l'usage exclusif de leur destinataire. Si vous recevez ce message par erreur, merci d'en aviser imm?diatement l'exp?diteur et de le d?truire ensuite. Le pr?sent message pouvant ?tre alt?r? ? notre insu, Cr?dit Agricole Corporate and Investment Bank ne peut pas ?tre engag? par son contenu. Tous droits r?serv?s. From pavel.fiala at cern.ch Fri Nov 29 09:58:23 2013 From: pavel.fiala at cern.ch (Pavel Fiala) Date: Fri Nov 29 09:58:33 2013 Subject: [xsde-users] XSDe and XML namespace problem Message-ID: <5298AB8F.5000800@cern.ch> Hello, I started with XSDe going through some tutorials and I have a problem when I want to use my own XML schema. Simplified version is here: http://pastebin.com/C39fka7s Used C++ code is here: http://pastebin.com/T7gbQdE2 Schema was compiled by xsde v. 3.2.0: xsde cxx-hybrid --generate-parser --generate-serializer --generate-aggregate --generate-polymorphic ../../my.xsd The error is: my.xml:2:152:unexpected element encountered If I delete "myns" prefix from root element, it runs fine. However, it should not be a valid XML and my input file is used in different tools which report invalid XML (cannot find root declaration). Any idea how to get it working? Thank you, Pavel Fiala From boris at codesynthesis.com Fri Nov 29 10:00:22 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Nov 29 10:02:46 2013 Subject: [xsde-users] XSDe and XML namespace problem In-Reply-To: <5298AB8F.5000800@cern.ch> References: <5298AB8F.5000800@cern.ch> Message-ID: Hi Pavel, Pavel Fiala writes: > my.xml:2:152:unexpected element encountered > > If I delete "myns" prefix from root element, it runs fine. My guess would be that you did not specify the root element namespace in the doc_p constructor (see 'library' example). Boris From pavel.fiala at cern.ch Fri Nov 29 11:20:10 2013 From: pavel.fiala at cern.ch (Pavel Fiala) Date: Fri Nov 29 11:20:18 2013 Subject: [xsde-users] XSDe and XML namespace problem In-Reply-To: References: <5298AB8F.5000800@cern.ch> Message-ID: <5298BEBA.5000405@cern.ch> Hi Boris, I expected it to be a trivial problem and you are correct, adding the root namespace to the doc_p constructor solves the problem. Thank you, Pavel On 29.11.2013 16:00, Boris Kolpackov wrote: > Hi Pavel, > > Pavel Fiala writes: > >> my.xml:2:152:unexpected element encountered >> >> If I delete "myns" prefix from root element, it runs fine. > My guess would be that you did not specify the root element > namespace in the doc_p constructor (see 'library' example). > > Boris