From boris at codesynthesis.com Wed Sep 1 11:53:42 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Sep 1 11:43:32 2010 Subject: [xsd-users] Possible bug In-Reply-To: References: <1CDDAE48-08FB-42CA-BF31-33BE27BD9513@singularsoftware.com> Message-ID: Hi Barrie, Ok, I believe I have fixed this problem. The updated file for libxsd is available in these archives: http://www.codesynthesis.com/~boris/tmp/xsd-3.3.0-dom-assignmnet.zip http://www.codesynthesis.com/~boris/tmp/xsd-3.3.0-dom-assignmnet.tar.gz Simply overwrite your XSD 3.3.0 installation and rebuild your application. Thanks for reporting this and let me know if there any problems with the fix. Boris From barrie.kovish at singularsoftware.com Wed Sep 1 11:48:05 2010 From: barrie.kovish at singularsoftware.com (Barrie Kovish) Date: Wed Sep 1 11:48:16 2010 Subject: [xsd-users] Possible bug In-Reply-To: References: <1CDDAE48-08FB-42CA-BF31-33BE27BD9513@singularsoftware.com> Message-ID: Boris, Thanks, I'll give this a try shortly. Barrie On 2010-09-01, at 8:53 AM, Boris Kolpackov wrote: > Hi Barrie, > > Ok, I believe I have fixed this problem. The updated file for libxsd > is available in these archives: > > http://www.codesynthesis.com/~boris/tmp/xsd-3.3.0-dom-assignmnet.zip > http://www.codesynthesis.com/~boris/tmp/xsd-3.3.0-dom-assignmnet.tar.gz > > Simply overwrite your XSD 3.3.0 installation and rebuild your application. > > Thanks for reporting this and let me know if there any problems with > the fix. > > Boris From barrie.kovish at singularsoftware.com Thu Sep 2 10:27:24 2010 From: barrie.kovish at singularsoftware.com (Barrie Kovish) Date: Thu Sep 2 10:27:34 2010 Subject: [xsd-users] Possible bug In-Reply-To: References: <1CDDAE48-08FB-42CA-BF31-33BE27BD9513@singularsoftware.com> Message-ID: Boris, This fix passes our tests. Thanks, Barrie On 2010-09-01, at 8:53 AM, Boris Kolpackov wrote: > Hi Barrie, > > Ok, I believe I have fixed this problem. The updated file for libxsd > is available in these archives: > > http://www.codesynthesis.com/~boris/tmp/xsd-3.3.0-dom-assignmnet.zip > http://www.codesynthesis.com/~boris/tmp/xsd-3.3.0-dom-assignmnet.tar.gz > > Simply overwrite your XSD 3.3.0 installation and rebuild your application. > > Thanks for reporting this and let me know if there any problems with > the fix. > > Boris From Laura_E_Fowler at raytheon.com Thu Sep 2 15:18:07 2010 From: Laura_E_Fowler at raytheon.com (Laura E Fowler) Date: Thu Sep 2 15:18:31 2010 Subject: [xsd-users] Need help saving off a portion of an XML message using C++/Tree Message-ID: Skipped content of type multipart/related-------------- next part -------------- A non-text attachment was scrubbed... Name: XSDFile1.xsd Type: application/octet-stream Size: 1119 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20100902/5835e58c/XSDFile1.obj From boris at codesynthesis.com Thu Sep 2 16:04:11 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Sep 2 15:53:42 2010 Subject: [xsd-users] Need help saving off a portion of an XML message using C++/Tree In-Reply-To: References: Message-ID: Hi Laura, Laura E Fowler writes: > What is the best way to save a subCmd entry to a C++ list? I'm > getting myself confused about when the memory is freed pertaining to > the iterator that was gotten when referencing the received message. > I looked through the various documentation and wiki pages, but I > wasn't able to locate an answer. In C++/Tree when you create a copy of an object model node, you get a completely independent copy of the sub-tree. In your case, we can do something like this: void* thread_func (void* arg) { std::auto_ptr sc (static_cast (arg)); ... } command& c = ... for (command::subCmd_iterator i (c.subCmd ().begin ()); i != c.subCmd ().end (); ++i) { // Make a copy of the sub-command so that we can pass it to // the thread. // std::auto_ptr copy (new subCmd (*i)); if (!start_thread (thread_func, copy.get ()) { // Failed to start the thread. } // If the thread started successfully then it will free the // sub-command. // copy.release (); } Of course, you can use other smart pointers (or even plane pointers) here instead of auto_ptr. If you don't care about the original message and would like to avoid making copies then you can "deconstruct" the original object model using the detach() functions (requires XSD 3.3.0): for (command::subCmd_iterator i (c.subCmd ().begin ()); i != c.subCmd ().end ();) { std::auto_ptr sc; i = c.detach (i, sc); if (!start_thread (thread_func, sc.get ()) { // Failed to start the thread. } // If the thread started successfully then it will free the // sub-command. // sc.release (); } The detach() call above has the semantics similar to erase(). Boris From Laura_E_Fowler at raytheon.com Thu Sep 2 16:08:47 2010 From: Laura_E_Fowler at raytheon.com (Laura E Fowler) Date: Thu Sep 2 16:09:07 2010 Subject: [xsd-users] Need help saving off a portion of an XML message using C++/Tree In-Reply-To: References: Message-ID: Thank you Boris. You have saved me several hours trying to figure out how to do this. Laura Fowler Raytheon Company www.raytheon.com This message contains information that may be confidential and privileged. Unless you are the addressee (or authorized to receive mail for the addressee), you should not use, copy or disclose to anyone this message or any information contained in this message. If you have received this message in error, please so advise the sender by reply e-mail and delete this message. Thank you for your cooperation. From: Boris Kolpackov To: Laura E Fowler Cc: xsd-users@codesynthesis.com Date: 09/02/2010 02:53 PM Subject: Re: [xsd-users] Need help saving off a portion of an XML message using C++/Tree Hi Laura, Laura E Fowler writes: > What is the best way to save a subCmd entry to a C++ list? I'm > getting myself confused about when the memory is freed pertaining to > the iterator that was gotten when referencing the received message. > I looked through the various documentation and wiki pages, but I > wasn't able to locate an answer. In C++/Tree when you create a copy of an object model node, you get a completely independent copy of the sub-tree. In your case, we can do something like this: void* thread_func (void* arg) { std::auto_ptr sc (static_cast (arg)); ... } command& c = ... for (command::subCmd_iterator i (c.subCmd ().begin ()); i != c.subCmd ().end (); ++i) { // Make a copy of the sub-command so that we can pass it to // the thread. // std::auto_ptr copy (new subCmd (*i)); if (!start_thread (thread_func, copy.get ()) { // Failed to start the thread. } // If the thread started successfully then it will free the // sub-command. // copy.release (); } Of course, you can use other smart pointers (or even plane pointers) here instead of auto_ptr. If you don't care about the original message and would like to avoid making copies then you can "deconstruct" the original object model using the detach() functions (requires XSD 3.3.0): for (command::subCmd_iterator i (c.subCmd ().begin ()); i != c.subCmd ().end ();) { std::auto_ptr sc; i = c.detach (i, sc); if (!start_thread (thread_func, sc.get ()) { // Failed to start the thread. } // If the thread started successfully then it will free the // sub-command. // sc.release (); } The detach() call above has the semantics similar to erase(). Boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/gif Size: 4310 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20100902/26bcaf51/attachment.gif From angelo at cedeo.net Fri Sep 3 06:13:59 2010 From: angelo at cedeo.net (Angelo Difino) Date: Fri Sep 3 15:32:56 2010 Subject: [xsd-users] exporting symbols from a windows dll Message-ID: <4C80CA67.1090808@cedeo.net> Hi Boris, I've checked the alfa release of 4.0.0 and seems that any troubles flew away! Now i'm able to compile my package with windows7/visual studio 2008, exporting simbol, without any problems! (nowadays i've checked just compilation, but you can have a look to the difference below) ------------>My previous script (3.2.0) was: 1)xsd cxx-tree --generate-xml-schema --generate-serialization --generate-polymorphic xmlschema.xsd 2)xsd cxx-tree --generate-wildcard --extern-xml-schema xmlschema.hxx --generate-serialization --generate-polymorphic --file-per-type --namespace-map urn:mpeg:mpeg-m:schema:storelicenseprotocol:2010=mxm_dataobject::mxm_slp --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/bbl.xsd=bbl.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/mxmalp.xsd=mxmalp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2010/04/mxmbp.xsd=mxmbp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/dia.xsd=dia.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/erl.xsd=erl.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/didl-msx.xsd=didl-msx.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/didl.xsd=didl.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/didmodel.xsd=didmodel.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/dii.xsd=dii.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpdidl.xsd=ipmpdidl.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpinfo-msx.xsd=ipmpinfo-msx.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpinfo.xsd=ipmpinfo.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2010/08/mxmidp.xsd=mxmidp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpmsg.xsd=ipmpmsg.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/mpeg4ipmp.xsd=mpeg4ipmp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/mpeg7smp.xsd=mpeg7smp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-m1x.xsd=rel-m1x.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-m2x.xsd=rel-m2x.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-m3x.xsd=rel-m3x.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-mx.xsd=rel-mx.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-r.xsd=rel-r.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-sx.xsd=rel-sx.xsd --location-map http://www.w3.org/2001/xml.xsd=xml.xsd --location-map http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd=dsig.xsd --location-map http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/xenc-schema.xsd=xenc.xsd --namespace-map urn:mpeg:maf:schema:mediastreaming:DIDLextensions=mxm_dataobject::didl_msx --namespace-map urn:mpeg:mpeg21:2006:07-DIDL-NS=mxm_dataobject::didl --namespace-map urn:mpeg:mpeg21:2002:02-DIDMODEL-NS=mxm_dataobject::didmodel --namespace-map urn:mpeg:mpeg21:2002:01-DII-NS=mxm_dataobject::dii --namespace-map urn:mpeg:mpeg21:2004:01-IPMPDIDL-NS=mxm_dataobject::ipmpdidl --namespace-map urn:mpeg:mpeg21:2003:01-DIA-NS=mxm_dataobject::dia --namespace-map urn:mpeg:mpeg21:2005:01-ERL-NS=mxm_dataobject::erl --namespace-map urn:mpeg:maf:Schema:mediastreaming:IPMPINFOextensions:2007=mxm_dataobject::ipmpinfo_msx --namespace-map urn:mpeg:mpeg21:2004:01-IPMPINFO-NS=mxm_dataobject::ipmpinfo --namespace-map urn:mpeg:mpegB:schema:IPMP-XML-MESSAGES:2007=mxm_dataobject::ipmpmsg --namespace-map urn:mpeg:mpeg4:IPMPSchema:2002=mxm_dataobject::mpeg4ipmp --namespace-map urn:mpeg:mpeg7:smp:schema:2001=mxm_dataobject::mpeg7smp --namespace-map urn:mpeg:mpeg21:2005:01-REL-M1X-NS=mxm_dataobject::rel_m1x --namespace-map urn:mpeg:mpeg21:2006:01-REL-M2X-NS=mxm_dataobject::rel_m2x --namespace-map urn:mpeg:mpeg21:2006:01-REL-M3X-NS=mxm_dataobject::rel_m3x --namespace-map urn:mpeg:mpeg21:2003:01-REL-MX-NS=mxm_dataobject::rel_mx --namespace-map urn:mpeg:mpeg21:2003:01-REL-R-NS=mxm_dataobject::rel_r --namespace-map urn:mpeg:mpeg21:2003:01-REL-SX-NS=mxm_dataobject::rel_sx --namespace-map http://www.w3.org/XML/1998/namespace=mxm_dataobject::xml --namespace-map http://www.w3.org/2000/09/xmldsig#=mxm_dataobject::dsig --namespace-map http://www.w3.org/2001/04/xmlenc#=mxm_dataobject::xenc --namespace-map urn:mpeg:mpeg-m:schema:accesslicenseprotocol:2010=mxm_dataobject::mxm_alp --namespace-map urn:mpeg:mpeg-m:schema:baseprotocol:2010=mxm_dataobject::mxm_bprotocols --namespace-map urn:mpeg:mpeg-m:schema:identifycontentprotocol:2010=mxm_dataobject::mxm_icp --namespace-map urn:mpeg:mpeg-m:schema:identifydeviceprotocol:2010=mxm_dataobject::mxm_idp --namespace-map urn:mpeg:mpeg-m:schema:verifydeviceprotocol:2010=mxm_dataobject::mxm_vdp didl.xsd ------------>My new script (with export inside) is: 1)xsd cxx-tree --generate-xml-schema --generate-serialization --generate-polymorphic xmlschema.xsd 2)xsd cxx-tree --hxx-prologue "#include \"myexport.hxx\"" --export-symbol MXM_SYMBOL_DECL --generate-wildcard --extern-xml-schema xmlschema.hxx --generate-serialization --generate-polymorphic --file-per-type --namespace-map urn:mpeg:mpeg-m:schema:storelicenseprotocol:2010=mxm_dataobject::mxm_slp --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/bbl.xsd=bbl.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/mxmalp.xsd=mxmalp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2010/04/mxmbp.xsd=mxmbp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/dia.xsd=dia.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/erl.xsd=erl.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/didl-msx.xsd=didl-msx.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/didl.xsd=didl.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/didmodel.xsd=didmodel.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/dii.xsd=dii.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpdidl.xsd=ipmpdidl.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpinfo-msx.xsd=ipmpinfo-msx.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpinfo.xsd=ipmpinfo.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2010/04/mxmidp.xsd=mxmidp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpmsg.xsd=ipmpmsg.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/mpeg4ipmp.xsd=mpeg4ipmp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/mpeg7smp.xsd=mpeg7smp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-m1x.xsd=rel-m1x.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-m2x.xsd=rel-m2x.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-m3x.xsd=rel-m3x.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-mx.xsd=rel-mx.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-r.xsd=rel-r.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-sx.xsd=rel-sx.xsd --location-map http://www.w3.org/2001/xml.xsd=xml.xsd --location-map http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd=dsig.xsd --location-map http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/xenc-schema.xsd=xenc.xsd --namespace-map urn:mpeg:maf:schema:mediastreaming:DIDLextensions=mxm_dataobject::didl_msx --namespace-map urn:mpeg:mpeg21:2006:07-DIDL-NS=mxm_dataobject::didl --namespace-map urn:mpeg:mpeg21:2002:02-DIDMODEL-NS=mxm_dataobject::didmodel --namespace-map urn:mpeg:mpeg21:2002:01-DII-NS=mxm_dataobject::dii --namespace-map urn:mpeg:mpeg21:2004:01-IPMPDIDL-NS=mxm_dataobject::ipmpdidl --namespace-map urn:mpeg:mpeg21:2003:01-DIA-NS=mxm_dataobject::dia --namespace-map urn:mpeg:mpeg21:2005:01-ERL-NS=mxm_dataobject::erl --namespace-map urn:mpeg:maf:Schema:mediastreaming:IPMPINFOextensions:2007=mxm_dataobject::ipmpinfo_msx --namespace-map urn:mpeg:mpeg21:2004:01-IPMPINFO-NS=mxm_dataobject::ipmpinfo --namespace-map urn:mpeg:mpegB:schema:IPMP-XML-MESSAGES:2007=mxm_dataobject::ipmpmsg --namespace-map urn:mpeg:mpeg4:IPMPSchema:2002=mxm_dataobject::mpeg4ipmp --namespace-map urn:mpeg:mpeg7:smp:schema:2001=mxm_dataobject::mpeg7smp --namespace-map urn:mpeg:mpeg21:2005:01-REL-M1X-NS=mxm_dataobject::rel_m1x --namespace-map urn:mpeg:mpeg21:2006:01-REL-M2X-NS=mxm_dataobject::rel_m2x --namespace-map urn:mpeg:mpeg21:2006:01-REL-M3X-NS=mxm_dataobject::rel_m3x --namespace-map urn:mpeg:mpeg21:2003:01-REL-MX-NS=mxm_dataobject::rel_mx --namespace-map urn:mpeg:mpeg21:2003:01-REL-R-NS=mxm_dataobject::rel_r --namespace-map urn:mpeg:mpeg21:2003:01-REL-SX-NS=mxm_dataobject::rel_sx --namespace-map http://www.w3.org/XML/1998/namespace=mxm_dataobject::xml --namespace-map http://www.w3.org/2000/09/xmldsig#=mxm_dataobject::dsig --namespace-map http://www.w3.org/2001/04/xmlenc#=mxm_dataobject::xenc --namespace-map urn:mpeg:mpeg-m:schema:accesslicenseprotocol:2010=mxm_dataobject::mxm_alp --namespace-map urn:mpeg:mpeg-m:schema:baseprotocol:2010=mxm_dataobject::mxm_bprotocols --namespace-map urn:mpeg:mpeg-m:schema:identifycontentprotocol:2010=mxm_dataobject::mxm_icp --namespace-map urn:mpeg:mpeg-m:schema:identifydeviceprotocol:2010=mxm_dataobject::mxm_idp --namespace-map urn:mpeg:mpeg-m:schema:verifydeviceprotocol:2010=mxm_dataobject::mxm_vdp didl.xsd ------------>My previous package (3.2.0) created: http://www.mxb.it/enigmahc/mxm_dataobject_old.zip ------------>My new package (with export inside) created: http://www.mxb.it/enigmahc/mxm_dataobject_new.zip Best regards, Angelo! On 30/08/2010 20:42, Boris Kolpackov wrote: > Hi Angelo, > > Boris Kolpackov writes: > > >> Ok, here is the binary for you to try: >> >> http://www.codesynthesis.com/~boris/tmp/xsd-4.0.0.a1-i686-windows.zip >> > If you already downloaded this, can you re-download it? I just discovered > that the binary was created with the wrong command and re-uploaded the > correct version. > > Boris > > From Daniel.Gustafsson at atollic.com Mon Sep 6 08:11:13 2010 From: Daniel.Gustafsson at atollic.com (Daniel Gustafsson) Date: Mon Sep 6 11:15:18 2010 Subject: [xsd-users] Support of sequence of choice elements Message-ID: Hi, I have a part in my xsd schema that looks like this That is, I have a list there Element_A and Elemet_B elements can be mixed as wanted. As I understand, in the xsd data model, my list will be represented as two separate lists; One list with the Element_A types and one list with the Element_B types. However, in my application the order of the elements in the list as they appear in the xml file are important. Does xsd support any way to iterate over my list and keep the order of the elements intact?? Or do I have to change the schema somehow? Regards, Daniel Gustafsson Daniel GUSTAFSSON Software Engineer, M.Sc.C.Sc. +46 (0)36 19 60 55 (direct) +46 (0)36 19 60 50 (main) daniel.gustafsson@atollic.com www.atollic.com Atollic AB Science Park J?nk?ping Gjuterigatan 9 SE-553 18 J?nk?ping Sweden IMPORTANT NOTICE: "The information in this email, including any attachments, may only be used by the intended recipient. If you received this email in error, please contact the sender and delete or destroy the material immediately. Thank you." From boris at codesynthesis.com Mon Sep 6 16:03:43 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Sep 6 15:20:13 2010 Subject: [xsd-users] Support of sequence of choice elements In-Reply-To: References: Message-ID: Hi Daniel, Daniel Gustafsson writes: > Does xsd support any way to iterate over my list and keep the order of > the elements intact? The following post describes various ways to resolve this: http://www.codesynthesis.com/pipermail/xsd-users/2010-March/002741.html Let me know if none of the proposed solutions work for you. Boris From nickhunteur at gmail.com Tue Sep 7 10:51:09 2010 From: nickhunteur at gmail.com (Nick Hunter) Date: Tue Sep 7 11:09:49 2010 Subject: [xsd-users] reading simple_type Message-ID: Hi, I have generated tree bindings for the following schema fragment: I wish to use the generated code to parse and print out the values saved from the following xml fragment: The " " schema definition has not been declared with a 'type' and so the StartUp member of the Feature class is an ::xml_schema::simple_type in the tree. The same can be seen for the Alias attribute. The problem I have run into is how to read the value "RenderingRootFeature" from the StartUp and Alias attributes. Is there a way to read a std::string from the ::xml_schema::simple_type? Thanks, Nick From boris at codesynthesis.com Tue Sep 7 12:05:35 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Sep 7 11:53:50 2010 Subject: [xsd-users] reading simple_type In-Reply-To: References: Message-ID: Hi Nick, Nick Hunter writes: > The " " schema definition > has not been declared with a 'type' and so the StartUp member of the Feature > class is an ::xml_schema::simple_type in the tree. > > The problem I have run into is how to read the value "RenderingRootFeature" > from the StartUp and Alias attributes. Is there a way to read a std::string > from the ::xml_schema::simple_type? No, not directly. In XML Schema, anySimpleType (which is mapped to xml_schema::simple_type) is a base type for all simple types so we cannot always store a "raw" representation there since the overhead would be too high (as a side note, in the next major release of XSD we are planning to re-design this implementation and map anySimpleType to two types: simple_type which will still be a, now abstract, base for all simple types and any_simple_type which will be used for attributes/elements that use anySimpleType; the any_simple_type type will have a string member containing the raw data). For now, there are two way to work around this. The simplest would be to modify your schema and add type="xsd:string" to all the attributes that miss the type declaration. The other approach is a bit more complicated and involves customizing xml_schema::simple_type. The advantage of this method is the ability to use the schema without any modifications. The following post describes how to do this (it talks about xml_schema::type but this also applies to xml_schema::simple_type): http://www.codesynthesis.com/pipermail/xsd-users/2009-October/002492.html Boris From tomasz.welman at pl.ibm.com Wed Sep 8 09:35:30 2010 From: tomasz.welman at pl.ibm.com (Tomasz Welman) Date: Wed Sep 8 09:36:13 2010 Subject: [xsd-users] xsd compilation problem Message-ID: Hi all, I have a problem compiling xsd, please have a look: > gmake using i386 using generic m4 /sith/twelman/xsd/xsd-3.3.0+dep/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx.m4 m4 /sith/twelman/xsd/xsd-3.3.0+dep/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx.m4 m4 /sith/twelman/xsd/xsd-3.3.0+dep/libcult/cult/cli/mapper.hxx.m4 c++ /sith/twelman/xsd/xsd-3.3.0+dep/xsd/xsd/xsd.cxx In file included from /sith/twelman/xsd/xsd-3.3.0+dep/libxsd-frontend/xsd-frontend/semantic-graph.hxx:20, from /sith/twelman/xsd/xsd-3.3.0+dep/libxsd-frontend/xsd-frontend/transformations/enum-synthesis.cxx:8, from /sith/twelman/xsd/xsd-3.3.0+dep/xsd/xsd/xsd.cxx:21: /sith/twelman/xsd/xsd-3.3.0+dep/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx:59: error: expected identifier before 'short' /sith/twelman/xsd/xsd-3.3.0+dep/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx:59: error: expected unqualified-id before ':' token /sith/twelman/xsd/xsd-3.3.0+dep/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx:85: error: expected identifier before 'int' /sith/twelman/xsd/xsd-3.3.0+dep/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx:85: error: expected unqualified-id before ':' token /sith/twelman/xsd/xsd-3.3.0+dep/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx:111: error: expected identifier before 'long' /sith/twelman/xsd/xsd-3.3.0+dep/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx:111: error: expected unqualified-id before ':' token /sith/twelman/xsd/xsd-3.3.0+dep/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx:215: error: expected identifier before 'float' /sith/twelman/xsd/xsd-3.3.0+dep/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx:215: error: expected unqualified-id before ':' token /sith/twelman/xsd/xsd-3.3.0+dep/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx:228: error: expected identifier before 'double' /sith/twelman/xsd/xsd-3.3.0+dep/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx:228: error: expected unqualified-id before ':' token In file included from /sith/twelman/xsd/xsd-3.3.0+dep/libxsd-frontend/xsd-frontend/traversal.hxx:19, from /sith/twelman/xsd/xsd-3.3.0+dep/libxsd-frontend/xsd-frontend/transformations/enum-synthesis.cxx:9, from /sith/twelman/xsd/xsd-3.3.0+dep/xsd/xsd/xsd.cxx:21: /sith/twelman/xsd/xsd-3.3.0+dep/libxsd-frontend/xsd-frontend/traversal/fundamental.hxx:25: error: 'Byte' is not a member of 'XSDFrontend::SemanticGraph::Fundamental' /sith/twelman/xsd/xsd-3.3.0+dep/libxsd-frontend/xsd-frontend/traversal/fundamental.hxx:25: error: 'Byte' is not a member of 'XSDFrontend::SemanticGraph::Fundamental' Anyone have any idea? Except of course the one that there is an error in fundamental.hxx:59. You cannot simply create a class that is called as an already existing type (short in this case). Either I didn't do some preprocessing or something else is wrong. Any ideas? -- Tomasz 'Trog' Welman Software Developer external: 48-12-628-9449 ITN: 34819449 T/L: 9449 IBM SWG Lab, Krakow, Poland IBM Polska Sp. z o.o. oddzia? w Krakowie ul. Armii Krajowej 18 30 -150 Krak?w NIP: 526-030-07-24, KRS 0000012941 Kapita? zak?adowy: 33.000.000 PLN From boris at codesynthesis.com Wed Sep 8 10:04:44 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Sep 8 09:52:45 2010 Subject: [xsd-users] xsd compilation problem In-Reply-To: References: Message-ID: Hi Tomasz, Tomasz Welman writes: > Except of course the one that there is an error in fundamental.hxx:59. You > cannot simply create a class that is called as an already existing type > (short in this case). These files are generated by m4 and you need to have GNU m4. Which versions are you using (m4 --version)? Here are the files generated using GNU m4 1.4.14: http://www.codesynthesis.com/~boris/tmp/fundamental.hxx http://www.codesynthesis.com/~boris/tmp/fundamental.cxx Boris From tomasz.welman at pl.ibm.com Wed Sep 8 09:59:14 2010 From: tomasz.welman at pl.ibm.com (Tomasz Welman) Date: Wed Sep 8 09:59:56 2010 Subject: [xsd-users] xsd compilation problem In-Reply-To: References: Message-ID: Boris Kolpackov wrote on 09/08/2010 04:04:44 PM: > Boris Kolpackov > > These files are generated by m4 and you need to have GNU m4. Which > versions are you using (m4 --version)? Here are the files generated > using GNU m4 1.4.14: > > http://www.codesynthesis.com/~boris/tmp/fundamental.hxx > http://www.codesynthesis.com/~boris/tmp/fundamental.cxx > Hmm, I'm actually compiling this on FreeBSD, and thus have no GNU m4, but native m4 (form FreeBSD). This is the problem for sure. Does anybody know some simple solution other than struggling with installing GNU m4 and forcing xsd to use this during build process? -- Tomasz 'Trog' Welman Software Developer external: 48-12-628-9449 ITN: 34819449 T/L: 9449 IBM SWG Lab, Krakow, Poland IBM Polska Sp. z o.o. oddzia? w Krakowie ul. Armii Krajowej 18 30 -150 Krak?w NIP: 526-030-07-24, KRS 0000012941 Kapita? zak?adowy: 33.000.000 PLN From boris at codesynthesis.com Wed Sep 8 10:28:32 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Sep 8 10:16:30 2010 Subject: [xsd-users] xsd compilation problem In-Reply-To: References: Message-ID: Hi Tomasz, Tomasz Welman writes: > Does anybody know some simple solution other than struggling with > installing GNU m4 and forcing xsd to use this during build process? Use the files I generated? http://www.codesynthesis.com/~boris/tmp/fundamental.hxx http://www.codesynthesis.com/~boris/tmp/fundamental.cxx Boris From tomasz.welman at pl.ibm.com Thu Sep 9 02:53:40 2010 From: tomasz.welman at pl.ibm.com (Tomasz Welman) Date: Thu Sep 9 02:54:23 2010 Subject: [xsd-users] xsd compilation problem [SOLVED] In-Reply-To: References: Message-ID: Boris Kolpackov wrote on 09/08/2010 04:28:32 PM: > Use the files I generated? > > http://www.codesynthesis.com/~boris/tmp/fundamental.hxx > http://www.codesynthesis.com/~boris/tmp/fundamental.cxx > I've just solved the problem easily. First what a FreeBSD user have to do is to install GNU m4 (/usr/ports/devel/m4), then download the xsd source with deps, and in: build-0.3/m4/m4.make change: $(out_base)/%: m4 := m4 to: $(out_base)/%: m4 := gm4 Then, just run gmake. Anyway it would be good to add to the documentation, section compilation dependencies: GNU m4. PS: Note that on FreeBSD boost is installed in /usr/local/include and that's different from linux, so before running gmake set the CPATH env variable to: /usr/local/include -- Tomasz 'Trog' Welman From fschmidt at techfak.uni-bielefeld.de Thu Sep 9 12:42:13 2010 From: fschmidt at techfak.uni-bielefeld.de (Florian Schmidt) Date: Thu Sep 9 12:42:17 2010 Subject: [xsd-users] External entity declaration in instance documents In-Reply-To: References: <4C76840A.70001@techfak.uni-bielefeld.de> <4C76EABF.9050401@techfak.uni-bielefeld.de> <4C76EC98.20304@techfak.uni-bielefeld.de> <4C77B30D.3030406@techfak.uni-bielefeld.de> <4C77B50C.8050409@techfak.uni-bielefeld.de> <4C77BF81.4040001@techfak.uni-bielefeld.de> Message-ID: <4C890E65.5030708@techfak.uni-bielefeld.de> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Boris Kolpackov wrote: > Hi Florian, > > Florian Schmidt writes: > >>> And indeed i found a spot in one of the used libs that sets up >>> xerces-c++ to use cached grammars. Let's see if i find a way to make it >>> not do this.. >> Hmm, this is all very weird. It seems to me that if the XSD functions >> set up the parsing not to use caching, then another lib using Xerces-C >> _with_ caching shouldn't interfere, as there shouldn't be shared global >> state (every xerces user calls Initialize() and creates their own parser). > > Yes, I also thought this is very strange. The caching is a per-parser > parameter and the library and XSD do not share parsers. Could it be > that it is the library that is printing the error message and not > the XSD error handler? I think i found the culprit.. Linking against libxqilla and creating an instance of XQilla (from the QXilla simple API) triggers the parsing failure on my system.. When i find time i might browse through some XQilla code to see what the constructor of the XQilla class does.. Regards, Flo - -- Dipl.-Inform. Florian Paul Schmidt University of Bielefeld, Neuroinformatics Group, CITEC Contact: http://ekvv.uni-bielefeld.de/pers_publ/publ/personDetailAct?id=5504453 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFMiQ5lTb4s+qNo4RIRAhdNAJ9KQCYqHYvHUKKkFQgEk56Gf+lwAwCcCHD/ AiFxjmuD7bvgvb//pdizEeE= =TNuS -----END PGP SIGNATURE----- From boris at codesynthesis.com Fri Sep 10 08:42:32 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Sep 10 08:29:55 2010 Subject: [xsd-users] xsd compilation problem [SOLVED] In-Reply-To: References: Message-ID: Hi Tomasz, Tomasz Welman writes: > I've just solved the problem easily. > First what a FreeBSD user have to do is to install GNU m4 > (/usr/ports/devel/m4), then download the xsd source with deps, > and in: > build-0.3/m4/m4.make > > change: > $(out_base)/%: m4 := m4 > to: > $(out_base)/%: m4 := gm4 > > Then, just run gmake. Great, thanks for sharing this! > Anyway it would be good to add to the documentation, section compilation > dependencies: GNU m4. The README file that comes with the xsd+dep package has this section: " The following GNU tools are required to build XSD. Any fairly recent GNU/Linux distribution should have these already installed: GNU bash >= 2.00 (bash --version) http://www.gnu.org/software/bash/ GNU m4 >= 1.4 (m4 --version) http://www.gnu.org/software/m4/ GNU make >= 3.81 (make --version) http://www.gnu.org/software/make/ GNU g++ >= 3.4.3 (g++ --version) http://gcc.gnu.org/ " Boris From timo.geusch at styleadvisor.com Thu Sep 16 18:02:11 2010 From: timo.geusch at styleadvisor.com (Timo Geusch) Date: Thu Sep 16 18:02:27 2010 Subject: [xsd-users] Issue with using xsd generated code in DLLs with Visual Studio 2010 Message-ID: I've run into an issue with using XSD-generated code in DLLs that build fine in VS2008 but fail with 'interesting' linker errors in VS2010. The project I'm working on contains multiple DLLs, several of which contains code that has been generated from XML schemas. Several of the classes generated by XSD are exported for use by code in other DLLs. All of this builds and works fine in VS2008. It looks like Microsoft did change the implementation of their standard library in VS2010 however, and as a side effect it appears that classes which derive from standard C++ classes like std::basic_string etc trigger an export of their base class's symbols. In other words, the class xsd::cxx::string as defined in cxx/tree/types.hxx results in the DLL exporting most of std::basic_string. Try to link two DLLs that both use and export a generated schema and the build will fail with the linker complaining about duplicate symbols. Please note that in this case it's actually an error and not a warning as you end up trying to link two DLLs that try to export the same symbols. This appears to be a known issue and there are several discussions about this on Microsoft Developer Center - one of them (with links to others) can be found here: http://social.msdn.microsoft.com/Forums/en/vclanguage/thread/191de00a-53c9-4bd9-9cb6-e844eb224ca2 Has anybody encountered this issue and if so, are there any suggested workarounds? The obvious one (not exporting the classes) is out as they do need to be accessed from other DLLs. Many thanks, Timo From boris at codesynthesis.com Fri Sep 17 09:40:49 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Sep 17 09:30:36 2010 Subject: [xsd-users] Issue with using xsd generated code in DLLs with Visual Studio 2010 In-Reply-To: References: Message-ID: Hi Timo, Timo Geusch writes: > It looks like Microsoft did change the implementation of their standard > library in VS2010 however, and as a side effect it appears that classes > which derive from standard C++ classes like std::basic_string etc trigger > an export of their base class's symbols. In other words, the class > xsd::cxx::string as defined in cxx/tree/types.hxx results in the DLL > exporting most of std::basic_string. Try to link two DLLs that both > use and export a generated schema and the build will fail with the > linker complaining about duplicate symbols. I think this can be resolved by exporting the types in the XML Schema namespace. Here is how this can be done: 1. Generate the XML Schema namespace headers with the --export-xml-schema and --export-symbol options, for example: xsd cxx-tree --generate-xml-schema --export-xml-schema \ --export-symbol XML_SCHEMA_EXPORT xml-schema.xsd 2. Place the generated file into a "root" DLL of your DLL hierarchy. By root I mean that this DLL will be used by all other DLLs that use XSD generated code. If no other C++ source file uses the xml-schema.hxx header in this DLL, then create a dummy file, say xml-schema.cxx, include xml-schema.hxx into it, and add it to the project (this will make sure the types are actually instantiated and exported). The XML_SCHEMA_EXPORT macro should expand to __declspec(dllexport) when building this DLL and to __declspec(dllimport) otherwise. Normally you would create the standard "export" header and include it into xml-schema.hxx with --hxx-prologue option. 3. Compile all your other schemas with the --extern-xml-schema xml-schema.xsd option so that they all use the header generated on step 1. Let me know if this works for you. Boris From MOKB0001 at e.ntu.edu.sg Mon Sep 20 09:32:11 2010 From: MOKB0001 at e.ntu.edu.sg (#MOK BAO REN CLARENCE#) Date: Mon Sep 20 12:32:23 2010 Subject: [xsd-users] Casting xsd:string to const char* Message-ID: <6FBAA36A6750314EA4B47FBDB98C707C1F490A50@SINPRD0103MB033.apcprd01.prod.exchangelabs.com> Hi guys, Im a newbie to C++ and XSD. Here goes my problem. This is what I am trying to do: char * featureDataName; featureDataName = new char[4000]; strcpy(featureDataName, reinterpret_cast( i->filename ()).c_str ); i->filename () returns a xsd:string and I am trying to store it into a char * string for further processing in my C++ application. This is the error I received: driver.cpp:44: error: invalid cast from type 'const xsd::cxx::tree::string >' to type 'const char*' Would love any kind help Regards, Clarence From boris at codesynthesis.com Mon Sep 20 12:50:55 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Sep 20 12:40:33 2010 Subject: [xsd-users] Casting xsd:string to const char* In-Reply-To: <6FBAA36A6750314EA4B47FBDB98C707C1F490A50@SINPRD0103MB033.apcprd01.prod.exchangelabs.com> References: <6FBAA36A6750314EA4B47FBDB98C707C1F490A50@SINPRD0103MB033.apcprd01.prod.exchangelabs.com> Message-ID: Hi Clarence, #MOK BAO REN CLARENCE# writes: > Im a newbie to C++ and XSD. Here goes my problem. Please note that this mailing list is not for questions about C++ usage. For help with C++ use one of the many mailing lists, forums, and newsgroups. > This is what I am trying to do: > > [...] > > i->filename () returns a xsd:string and I am trying to store it > into a char * string for further processing in my C++ application. std::string has a member function called c_str () that returns const char*. So you can do: const char* s = i->filename ().c_str (); Boris From timo.geusch at styleadvisor.com Mon Sep 20 15:48:23 2010 From: timo.geusch at styleadvisor.com (Timo Geusch) Date: Mon Sep 20 15:48:36 2010 Subject: [xsd-users] Issue with using xsd generated code in DLLs with Visual Studio 2010 In-Reply-To: References: Message-ID: Hi Boris, > -----Original Message----- > From: Boris Kolpackov [mailto:boris@codesynthesis.com] > Sent: Friday, September 17, 2010 6:41 AM > To: Timo Geusch > Cc: xsd-users@codesynthesis.com; Thomas Witt > Subject: Re: [xsd-users] Issue with using xsd generated code in DLLs > with Visual Studio 2010 > > Hi Timo, > > Timo Geusch writes: > > > It looks like Microsoft did change the implementation of their > standard > > library in VS2010 however, and as a side effect it appears that > classes > > which derive from standard C++ classes like std::basic_string etc > trigger > > an export of their base class's symbols. In other words, the class > > xsd::cxx::string as defined in cxx/tree/types.hxx results in the DLL > > exporting most of std::basic_string. Try to link two DLLs that both > > use and export a generated schema and the build will fail with the > > linker complaining about duplicate symbols. > > I think this can be resolved by exporting the types in the XML Schema > namespace. Here is how this can be done: [snip] > Let me know if this works for you. I've just tried this with a subset of the DLLs in the project. Unfortunately the suggested workaround still results in the same problem - the "root" DLL still exports symbols that are part of the std namespace - say, std::basic_string::front() that subsequently clashes with the same symbol in one of the 'leaf' DLLs because in the default build settings, the affected C++ classes are header-only. >From reading up on this issue on the various threads on the Microsoft site, it appears that the suggested workaround - well, the only one I have found so far - is to replace inheritance with composition. I'm not sure that this is the only way so I'll keep searching for an alternative, but for the time being I'm very open to other good ideas in this space. With best regards, Timo From fschmidt at techfak.uni-bielefeld.de Tue Sep 21 09:13:03 2010 From: fschmidt at techfak.uni-bielefeld.de (Florian Schmidt) Date: Tue Sep 21 09:13:07 2010 Subject: [xsd-users] External entity declaration in instance documents In-Reply-To: <4C890E65.5030708@techfak.uni-bielefeld.de> References: <4C76840A.70001@techfak.uni-bielefeld.de> <4C76EABF.9050401@techfak.uni-bielefeld.de> <4C76EC98.20304@techfak.uni-bielefeld.de> <4C77B30D.3030406@techfak.uni-bielefeld.de> <4C77B50C.8050409@techfak.uni-bielefeld.de> <4C77BF81.4040001@techfak.uni-bielefeld.de> <4C890E65.5030708@techfak.uni-bielefeld.de> Message-ID: <4C98AF5F.5060307@techfak.uni-bielefeld.de> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Florian Schmidt wrote: > Boris Kolpackov wrote: >> Hi Florian, > >> Florian Schmidt writes: > >>>> And indeed i found a spot in one of the used libs that sets up >>>> xerces-c++ to use cached grammars. Let's see if i find a way to make it >>>> not do this.. >>> Hmm, this is all very weird. It seems to me that if the XSD functions >>> set up the parsing not to use caching, then another lib using Xerces-C >>> _with_ caching shouldn't interfere, as there shouldn't be shared global >>> state (every xerces user calls Initialize() and creates their own parser). >> Yes, I also thought this is very strange. The caching is a per-parser >> parameter and the library and XSD do not share parsers. Could it be >> that it is the library that is printing the error message and not >> the XSD error handler? > > I think i found the culprit.. Linking against libxqilla and creating an > instance of XQilla (from the QXilla simple API) triggers the parsing > failure on my system.. When i find time i might browse through some > XQilla code to see what the constructor of the XQilla class does.. I'm at a loss here about how i could workaround that. I attached the test case you sent me a while ago modified to expose the problem. The only alteration is to link against libxqilla and creating an instance of XQilla in the main() function of the driver.cxx - -- Dipl.-Inform. Florian Paul Schmidt University of Bielefeld, Neuroinformatics Group, CITEC Contact: http://ekvv.uni-bielefeld.de/pers_publ/publ/personDetailAct?id=5504453 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFMmK9fTb4s+qNo4RIRAhsyAJ9mnu262s46ks2pEnFotPWZ4krvigCcDiuS 6UKAyYmNcv3ndo5LC2QuC70= =Po6g -----END PGP SIGNATURE----- -------------- next part -------------- A non-text attachment was scrubbed... Name: cbf-test.tgz Type: application/x-compressed-tar Size: 4043 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20100921/95a8c43f/cbf-test.bin From boris at codesynthesis.com Tue Sep 21 10:07:12 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Sep 21 09:56:41 2010 Subject: [xsd-users] Issue with using xsd generated code in DLLs with Visual Studio 2010 In-Reply-To: References: Message-ID: Hi Timo, Timo Geusch writes: > I've just tried this with a subset of the DLLs in the project. > Unfortunately the suggested workaround still results in the same > problem - the "root" DLL still exports symbols that are part of > the std namespace - say, std::basic_string::front() that > subsequently clashes with the same symbol in one of the 'leaf' > DLLs Are the clashing symbols in the leaf DLL also exported? My understanding of how all this can work is as follows: 1. In the root DLL the XML Schema types are exported which triggers instantiation and exporting of types that they derive from, e.g., std::basic_string. 2. The leaf DLL includes the XML Schema types from the root DLL but now they are imported. The base classes are imported as well so the leaf DLL uses them from the root DLL instead of instantiating its own. The only tricky part here is that this may rely on the XML Schema types being included into every C++ file in the leaf DLL. If there is a C++ file that doesn't know anything about XML Schema types (and as a result, that std::basic_string is imported), then it can instantiate the class which can lead to the symbol clash. However, even in this case, I think (though not 100% sure) that there shouldn't be a clash since those symbols are not exported. They are for leaf's DLL private use. I would expect two template- based symbols to clash only if both symbols are exported. So what would be good to understand is whether the symbols from the leaf DLL that clash are exported and where do they come from. > because in the default build settings, the affected C++ classes > are header-only. Which classes are referring to? I am not sure I follow you here. Boris From timo.geusch at styleadvisor.com Wed Sep 22 19:14:14 2010 From: timo.geusch at styleadvisor.com (Timo Geusch) Date: Wed Sep 22 19:14:27 2010 Subject: [xsd-users] Issue with using xsd generated code in DLLs with Visual Studio 2010 In-Reply-To: References: Message-ID: Hi Boris, > -----Original Message----- > From: Boris Kolpackov [mailto:boris@codesynthesis.com] > Sent: Tuesday, September 21, 2010 7:07 AM > To: Timo Geusch > Cc: xsd-users@codesynthesis.com; Thomas Witt > Subject: Re: [xsd-users] Issue with using xsd generated code in DLLs > with Visual Studio 2010 > > Hi Timo, > > Timo Geusch writes: > > > I've just tried this with a subset of the DLLs in the project. > > Unfortunately the suggested workaround still results in the same > > problem - the "root" DLL still exports symbols that are part of > > the std namespace - say, std::basic_string::front() that > > subsequently clashes with the same symbol in one of the 'leaf' > > DLLs > > Are the clashing symbols in the leaf DLL also exported? It doesn't get that far - the link stage of the build aborts before it completes due to the duplicate symbols that are both exported by the root DLL and present in the leaf DLL's object files. I have a very minimal test project here that consists of two DLLs, a root DLL and a leaf DLL. The leaf DLL needs to link with the import library of the root DLL; If the root DLL contains an exported class that derives from std::string _and_ the leaf DLL makes use of std::string, the link stage for the leaf DLL will fail due to the root DLL exporting the symbols for std::string which have also been instantiated in the leaf DLL's object files. So this is not a problem specific to libxsd but rather a general issue. > My understanding of how all this can work is as follows: > > 1. In the root DLL the XML Schema types are exported which > triggers instantiation and exporting of types that they > derive from, e.g., std::basic_string. > > 2. The leaf DLL includes the XML Schema types from the root > DLL but now they are imported. The base classes are > imported as well so the leaf DLL uses them from the root > DLL instead of instantiating its own. > > The only tricky part here is that this may rely on the XML Schema > types being included into every C++ file in the leaf DLL. If > there is a C++ file that doesn't know anything about XML Schema > types (and as a result, that std::basic_string is imported), > then it can instantiate the class which can lead to the symbol > clash. Not quite. The DLLs we're talking about here make quite extensive use of the standard C++ library classes, including those that Microsoft changed. So, say the root DLL is built and exports these symbols (that are now not part of the C++ runtime lib/dll anymore like they were in VS2008, but are now header-only). Then you build one of the leaf DLLs which also uses, say, std::basic_string in its various incarnations. As we're talking header only here, the leaf dll also creates instantiations of these symbols in the object files. When you then try to link the leaf DLL you'll end up in the unfortunate situation that the linker sees a conflict between the symbols present in the object files that it is attempting to link and the root DLL it is also attempting to link to. The VS2010 linker is not able to resolve this conflict and as a result, none of the leaf DLLs link, even though they compile. > > because in the default build settings, the affected C++ classes > > are header-only. > > Which classes are referring to? I am not sure I follow you here. std::basic_string and its permutations, from memory some of the stream classes are also affected. The link I included in my original email should contain links to a few additional bug reports that give at least a partial view of which classes are affected. In our case it's mainly std::basic_string/std::string. With best regards, Timo From timo.geusch at styleadvisor.com Wed Sep 22 21:12:57 2010 From: timo.geusch at styleadvisor.com (Timo Geusch) Date: Wed Sep 22 21:13:11 2010 Subject: [xsd-users] Issue with using xsd generated code in DLLs with Visual Studio 2010 In-Reply-To: References: Message-ID: > > -----Original Message----- > > From: Boris Kolpackov [mailto:boris@codesynthesis.com] > > Sent: Tuesday, September 21, 2010 7:07 AM > > To: Timo Geusch > > Cc: xsd-users@codesynthesis.com; Thomas Witt > > Subject: Re: [xsd-users] Issue with using xsd generated code in DLLs > > with Visual Studio 2010 > > > > Hi Timo, > > > > Timo Geusch writes: > > > > > I've just tried this with a subset of the DLLs in the project. > > > Unfortunately the suggested workaround still results in the same > > > problem - the "root" DLL still exports symbols that are part of > > > the std namespace - say, std::basic_string::front() that > > > subsequently clashes with the same symbol in one of the 'leaf' > > > DLLs > > > > Are the clashing symbols in the leaf DLL also exported? > > It doesn't get that far - the link stage of the build aborts before it > completes due to the duplicate symbols that are both exported by the > root DLL and present in the leaf DLL's object files. > > I have a very minimal test project here that consists of two DLLs, a > root DLL and a leaf DLL. The leaf DLL needs to link with the import > library of the root DLL; If the root DLL contains an exported class > that derives from std::string _and_ the leaf DLL makes use of > std::string, the link stage for the leaf DLL will fail due to the root > DLL exporting the symbols for std::string which have also been > instantiated in the leaf DLL's object files. So this is not a problem > specific to libxsd but rather a general issue. After some more experimentation, it seems that the change in the std::string implementation in VS2010 exposed behaviour that is also present in the VS2008 toolchain. If the following conditions are met, the linker will complain of duplicate symbols and not be able to link the leaf DLL: 1) You derive an exported class from a non-exported header-only base class in the root DLL 2) You do the same in the leaf DLL 3) You also make use of the base class in the leaf DLL so the compiler actually has a reason to create an instance of the base class in the leaf DLL The reason that this doesn't appear to be an issue in VS2008 when deriving from std::string is that in VS2008, std::string is not header-only. With best regards, Timo From boris at codesynthesis.com Thu Sep 23 12:37:12 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Sep 23 12:26:28 2010 Subject: [xsd-users] Issue with using xsd generated code in DLLs with Visual Studio 2010 In-Reply-To: References: Message-ID: Hi Timo, Boris Kolpackov writes: > Are the clashing symbols in the leaf DLL also exported? Ok, I played a bit with the test project that you sent me off-list. Here is what I found: The setup: 1. root.h in root.dll defines and exports class root that inherits from base 2. leaf.h in lead.dll defines and exports class leaf that inherits from base; leaf.dll links root.dll 3. private.cpp in leaf.dll uses base without exporting it The findings: 1. If leaf.h does not include root.h then we get symbol clashes. This is not really surprising since both root.dll and leaf.dll export base symbols. 2. If private.cpp does not include root.h we also get symbol clashes. This is somewhat surprising to me since we normally expect the C++ compilation system to weed out duplicate symbols resulting from template instantiations. But it appears that the MS tool- chain only does this if both symbols are not exported. If at least one of them is exported, we get symbol clashes. What is even more surprising is that this appears to work when linking an executable. If we have private.cpp in an executable that links to root.dll, there are no symbol clashes. 3. If we include root.h in leaf.h prior to defining class leaf, then root.h sees it as imported from root.dll and uses that symbol instead of instantiating its own. In other words, the MS toolchain will automatically export unexported base class *unless* it is imported. This is expected. 4. Similarly, if we include root.h in private.cpp prior to using base then the same thing happens, no symbol clashes. Now, how does this apply to the XSD-generated types? The types in the XML Schema namespace derive from std::basic_string which can cause this problem. The way to resolve this is to place these types into the root DLL and export them so that we have a setup similar to the one described above. I have listed the steps needed to achieve this in one of my earlier emails. The important part here is that all other DLLs (leaf DLLs) that contain XSD-generated code must use the --extern-xml-schema option when compiling the schemas. If even one schema is compiled without this option, the whole thing will break up. Now we have two possible situations: leaf.dll has other classes that it exports that also inherit from std::basic_string (note that this cannot be XSD-generated code if --extern-xml-schema was used consistently). Or it doesn't. In the former case we will have to include the xml-schema.hxx header into the header files defining such classes. Ugly but seems the only way (well, actually, one can create a special header or even a DLL that just exports std::basic_string and use that instead of xml-schema.hxx). In the latter case we need to include xml-schema.hxx into every .cpp file that uses std::string. If the project uses precompiled headers, stdafx.h is a good place to do this. This case is less ugly since the xml-schema.hxx inclusion is the DLL's implementation details. Boris From peddimahesh at gmail.com Wed Sep 29 08:24:07 2010 From: peddimahesh at gmail.com (=?UTF-8?B?4K6u4K6V4K+H4K634K+NLi4uLi4uLiDgsK7gsLngsYfgsLfgsY0uLi4uLi4gTWFoZXNo?=) Date: Wed Sep 29 08:24:13 2010 Subject: [xsd-users] Need Help!! Message-ID: Hi, Greetings for the day!! I am using code synthesis to convert schema files to c++ objects. When I tested with examples provided with tool it sounds good. I am facing problem when i test with my sample xml file ===================================n ===================== Tove Jani Reminder Don't forget me this weekend! ======================================================== I have converted this xml to xml schema i.e. xsd using hitssw its online tool from http://www.hitsw.com/xml_utilites/ ======================================================== ======================================================== I have project in visual studio 2008 and when I build this project I am getting some errors ======================================================== Error 41 fatal error LNK1120: 39 unresolved externals C:\Documents and Settings\mpeddi\Desktop\Sample\Sample\Debug\Sample.exe Error 37 error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall xercesc_3_1::Wrapper4InputSource::~Wrapper4InputSource(void)" (__imp_??1Wrapper4InputSource@xercesc_3_1@@UAE@XZ) referenced in function __catch$??$parse@D@dom@xml@cxx@xsd@@YA?AU?$auto_ptr@VDOMDocument @xercesc_3_1@@@0123@AAVInputSource@xercesc_3_1@@AAVDOMErrorHandler@6 @ABV?$properties@D@123@K@Z$0 Sample.obj Error 19 error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall xercesc_3_1::InputSource::~InputSource(void)" (__imp_??1InputSource@xercesc_3_1@@UAE@XZ) referenced in function "public: virtual __thiscall xsd::cxx::xml::sax::std_input_source::~std_input_source(void)" (??1std_input_source@sax@xml@cxx@xsd@@UAE@XZ) Sample.obj Error 39 error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall xercesc_3_1::DOMErrorHandler::~DOMErrorHandler(void)" (__imp_??1DOMErrorHandler@xercesc_3_1@@UAE@XZ) referenced in function "public: virtual __thiscall xsd::cxx::xml::dom::bits::error_handler_proxy::~error_handler_proxy(void)" (??1?$error_handler_proxy@D@bits@dom@xml@cxx@xsd@@UAE@XZ) Sample.obj Error 18 error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall xercesc_3_1::BinInputStream::~BinInputStream(void)" (__imp_??1BinInputStream@xercesc_3_1@@UAE@XZ) referenced in function "public: virtual __thiscall xsd::cxx::xml::sax::std_input_stream::~std_input_stream(void)" (??1std_input_stream@sax@xml@cxx@xsd@@UAE@XZ) Sample.obj Error 4 error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl xercesc_3_1::XMLPlatformUtils::Terminate(void)" (__imp_?Terminate@XMLPlatformUtils@xercesc_3_1@@SAXXZ) referenced in function "void __cdecl xsd::cxx::xml::terminate(void)" (?terminate@xml @cxx@xsd@@YAXXZ) Sample.obj Error 2 error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl xercesc_3_1::XMLPlatformUtils::Initialize(char const * const,char const * const,class xercesc_3_1::PanicHandler * const,class xercesc_3_1::MemoryManager * const)" (__imp_?Initialize@XMLPlatformUtils @xercesc_3_1@@SAXQBD0QAVPanicHandler@2@QAVMemoryManager@2@@Z) referenced in function "void __cdecl xsd::cxx::xml::initialize(void)" (?initialize@xml @cxx@xsd@@YAXXZ) Sample.obj Error 15 error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl xercesc_3_1::XMemory::operator delete(void *)" (__imp_??3XMemory@xercesc_3_1 @@SAXPAX@Z) referenced in function __unwindfunclet$?makeStream@std_input_source@sax@xml@cxx@xsd @@UBEPAVBinInputStream@xercesc_3_1@@XZ$0 Sample.obj Error 16 error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void * __cdecl xercesc_3_1::XMemory::operator new(unsigned int)" (__imp_??2XMemory@xercesc_3_1@@SAPAXI@Z) referenced in function "public: virtual class xercesc_3_1::BinInputStream * __thiscall xsd::cxx::xml::sax::std_input_source::makeStream(void)const " (?makeStream@std_input_source@sax@xml@cxx@xsd @@UBEPAVBinInputStream@xercesc_3_1@@XZ) Sample.obj Error 20 error LNK2019: unresolved external symbol "__declspec(dllimport) public: static unsigned long __cdecl xercesc_3_1::XMLString::stringLen(wchar_t const * const)" (__imp_?stringLen@XMLString@xercesc_3_1@@SAKQB_W@Z) referenced in function "class std::basic_string,class std::allocator > __cdecl xsd::cxx::xml::transcode(wchar_t const *)" (??$transcode@D@xml@cxx@xsd@@YA?AV?$basic_string@DU?$char_traits@D@std@ @V?$allocator@D@2@@std@@PB_W@Z) Sample.obj Error 35 error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class xercesc_3_1::DOMImplementation * __cdecl xercesc_3_1::DOMImplementationRegistry::getDOMImplementation(wchar_t const *)" (__imp_?getDOMImplementation@DOMImplementationRegistry @xercesc_3_1@@SAPAVDOMImplementation@2@PB_W@Z) referenced in function "struct xsd::cxx::xml::dom::auto_ptr __cdecl xsd::cxx::xml::dom::parse(class std::basic_string,class std::allocator > const &,class xercesc_3_1::DOMErrorHandler &,class xsd::cxx::xml::properties const &,unsigned long)" (??$parse@D@dom@xml@cxx@xsd@@YA?AU?$auto_ptr@VDOMDocument @xercesc_3_1@@@0123@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D @2@@std@@AAVDOMErrorHandler@xercesc_3_1@@ABV?$properties@D@123@K@Z) Sample.obj Error 38 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall xercesc_3_1::Wrapper4InputSource::Wrapper4InputSource(class xercesc_3_1::InputSource * const,bool,class xercesc_3_1::MemoryManager * const)" (__imp_??0Wrapper4InputSource@xercesc_3_1@@QAE@QAVInputSource@1@ _NQAVMemoryManager@1@@Z) referenced in function "struct xsd::cxx::xml::dom::auto_ptr __cdecl xsd::cxx::xml::dom::parse(class xercesc_3_1::InputSource &,class xercesc_3_1::DOMErrorHandler &,class xsd::cxx::xml::properties const &,unsigned long)" (??$parse@D@dom@xml@cxx@xsd@@YA?AU?$auto_ptr@VDOMDocument @xercesc_3_1@@@0123@AAVInputSource@xercesc_3_1@@AAVDOMErrorHandler@6 @ABV?$properties@D@123@K@Z) Sample.obj Error 36 error LNK2019: unresolved external symbol "__declspec(dllimport) protected: __thiscall xercesc_3_1::InputSource::InputSource(wchar_t const * const,class xercesc_3_1::MemoryManager * const)" (__imp_??0InputSource@xercesc_3_1 @@IAE@QB_WQAVMemoryManager@1@@Z) referenced in function "public: __thiscall xsd::cxx::xml::sax::std_input_source::std_input_source(class std::basic_istream > &,class std::basic_string,class std::allocator > const &)" (??$?0D@std_input_source@sax@xml@cxx@xsd @@QAE@AAV?$basic_istream@DU?$char_traits@D@std@@@std@@ABV?$basic_string@DU ?$char_traits@D@std@@V?$allocator@D@2@@6@@Z) Sample.obj Error 5 error LNK2019: unresolved external symbol "__declspec(dllimport) protected: __thiscall xercesc_3_1::InputSource::InputSource(class xercesc_3_1::MemoryManager * const)" (__imp_??0InputSource@xercesc_3_1@@IAE@QAVMemoryManager@1@@Z) referenced in function "public: __thiscall xsd::cxx::xml::sax::std_input_source::std_input_source(class std::basic_istream > &)" (??0std_input_source@sax@xml@cxx@xsd@@QAE@AAV?$basic_istream@DU ?$char_traits@D@std@@@std@@@Z) Sample.obj Error 40 error LNK2019: unresolved external symbol "__declspec(dllimport) protected: __thiscall xercesc_3_1::DOMErrorHandler::DOMErrorHandler(void)" (__imp_??0DOMErrorHandler@xercesc_3_1@@IAE@XZ) referenced in function "public: __thiscall xsd::cxx::xml::dom::bits::error_handler_proxy::error_handler_proxy(class xsd::cxx::xml::error_handler &)" (??0?$error_handler_proxy@D@bits@dom @xml@cxx@xsd@@QAE@AAV?$error_handler@D@345@@Z) Sample.obj Error 17 error LNK2019: unresolved external symbol "__declspec(dllimport) protected: __thiscall xercesc_3_1::BinInputStream::BinInputStream(void)" (__imp_??0BinInputStream@xercesc_3_1@@IAE@XZ) referenced in function "public: __thiscall xsd::cxx::xml::sax::std_input_stream::std_input_stream(class std::basic_istream > &)" (??0std_input_stream@sax@xml@cxx@xsd@@QAE@AAV?$basic_istream@DU ?$char_traits@D@std@@@std@@@Z) Sample.obj Error 9 error LNK2001: unresolved external symbol "public: virtual wchar_t const * __thiscall xercesc_3_1::InputSource::getSystemId(void)const " (?getSystemId@InputSource@xercesc_3_1@@UBEPB_WXZ) Sample.obj Error 8 error LNK2001: unresolved external symbol "public: virtual wchar_t const * __thiscall xercesc_3_1::InputSource::getPublicId(void)const " (?getPublicId@InputSource@xercesc_3_1@@UBEPB_WXZ) Sample.obj Error 7 error LNK2001: unresolved external symbol "public: virtual wchar_t const * __thiscall xercesc_3_1::InputSource::getEncoding(void)const " (?getEncoding@InputSource@xercesc_3_1@@UBEPB_WXZ) Sample.obj Error 13 error LNK2001: unresolved external symbol "public: virtual void __thiscall xercesc_3_1::InputSource::setSystemId(wchar_t const * const)" (?setSystemId@InputSource@xercesc_3_1@@UAEXQB_W@Z) Sample.obj Error 12 error LNK2001: unresolved external symbol "public: virtual void __thiscall xercesc_3_1::InputSource::setPublicId(wchar_t const * const)" (?setPublicId@InputSource@xercesc_3_1@@UAEXQB_W@Z) Sample.obj Error 14 error LNK2001: unresolved external symbol "public: virtual void __thiscall xercesc_3_1::InputSource::setIssueFatalErrorIfNotFound(bool)" (?setIssueFatalErrorIfNotFound@InputSource@xercesc_3_1@@UAEX_N@Z) Sample.obj Error 11 error LNK2001: unresolved external symbol "public: virtual void __thiscall xercesc_3_1::InputSource::setEncoding(wchar_t const * const)" (?setEncoding@InputSource@xercesc_3_1@@UAEXQB_W@Z) Sample.obj Error 10 error LNK2001: unresolved external symbol "public: virtual bool __thiscall xercesc_3_1::InputSource::getIssueFatalErrorIfNotFound(void)const " (?getIssueFatalErrorIfNotFound@InputSource@xercesc_3_1@@UBE_NXZ) Sample.obj Error 25 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_1::XMLUni::fgXercesUserAdoptsDOMDocument" (__imp_?fgXercesUserAdoptsDOMDocument@XMLUni@xercesc_3_1@@2QB_WB) Sample.obj Error 27 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_1::XMLUni::fgXercesSchemaFullChecking" (__imp_?fgXercesSchemaFullChecking@XMLUni@xercesc_3_1@@2QB_WB) Sample.obj Error 24 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_1::XMLUni::fgXercesSchemaExternalSchemaLocation" (__imp_?fgXercesSchemaExternalSchemaLocation@XMLUni@xercesc_3_1@@2QB_WB) Sample.obj Error 23 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_1::XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation" (__imp_?fgXercesSchemaExternalNoNameSpaceSchemaLocation@XMLUni@xercesc_3_1@@2QB_WB) Sample.obj Error 28 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_1::XMLUni::fgXercesSchema" (__imp_?fgXercesSchema@XMLUni @xercesc_3_1@@2QB_WB) Sample.obj Error 22 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_1::XMLUni::fgXercesLoadSchema" (__imp_?fgXercesLoadSchema@XMLUni @xercesc_3_1@@2QB_WB) Sample.obj Error 26 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_1::XMLUni::fgXercesHandleMultipleImports" (__imp_?fgXercesHandleMultipleImports@XMLUni@xercesc_3_1@@2QB_WB) Sample.obj Error 29 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_1::XMLUni::fgDOMValidate" (__imp_?fgDOMValidate@XMLUni @xercesc_3_1@@2QB_WB) Sample.obj Error 31 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_1::XMLUni::fgDOMNamespaces" (__imp_?fgDOMNamespaces@XMLUni @xercesc_3_1@@2QB_WB) Sample.obj Error 21 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_1::XMLUni::fgDOMErrorHandler" (__imp_?fgDOMErrorHandler@XMLUni @xercesc_3_1@@2QB_WB) Sample.obj Error 32 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_1::XMLUni::fgDOMEntities" (__imp_?fgDOMEntities@XMLUni @xercesc_3_1@@2QB_WB) Sample.obj Error 30 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_1::XMLUni::fgDOMElementContentWhitespace" (__imp_?fgDOMElementContentWhitespace@XMLUni@xercesc_3_1@@2QB_WB) Sample.obj Error 33 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_1::XMLUni::fgDOMDatatypeNormalization" (__imp_?fgDOMDatatypeNormalization@XMLUni@xercesc_3_1@@2QB_WB) Sample.obj Error 34 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_1::XMLUni::fgDOMComments" (__imp_?fgDOMComments@XMLUni @xercesc_3_1@@2QB_WB) Sample.obj Error 6 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class xercesc_3_1::MemoryManager * xercesc_3_1::XMLPlatformUtils::fgMemoryManager" (__imp_?fgMemoryManager@XMLPlatformUtils@xercesc_3_1@@2PAVMemoryManager@2@A) Sample.obj Error 3 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static char const * const xercesc_3_1::XMLUni::fgXercescDefaultLocale" (__imp_?fgXercescDefaultLocale@XMLUni@xercesc_3_1@@2QBDB) Sample.obj ======================================================== Do you have any tool which converts xml to xml schema? Thanks, Mahesh From boris at codesynthesis.com Wed Sep 29 10:36:28 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Sep 29 10:25:07 2010 Subject: [xsd-users] ODB - compiler-based ORM system for C++ Message-ID: Hi, We just announced our new project, ODB, and I thought some of you might be interested: ODB is an open-source, compiler-based object-relational mapping (ORM) system for C++. It allows you to persist C++ objects to a relational database without having to deal with tables, columns, or SQL and without manually writing any mapping code. For example: #pragma db object class person { ... private: friend class odb::access; person (); #pragma db id auto unsigned long id_; string first_; string last_; unsigned short age_; }; ODB is not a framework. It does not dictate how you should write your application. Rather, it is designed to fit into your style and architecture by only handling C++ object persistence and not interfering with any other functionality. As you can see, existing classes can be made persistent with only a few modifications. Given the above class, we can perform various database operations with its objects: person john ("John", "Doe", 31); person jane ("Jane", "Doe", 29); transaction t (db.begin ()); db.persist (john); db.persist (jane); result r (db.query (query::last == "Doe" && query::age < 30)); copy (r.begin (), r.end (), ostream_iterator (cout, "\n")); jane.age (jane.age () + 1); db.update (jane); t.commit (); The C++ code that performs the conversion between persistent classes and their database representation is automatically generated by the ODB compiler. The ODB compiler is a real C++ compiler except that it produces C++ instead of assembly or machine code. In particular, it is not an ad-hoc header pre-processor that is only capable of recognizing a subset of C++. ODB is capable of handling any standard C++ code. The ODB compiler uses the GCC compiler frontend for C++ parsing and is implemented using the new GCC plugin architecture. While ODB uses GCC internally, its output is standard C++ which means that you can use any C++ compiler to build your application. ODB is written in portable C++ and you should be able to use it with any modern C++ compiler. In particular, we have tested this release on GNU/Linux (x86/x86-64), Windows (x86/x86-64), Mac OS X, and Solaris (x86/x86-64/SPARC) with GNU g++ 4.2.x-4.5.x, MS Visual C++ 2008 and 2010, and Sun Studio 12. The dependency-free ODB compiler binaries are available for all of the above platforms. The initial release supports MySQL as the underlying database. Support for other database systems is in the works. More information, documentation, source code, and pre-compiled binaries are available from: http://www.codesynthesis.com/products/odb/ Enjoy, Boris From boris at codesynthesis.com Thu Sep 30 12:10:35 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Sep 30 11:59:08 2010 Subject: [xsd-users] Need Help!! In-Reply-To: References: Message-ID: Hi Peddi, Peddi Mahesh writes: > xsi:noNamespaceSchemaLocation="sample.xsd"> > Tove > Jani > Reminder > Don't forget me this weekend! > > > [...] > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > That tool did a pretty poor job. It seems it doesn't know anything about types in the XML Schema namespace ;-). Here how I would write this schema: > I have project in visual studio 2008 and when I build this project I am > getting some errors > > Error 37 error LNK2019: unresolved external symbol > "__declspec(dllimport) public: virtual __thiscall > xercesc_3_1::Wrapper4InputSource::~Wrapper4InputSource(void)" These symbols are defined in the Xerces-C++ library. I am pretty sure you forgot to link your application to it. See step 9 in the Section for Visual Studio 2008 in the "Using XSD with Microsoft Visual Studio" Wiki page: http://wiki.codesynthesis.com/Using_XSD_with_Microsoft_Visual_Studio > Do you have any tool which converts xml to xml schema? I just saw this tool, called xsd-gen, that says it does it. I haven't tried it myself yet, so I don't know if it is any good: http://code.google.com/p/xsd-gen/ Boris