From Farhat.Latrach at sc.com Mon Jun 1 05:13:46 2015 From: Farhat.Latrach at sc.com (Latrach, Farhat) Date: Mon Jun 1 06:29:00 2015 Subject: [xsd-users] wildcard namespaces Message-ID: <7F6839155D74054CB0971462A215DAC9254A26B6@HKWPIPXMB01C> Hi Boris, I have had an issue parsing "wildcard" elements when the namespaces mappings used in the wildcard element are defined in a parent element. I do agree with the design of expecting the wildcard element to be independent and contains its proper namespaces/ or namespaces mapping; This was not easy for me to agree on with the sender. To resolve the issue I managed to parse in a DOMDocument then add them to the wildcard's DOMElement. Here is my workaround: xsd::cxx::xml::dom::auto_ptr doc .... ..... ..... //wildcard ::xercesc::DOMElement& wildcard = xmlRequest->payload().any(); ::xercesc::DOMElement* rootElement = doc.get()->getDocumentElement(); DOMNamedNodeMap* theAttributes = rootElement ->getAttributes(); // namespaces are always expected at root (my specific case) for ( size_t i =0 ; i < theAttributes->getLength (); i ++ ) { DOMNode* rootNode = theAttributes ->item(i); if ( xsd::cxx::xml::transcode( rootNode ->getNodeName() ).find("xmlns") != std::basic_string::npos ) { wildcard. setAttributeNS( xsd::cxx::xml::string("http://www.w3.org/2000/xmlns/").c_str(), rootNode ->getNodeName(), rootNode->getNodeValue() ); } } Is there a better way? Is it possible to have an xml_schema::namespace_infomap in the generated cxx-tree parsing functions like a reference to an empty map to be populated(suggestion)? Thanks. This email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please delete all copies and notify the sender immediately. You may wish to refer to the incorporation details of Standard Chartered PLC, Standard Chartered Bank and their subsidiaries at https://www.sc.com/en/incorporation-details.html From boris at codesynthesis.com Mon Jun 1 14:02:21 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jun 1 14:02:31 2015 Subject: [xsd-users] wildcard namespaces In-Reply-To: <7F6839155D74054CB0971462A215DAC9254A26B6@HKWPIPXMB01C> References: <7F6839155D74054CB0971462A215DAC9254A26B6@HKWPIPXMB01C> Message-ID: Hi Farhat, Latrach, Farhat writes: > I have had an issue parsing "wildcard" elements when the namespaces > mappings used in the wildcard element are defined in a parent element. I am not sure I understand why this is an "issue"? Does the generated code fail to extract the wildcard content in such a case and if so, what exactly is wrong? I would expect the necessary prefix-namespace mappings to be imported as part of the DOM element import. Boris From farhat.latrach at gmail.com Mon Jun 1 18:55:04 2015 From: farhat.latrach at gmail.com (Farhat Latrach) Date: Mon Jun 1 18:55:15 2015 Subject: [xsd-users] wildcard namespaces In-Reply-To: References: <7F6839155D74054CB0971462A215DAC9254A26B6@HKWPIPXMB01C> Message-ID: <97C968BC-1DAA-4CA5-860F-5C88EFF845F9@gmail.com> Hi Boris, Yes the generated code fails to extract the wildcard content. The exception is related to the prefix namespace mappings. Sent from my iPhone > On 2 Jun 2015, at 2:02 am, Boris Kolpackov wrote: > > Hi Farhat, > > Latrach, Farhat writes: > >> I have had an issue parsing "wildcard" elements when the namespaces >> mappings used in the wildcard element are defined in a parent element. > > I am not sure I understand why this is an "issue"? Does the generated > code fail to extract the wildcard content in such a case and if so, > what exactly is wrong? > > I would expect the necessary prefix-namespace mappings to be imported > as part of the DOM element import. > > Boris > From Farhat.Latrach at sc.com Mon Jun 1 18:56:58 2015 From: Farhat.Latrach at sc.com (Latrach, Farhat) Date: Tue Jun 2 05:59:49 2015 Subject: [xsd-users] wildcard namespaces In-Reply-To: References: <7F6839155D74054CB0971462A215DAC9254A26B6@HKWPIPXMB01C>, Message-ID: <5228F89A-4DD1-4AEC-9BE3-FE8B8BBA91E6@sc.com> Hi Boris, Yes the generated code fails to extract the wildcard content. The exception is related to the prefix namespace mappings. Sent from my iPhone > On 2 Jun 2015, at 2:02 am, Boris Kolpackov wrote: > > Hi Farhat, > > Latrach, Farhat writes: > >> I have had an issue parsing "wildcard" elements when the namespaces >> mappings used in the wildcard element are defined in a parent element. > > I am not sure I understand why this is an "issue"? Does the generated > code fail to extract the wildcard content in such a case and if so, > what exactly is wrong? > > I would expect the necessary prefix-namespace mappings to be imported > as part of the DOM element import. > > Boris This email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please delete all copies and notify the sender immediately. You may wish to refer to the incorporation details of Standard Chartered PLC, Standard Chartered Bank and their subsidiaries at https://www.sc.com/en/incorporation-details.html From boris at codesynthesis.com Tue Jun 2 06:01:56 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jun 2 06:02:05 2015 Subject: [xsd-users] wildcard namespaces In-Reply-To: <97C968BC-1DAA-4CA5-860F-5C88EFF845F9@gmail.com> References: <7F6839155D74054CB0971462A215DAC9254A26B6@HKWPIPXMB01C> <97C968BC-1DAA-4CA5-860F-5C88EFF845F9@gmail.com> Message-ID: Hi Farhat, Farhat Latrach writes: > Yes the generated code fails to extract the wildcard content. > The exception is related to the prefix namespace mappings. Interesting. Would you be able to send me a test case that reproduces this? That is, the schema, xml file, and a test driver. This should definitely work out of the box so I would like to fix it. Boris From Farhat.Latrach at sc.com Tue Jun 2 07:54:37 2015 From: Farhat.Latrach at sc.com (Latrach, Farhat) Date: Wed Jun 3 15:03:21 2015 Subject: [xsd-users] wildcard namespaces In-Reply-To: References: Message-ID: <7F6839155D74054CB0971462A215DAC93057A3AC@HKWPIPXMB01A> Hi Boris, Here is a test case: Xml: .......... C++ code: auto_ptr xmlRequest (hhml::HHML_( argv[1], xml_schema::flags::dont_validate) ); //successful std::cout << *xmlRequest << std::endl; //shows all elements except the wildcard ::xercesc::DOMElement &e = xmlRequest->payload().any(); hhml::FPMLPayloadListType fpmlPayLoadsList ( e, xml_schema::flags::dont_validate ) ; ==> exception: no mapping provided for namespace prefix 'ns6' By adding the namespace prefix mapping to the DOM element as below the error disappears: e.setAttributeNS( xsd::cxx::xml::string("http://www.w3.org/2000/xmlns/").c_str(), xsd::cxx::xml::string("xmlns:ns6").c_str(), xsd::cxx::xml::string("http://www.hh.com/hhml/extension-2-0").c_str()); It seems to me that the DOM element is not importing namespaces prefixes. When serializing, the xml produced put all namespaces used in the wildcard at the wildcard root element even if it has already defined them the root document (case when wildcard and root contains elements defined in same namespace). I thought that it is your design to expect the wildcard to have it own namespaces prefixing defined within as you do when serializing. Thanks. From: Boris Kolpackov > Date: 2 June 2015 6:01:56 pm SGT To: Farhat Latrach > Cc: "xsd-users@codesynthesis.com" > Subject: Re: [xsd-users] wildcard namespaces Reply-To: xsd-users@codesynthesis.com Hi Farhat, Farhat Latrach > writes: Yes the generated code fails to extract the wildcard content. The exception is related to the prefix namespace mappings. Interesting. Would you be able to send me a test case that reproduces this? That is, the schema, xml file, and a test driver. This should definitely work out of the box so I would like to fix it. Boris This email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please delete all copies and notify the sender immediately. You may wish to refer to the incorporation details of Standard Chartered PLC, Standard Chartered Bank and their subsidiaries at https://www.sc.com/en/incorporation-details.html From Farhat.Latrach at sc.com Wed Jun 3 02:57:11 2015 From: Farhat.Latrach at sc.com (Latrach, Farhat) Date: Wed Jun 3 15:03:21 2015 Subject: FW: [xsd-users] wildcard namespaces Message-ID: <7F6839155D74054CB0971462A215DAC93057BADC@HKWPIPXMB01A> Hi Boris ? Can you check if you import namespaces prefixing used in xsi:type? In my case the missed namespace prefixing (ns6) is related to an xsi:type : From: Latrach, Farhat Sent: Tuesday, June 02, 2015 7:55 PM To: 'xsd-users@codesynthesis.com' Subject: RE: [xsd-users] wildcard namespaces Hi Boris, Here is a test case: Xml: .......... C++ code: auto_ptr xmlRequest (hhml::HHML_( argv[1], xml_schema::flags::dont_validate) ); //successful std::cout << *xmlRequest << std::endl; //shows all elements except the wildcard ::xercesc::DOMElement &e = xmlRequest->payload().any(); hhml::FPMLPayloadListType fpmlPayLoadsList ( e, xml_schema::flags::dont_validate ) ; ==> exception: no mapping provided for namespace prefix 'ns6' By adding the namespace prefix mapping to the DOM element as below the error disappears: e.setAttributeNS( xsd::cxx::xml::string("http://www.w3.org/2000/xmlns/").c_str(), xsd::cxx::xml::string("xmlns:ns6").c_str(), xsd::cxx::xml::string("http://www.hh.com/hhml/extension-2-0").c_str()); It seems to me that the DOM element is not importing namespaces prefixes. When serializing, the xml produced put all namespaces used in the wildcard at the wildcard root element even if it has already defined them the root document (case when wildcard and root contains elements defined in same namespace). I thought that it is your design to expect the wildcard to have it own namespaces prefixing defined within as you do when serializing. Thanks. From: Boris Kolpackov > Date: 2 June 2015 6:01:56 pm SGT To: Farhat Latrach > Cc: "xsd-users@codesynthesis.com" > Subject: Re: [xsd-users] wildcard namespaces Reply-To: xsd-users@codesynthesis.com Hi Farhat, Farhat Latrach > writes: Yes the generated code fails to extract the wildcard content. The exception is related to the prefix namespace mappings. Interesting. Would you be able to send me a test case that reproduces this? That is, the schema, xml file, and a test driver. This should definitely work out of the box so I would like to fix it. Boris This email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please delete all copies and notify the sender immediately. You may wish to refer to the incorporation details of Standard Chartered PLC, Standard Chartered Bank and their subsidiaries at https://www.sc.com/en/incorporation-details.html From boris at codesynthesis.com Wed Jun 3 15:45:51 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 3 15:45:58 2015 Subject: [xsd-users] wildcard namespaces In-Reply-To: <7F6839155D74054CB0971462A215DAC93057A3AC@HKWPIPXMB01A> References: <7F6839155D74054CB0971462A215DAC93057A3AC@HKWPIPXMB01A> Message-ID: Hi Farhat, Latrach, Farhat writes: > Here is a test case: [...] Thanks for the additional info though this is not exactly what I was looking for. Ideally, I would like a minimal but complete (i.e., compilable and runnable) test case with a schema, XML file, and a test driver. I will try to come up with one myself based on your snippets, though this will take some time. Boris From robert.w.krajewski at gmail.com Thu Jun 4 14:53:01 2015 From: robert.w.krajewski at gmail.com (Robert Krajewski) Date: Fri Jun 5 01:51:45 2015 Subject: [xsd-users] Determine parent/child element in C++/Tree Message-ID: Hey everybody, I have the following problem. I need to determine the parent element of an element. E. g. and Is a given C a child of A or B? After searching through the source code and the online tutorials I couldn't find a way to solve this task. I would be very happy if there is a way to determine the parent of a given element C or all children of type C of a given element. Best regards Robert From sheepduke at 163.com Fri Jun 5 00:10:08 2015 From: sheepduke at 163.com (Danny Yue) Date: Fri Jun 5 01:51:46 2015 Subject: [xsd-users] Does polymorphic serializer support streaming? Message-ID: <20150605.121008.1350723738459573599.sheepduke@163.com> Hi, I'm using XSD to serialize some XML data with given XSD. The XML file could be very large, so it must be serialized with streaming. `xsi:type' style is used in generated XML. When I serialize the whole tree using generated `Tree_' function, `xsi:type' can be serialized normally. However, when I use the serializer taken from `streaming' directory, those polymorphism information is lost. All the elements start with their own type name instead of their parent's type name and `xsi:type'. i.e. What I want: Reality: So, the question is: Is there any way to serialize polymorphic elements with streaming? Or, is it possible to serialize only one element with polymorphism? I looked at the source code of Codesynthesis XSD tool and googled a lot but didn't find any helpful information. I guess it's because the document is 'sliced'. But I don't understand whether XSD or Xerces holds the polymorphism information? How to "restore" the information for each element? Other info: OS: Gentoo Linux 4.0.4 XSD: 4.0.0 Xerces-C: 3.1.1 Could someone please help me? Thanks a lot in advance :-) Danny From boris at codesynthesis.com Fri Jun 5 13:03:33 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 5 13:03:45 2015 Subject: [xsd-users] Determine parent/child element in C++/Tree In-Reply-To: References: Message-ID: Hi Robert, Robert Krajewski writes: > I have the following problem. I need to determine the parent element of an > element. > E. g. > > > > > and > > > > > Is a given C a child of A or B? First of all, the C++/Tree object model doesn't deal in term of elements but rather in terms of data members. In other words, once the object model is constructed, there is no longer any knowledge (well, with a few exceptions; see below) that there was an XML element called "C". We now have an object model node that is of a type of element "C" and which you can access using a C++ data member accessors. So, if what you really need is to find out whether object node corresponding to element "C" is contained by an object node corresponding to element "A" or "B", then, assuming A and B have different types, you can do it like this (*_t denotes types of the elements): C_t& c = ...; xml_schema::type* x = c._container (); if (x == nullptr) // Not contained by anybody. else if (A_t* a = dynamic_cast (x)) // A. else if (B_t* b = dynamic_cast (x)) // B. else // Something else. Now if what you are really after are XML elements/names, then probably the best way to accomplish this would be with the DOM Association feature (see the manual). Boris From boris at codesynthesis.com Fri Jun 5 13:11:08 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 5 13:11:16 2015 Subject: [xsd-users] Does polymorphic serializer support streaming? In-Reply-To: <20150605.121008.1350723738459573599.sheepduke@163.com> References: <20150605.121008.1350723738459573599.sheepduke@163.com> Message-ID: Hi Danny, Danny Yue writes: > When I serialize the whole tree using generated `Tree_' function, > `xsi:type' can be serialized normally. However, when I use the > serializer taken from `streaming' directory, those polymorphism > information is lost. All the elements start with their own type name > instead of their parent's type name and `xsi:type'. i.e. > What I want: > Reality: You would need to provide more details on what exactly you are doing during serialization. Specifically, are the polymorphic types your "streaming points", i.e., the fragments which you serialize one at a time or are they nested inside some other bigger fragments? If it is the former, then you should be able to specify the element name yourself. If it is the latter, then I don't see how the result should be different from using the top-level parsing function (i.e., Tree_() in your case). Boris From sheepduke at 163.com Sun Jun 7 08:44:38 2015 From: sheepduke at 163.com (Danny Yue) Date: Mon Jun 8 04:50:16 2015 Subject: [xsd-users] Does polymorphic serializer support streaming? In-Reply-To: References: <20150605.121008.1350723738459573599.sheepduke@163.com> Message-ID: <20150607.204438.1304280957238041298.sheepduke@163.com> Hi Boris, Considering a `tree' with a sequence of element `apple' and `orange' which derived from `node'. When building the whole tree and calling `tree_(std::cout, tree, map)', I've got: ` ' which is exactly what I want. However, when I use serializer like: // begin // s.start(std::cout); s.next_open("tree", tree); s.next("apple", *apple); s.next("orange", *orange); s.next_close("tree"); // end I got: ` ' in which `xsi:type' is lost and I don't know how to serialize `apple' with `xsi:type'. Am I doing anything wrongly or....too stupid to use this? :-p XSD and C++ source file is in attached files. I hope I'm not playing against the rules of the mailing list. :-) Thanks a lot. Danny From: Boris Kolpackov Subject: Re: [xsd-users] Does polymorphic serializer support streaming? Date: Fri, 5 Jun 2015 19:11:08 +0200 > Hi Danny, > > Danny Yue writes: > >> When I serialize the whole tree using generated `Tree_' function, >> `xsi:type' can be serialized normally. However, when I use the >> serializer taken from `streaming' directory, those polymorphism >> information is lost. All the elements start with their own type name >> instead of their parent's type name and `xsi:type'. i.e. >> What I want: >> Reality: > > You would need to provide more details on what exactly you are > doing during serialization. Specifically, are the polymorphic > types your "streaming points", i.e., the fragments which you > serialize one at a time or are they nested inside some other > bigger fragments? If it is the former, then you should be able > to specify the element name yourself. If it is the latter, > then I don't see how the result should be different from > using the top-level parsing function (i.e., Tree_() in your > case). > > Boris -------------- next part -------------- #include #include "tree.hxx" #include "trace_serializer.hxx" using namespace std; int main() { xml_schema::namespace_infomap map; map[""].name="http://example.com"; map["trace"].name="http://trace.com"; try { xercesc::XMLPlatformUtils::Initialize(); tree tree; tree::node_sequence seq; apple *apple = new class apple; apple->name("name"); apple->color("red"); apple->smell("good"); orange *orange = new class orange; orange->name("orange"); orange->color("yellow?"); seq.push_back(*apple); seq.push_back(*orange); tree.node(seq); tree_(std::cout, tree, map); cout << endl << endl; seq.clear(); tree.node(seq); simsoc_trace::trace_serializer s; s.start(std::cout); s.next_open("tree", tree); s.next("apple", *apple); s.next("orange", *orange); s.next_close("tree"); cout << endl << endl; node *node = static_cast(apple); node_(std::cout, *node, map, "UTF-8", xml_schema::flags::no_xml_declaration); cout << endl << endl; node = static_cast(orange); node_(std::cout, *node, map, "UTF-8", xml_schema::flags::no_xml_declaration); } catch (const xercesc_3_1::DOMException &e) { cerr << "ERROR:" << e.code << " " << *e.getMessage() << endl; } catch (const xml_schema::exception &e) { cerr << e << endl; } } -------------- next part -------------- From boris at codesynthesis.com Mon Jun 8 05:31:50 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jun 9 08:34:52 2015 Subject: [xsd-users] Does polymorphic serializer support streaming? In-Reply-To: <20150607.204438.1304280957238041298.sheepduke@163.com> References: <20150605.121008.1350723738459573599.sheepduke@163.com> <20150607.204438.1304280957238041298.sheepduke@163.com> Message-ID: Hi Danny, Danny Yue writes: > When building the whole tree and calling `tree_(std::cout, tree, map)', > I've got: > > > > > ' > which is exactly what I want. > > However, when I use serializer like: > > s.start(std::cout); > s.next_open("tree", tree); > s.next("apple", *apple); > s.next("orange", *orange); Well, you are explicitly specifying the element names as the first argument. So you get them in the output. If you want "node" and xsi:type, then you will need to specify them as "node" and also add the xsi:type yourself. If you want to do it in a generic way, then you can take a look at how the generated code/runtime figure out what to put in xsi:type and implement the same logic (all the underlying type maps are publicly accessible). Boris From tsroynciitraoln at gmail.com Tue Jun 9 11:11:56 2015 From: tsroynciitraoln at gmail.com (tsroynciitraoln) Date: Tue Jun 9 11:19:17 2015 Subject: [xsd-users] link problem only in Release mode Message-ID: Hi, I'm currently working on this library http://www.epri.com/abstracts/Pages/ProductAbstract.aspx?ProductId=000000000001026753 . To be able to acess DOMcontent, I use the following command line (on linux) : ./xsd cxx-tree --generate-serialization --generate-polymorphic --polymorphic-type-all *--generate-ostream --generate-wildcard* --output-dir ./data99 --namespace-map http://openadr.org/oadr-2.0b/2012/07=oadr2b::oadr --namespace-map http://docs.oasis-open.org/ns/energyinterop/201110=oadr2b::ei --namespace-map http://www.opengis.net/gml/3.2=oadr2b::gml --namespace-map http://docs.oasis-open.org/ns/emix/2011/06=oadr2b::emix --namespace-map http://www.w3.org/2009/xmldsig11#=oadr2b::dsig11 --namespace-map http://www.w3.org/2000/09/xmldsig#=oadr2b::sig --namespace-map http://openadr.org/oadr-2.0b/2012/07/xmldsig-properties=oadr2b::dsp oadr_20b.xsd oadr_atom.xsd oadr_ei_20b.xsd oadr_emix_20b.xsd oadr_gml_20b.xsd oadr_greenbutton.xsd oadr_ISO_ISO3AlphaCurrencyCode_20100407.xsd oadr_power_20b.xsd oadr_pyld_20b.xsd oadr_siscale_20b.xsd oadr_strm_20b.xsd oadr_xcal_20b.xsd oadr_xml.xsd oadr_xmldsig-properties-schema.xsd oadr_xmldsig.xsd oadr_xmldsig11.xsd --export-symbol "OPENADRBINDING_API" --file-per-type --hxx-prologue-file "prologue.h" With all theses files, I generate a DLL, all is ok in Debug and in Release Another project uses this DLL, in Debug mode, all is ok; but in release mode I got this error : 3>Oadr2bHelper.obj : error LNK2001: symbole externe non r?solu "__declspec(dllimport) public: virtual __cdecl xsd::cxx::tree::date_time >::~date_time >(void)" (__imp_??1?$date_time@DV?$simple_type@DV_type@tree@cxx@xsd@@@tree@cxx@xsd@ @@tree@cxx@xsd@@UEAA@XZ) 3>CreateOptSchedule.obj : error LNK2001: symbole externe non r?solu "__declspec(dllimport) public: __cdecl xsd::cxx::tree::uri >::uri >(class std::basic_string,class std::allocator > const &)" (__imp_??0?$uri@DV?$simple_type@DV_type@tree@cxx@xsd@@@tree@cxx@xsd@ @@tree@cxx@xsd@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@ @V?$allocator@D@2@@std@@@Z) 3>CreateOptSchedule.obj : error LNK2001: symbole externe non r?solu "__declspec(dllimport) public: virtual __cdecl xsd::cxx::tree::uri >::~uri >(void)" (__imp_??1?$uri@DV?$simple_type@DV_type@tree@cxx@xsd@@@tree@cxx@xsd@ @@tree@cxx@xsd@@UEAA@XZ) Any idea how to fix this ? (I tried both using VS2013 and VS2015) Best regards From boris at codesynthesis.com Mon Jun 15 11:52:24 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jun 15 11:52:26 2015 Subject: [xsd-users] link problem only in Release mode In-Reply-To: References: Message-ID: Hi, tsroynciitraoln writes: > With all theses files, I generate a DLL, all is ok in Debug and in Release > > Another project uses this DLL, in Debug mode, all is ok; but in release > mode I got this error : The fact that you only get three unresolved symbols suggests that most likely there are some compiler settings in your second project in Release mode that makes it treat inline functions differently compared to the way DLL was built. I.e., the DLL build "thinks" they are inline and therefore don't get exported while the project build thinks they are not inline and expects them in the DLL. In particular, you may want to check optimization and runtime options. If that doesn't help, another option would be to try and export everything for build-in types with the --export-xml-schema option. Check the XSD compiler documentation for details. Boris From tsroynciitraoln at gmail.com Tue Jun 16 04:00:28 2015 From: tsroynciitraoln at gmail.com (tsroynciitraoln) Date: Tue Jun 16 08:16:51 2015 Subject: [xsd-users] link problem only in Release mode In-Reply-To: References: Message-ID: Hi, thanks for the answer. It seems your analysis is correct. I had to add manually these two exports to be able to have a complete compilation (Both in debug and release mode). All is ok now ! Best regards 2015-06-15 17:52 GMT+02:00 Boris Kolpackov : > Hi, > > tsroynciitraoln writes: > > > With all theses files, I generate a DLL, all is ok in Debug and in > Release > > > > Another project uses this DLL, in Debug mode, all is ok; but in release > > mode I got this error : > > The fact that you only get three unresolved symbols suggests that > most likely there are some compiler settings in your second project > in Release mode that makes it treat inline functions differently > compared to the way DLL was built. I.e., the DLL build "thinks" > they are inline and therefore don't get exported while the > project build thinks they are not inline and expects them in > the DLL. In particular, you may want to check optimization and > runtime options. > > If that doesn't help, another option would be to try and export > everything for build-in types with the --export-xml-schema option. > Check the XSD compiler documentation for details. > > Boris > From ckokkeng at dso.org.sg Mon Jun 22 21:01:34 2015 From: ckokkeng at dso.org.sg (Chew Kok Keng) Date: Tue Jun 23 09:49:21 2015 Subject: [xsd-users] error C2248: 'std::unique_ptr<_Ty>::unique_ptr' : cannot access private member declared in class 'std::unique_ptr<_Ty>' Message-ID: <20E19B3413064F4FA4771E0C05CAC4D401D85139@Gawain.dsonet.corp.root> Hi, I'm encountering the above error while trying to build a simple using xsd 4.0 on vs2012. I noticed turning on /clr has an effect on the build. Without /clr, it is fine. Am I missing something? Regards, chew From boris at codesynthesis.com Tue Jun 23 09:50:50 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jun 23 09:50:46 2015 Subject: [xsd-users] error C2248: 'std::unique_ptr<_Ty>::unique_ptr' : cannot access private member declared in class 'std::unique_ptr<_Ty>' In-Reply-To: <20E19B3413064F4FA4771E0C05CAC4D401D85139@Gawain.dsonet.corp.root> References: <20E19B3413064F4FA4771E0C05CAC4D401D85139@Gawain.dsonet.corp.root> Message-ID: Hi Chew, Chew Kok Keng writes: > I'm encountering the above error while trying to build a simple > using xsd 4.0 on vs2012. I noticed turning on /clr has an effect > on the build. Without /clr, it is fine. XSD does not support C++/CLR, only standard, portable C++. Boris From laurence.davies at unsw.edu.au Thu Jun 25 20:54:14 2015 From: laurence.davies at unsw.edu.au (Laurence Davies) Date: Thu Jun 25 20:54:24 2015 Subject: [xsd-users] (no subject) Message-ID: Hi Boris, I'm attempting to write some general code for resolving xlinks in a GML document. They typically use the gml:id attribute, but there is the case where a URN or URL will be used. An example of a URL link: SINEX2015-03-20Z Another example, containing a URL and a gml:id href: 2013-11-04Z Authoritative ... I found a relevant solution you provided in 2008 on this subject in the email below that covers the gml:id case but not the latter. Would you know what call I would need to make to resolve a URL and, if possible, a URN? Hi Jan, Jan Klimke > writes: > > xmlns:app="http://www.deegree.org/app" > xmlns:wfs="http://www.opengis.net/wfs" > xmlns:xlink="http://www.w3.org/1999/xlink" > xmlns:gml="http://www.opengis.net/gml" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://www.deegree.org/app > http://servername:8080/deegree-wfs/services?SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TYPENAME=app:User&NAMESPACE=xmlns(app=http://www.deegree.org/app) > http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"> > > > 133 > Friedrich Engels2 > > > 70 > 1.0 > 0.0 > 0.0 > 1.0 > > > > > > > 134 > Friedrich Engels > > > > > > As you can see, the second user has a xlink reference in its > property referencing "COLOR_70" which appeared "earlier" in the > document. My problem is now to obtain a reference to the Color object > for the "USER_134" object. How can i resolve such inner document xlink > references ? I checked the GML schema and the gml:id attribute is of xsd:ID type. If all href attributes always refer one of those gml:id attributes then this is pretty simple to do: std::string href = ... // contains "COLOR_70", without # color_t& color = ... // reference to an object containing href xml_schema::idref ref (href, 0, &color); xml_schema::type* p = ref.get (); // p points to the object with ID COLOR_70 // Now you can use static_cast (if you are sure about the type of p) or // dynamic_cast (if you are not) to cast it to the Color_t type. If you cannot assume that all href attributes point to one of the gml:id attributes (or other attributes as long as they are of the xsd:ID type) then things get a bit more complex. Let me know if this is the case and I will describe how this can be done. Boris Kind regards, Laurence Davies ____________________ Research Assistant in eGeodesy CRC-SI, UNSW Desk phone: (03) 8636 2373 Mobile: 0427 519 289 From laurence.davies at unsw.edu.au Thu Jun 25 22:17:42 2015 From: laurence.davies at unsw.edu.au (Laurence Davies) Date: Thu Jun 25 22:17:52 2015 Subject: [xsd-users] Resolving xlinks in a GML file In-Reply-To: References: Message-ID: (Resent with a subject line) Hi Boris, I'm attempting to write some general code for resolving xlinks in a GML document. They typically use the gml:id attribute, but there is the case where a URN or URL will be used. An example of a URL link: SINEX2015-03-20Z Another example, containing a URL and a gml:id href: 2013-11-04Z Authoritative ... I found a relevant solution you provided in 2008 on this subject in the email below that covers the gml:id case but not the latter. Would you know what call I would need to make to resolve a URL and, if possible, a URN? Hi Jan, Jan Klimke > writes: > > xmlns:app="http://www.deegree.org/app" > xmlns:wfs="http://www.opengis.net/wfs" > xmlns:xlink="http://www.w3.org/1999/xlink" > xmlns:gml="http://www.opengis.net/gml" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://www.deegree.org/app > http://servername:8080/deegree-wfs/services?SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TYPENAME=app:User&NAMESPACE=xmlns(app=http://www.deegree.org/app) > http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"> > > > 133 > Friedrich Engels2 > > > 70 > 1.0 > 0.0 > 0.0 > 1.0 > > > > > > > 134 > Friedrich Engels > > > > > > As you can see, the second user has a xlink reference in its > property referencing "COLOR_70" which appeared "earlier" in the > document. My problem is now to obtain a reference to the Color object > for the "USER_134" object. How can i resolve such inner document xlink > references ? I checked the GML schema and the gml:id attribute is of xsd:ID type. If all href attributes always refer one of those gml:id attributes then this is pretty simple to do: std::string href = ... // contains "COLOR_70", without # color_t& color = ... // reference to an object containing href xml_schema::idref ref (href, 0, &color); xml_schema::type* p = ref.get (); // p points to the object with ID COLOR_70 // Now you can use static_cast (if you are sure about the type of p) or // dynamic_cast (if you are not) to cast it to the Color_t type. If you cannot assume that all href attributes point to one of the gml:id attributes (or other attributes as long as they are of the xsd:ID type) then things get a bit more complex. Let me know if this is the case and I will describe how this can be done. Boris Kind regards, Laurence Davies ____________________ Research Assistant in eGeodesy CRC-SI, UNSW Desk phone: (03) 8636 2373 Mobile: 0427 519 289 From boris at codesynthesis.com Fri Jun 26 13:46:41 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 26 13:46:34 2015 Subject: [xsd-users] Resolving xlinks in a GML file In-Reply-To: References: Message-ID: Hi Laurence, Laurence Davies writes: > I found a relevant solution you provided in 2008 on this subject in > the email below that covers the gml:id case but not the latter. Would > you know what call I would need to make to resolve a URL and, if > possible, a URN? If href is to a gml:id, it means it is to a node in the same object model (or to some element in the same document, in XML terms). If href is a URL/URN like below, what does it point to? xlink:href="ftp://ftp.ga.gov.au/geodesy-outgoing/gnss/solutions/apref/apr18287.snx" When you say "what call I would need to make to resolve a URL" what do you want it to be resolved to? A byte stream? A file (that got downloaded) on disk? Maybe, if it is always an image, you want this call to display the image on the user's computer? Boris From laurence.davies at unsw.edu.au Sun Jun 28 21:51:29 2015 From: laurence.davies at unsw.edu.au (Laurence Davies) Date: Sun Jun 28 21:51:38 2015 Subject: [xsd-users] Resolving xlinks in a GML file In-Reply-To: References: , Message-ID: Hi Boris, Thanks for your reply. You've noted the xlink that points to raw data, so perhaps I provided a bad example. In GML there is the concept of the property type (if you're interested, it is discussed here: https://www.seegrid.csiro.au/wiki/AppSchemas/GmlImplementation#Implementation_of_properties ) which is my main concern at present. The below XML should illustrate the URLs that I need to resolve and parse if the resolution succeeds: ... HTTP result from the hypothetical web service http://wfs.geodesyml.org/nodes?hashidentifer would look like: node_11328 ... Would the added layer of parsing a WFS response pose a problem? If the URL just returns a ... perhaps I could use the following template: /* second argument takes the form: * std::[auto|unique]_ptr name (const std::basic_string& uri, xml_schema::flags = 0, const xml_schema::properties& = xml_schema::properties ()); */ template std::auto_ptr PropertyResolver(P &p, std::auto_ptr (*create_global_element) (const ::std::string& uri, xml_schema::flags, const xml_schema::properties&) ) { typedef ::xlink::hrefType href_type; typedef ::xsd::cxx::tree::optional< href_type > href_optional; href_optional ho = p.href(); if (ho.present()) { href_type h = ho.get(); if (h.at(0) == '#') { xml_schema::idref ref(h.substr(1), 0, &p); return ref.get(); } else { /* Resolve the URI externally */ xercesc::XMLUri xuri(xercesc::XMLString::transcode(h)); if (xuri.isValidURI()) { /* @todo Is this an XPointer? Split at the # and resolve the base, * then the XPointer expression */ /* Try parsing using the xsd type */ return create_global_element(h,0,xml_schema::properties ()); } else { throw runtime_error("URI for xlink:href is not valid."); } } } return std::auto_ptr(null); } This leads to another issue that I'm having: The generation of parsers for global elements. I have global elements that substitute for a global abstract element, and the parsers (documented here: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#3) don't seem to be generated for these elements. Am I missing a crucial option to enable the generation of these parsers? For example, consider the following extract from my schema: .... Thank you again and kind regards, Laurence Davies ____________________ Research Assistant in eGeodesy CRC-SI, UNSW Desk phone: (03) 8636 2373 Mobile: 0427 519 289 ________________________________________ From: Boris Kolpackov [boris@codesynthesis.com] Sent: Saturday, 27 June 2015 3:46 AM To: Laurence Davies Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] Resolving xlinks in a GML file Hi Laurence, Laurence Davies writes: > I found a relevant solution you provided in 2008 on this subject in > the email below that covers the gml:id case but not the latter. Would > you know what call I would need to make to resolve a URL and, if > possible, a URN? If href is to a gml:id, it means it is to a node in the same object model (or to some element in the same document, in XML terms). If href is a URL/URN like below, what does it point to? xlink:href="ftp://ftp.ga.gov.au/geodesy-outgoing/gnss/solutions/apref/apr18287.snx" When you say "what call I would need to make to resolve a URL" what do you want it to be resolved to? A byte stream? A file (that got downloaded) on disk? Maybe, if it is always an image, you want this call to display the image on the user's computer? Boris From loredofilms1 at yahoo.com Mon Jun 29 08:49:48 2015 From: loredofilms1 at yahoo.com (All Herald) Date: Mon Jun 29 08:49:56 2015 Subject: [xsd-users] CodeSynthesis/tree (version 4.0.0) and Nvidia NVCC compiler (CUDA version 7.0) Message-ID: <469682007.1624723.1435582188056.JavaMail.yahoo@mail.yahoo.com> We are trying to use the CodeSynthesis/tree (version 4.0.0) to generate files whose headers can be included in *.cu (CUDA) source files using the Nvidia NVCC compiler (CUDA version 7.0). The *.cu source files compile just fine, but the NVCC linker complains that that global constant memory is exhausted and therefore will not link the object files. Since only 64K of global constant memory is available, one hits this limitation very quickly. This is was run under Ubuntu 14.04. I verified that this is the case when the *.cu files contain ONLY headers generated by the XSD executable. Each file requires its own private global constant memory until this limited resource is exhausted. 1) Is there a known workaround to fix this problem? I searched the archive and did not see anything relevant. 2) Has anyone on the list used the XSD executable with the NVCC compiler and thus can provide some tips? The issue is that we would like to use XSD as part of a ?CUDA-based application but this limitation forces us to explicitly translate XSD-generated data objects into code that can be compiled under NVCC without exhausting global constant memory. As you can imagine we need to now maintain two sets of objects - huge waste. 3) Making CodeSynthesis more usable within CUDA-based applications should be valuable to many other users since virtually all computationally heavy calculations nowadays is being done using GPUs.? 4) Is there anyone with experience using both technologies who might be able to provide some assistance on this as I'm sure there are other issues with using the two technologies we have yet to uncover. ? From asuranceturix at gmail.com Fri Jun 26 19:53:37 2015 From: asuranceturix at gmail.com (=?UTF-8?B?RGFuaWVsIEJlcmrDs24gRMOtZXo=?=) Date: Mon Jun 29 09:37:19 2015 Subject: [xsd-users] Building on OSX Message-ID: Hi, I am trying to contribute a formula ( https://github.com/Homebrew/homebrew/pull/40274 ) for building xsd on OSX under Homebrew ( http://brew.sh ), but there is a problem in xsd/examples/cxx/tree/makefile , where the Makefile script assumes GNU find is installed. However, OSX comes with BSD find, which does not support -printf. I suggest the following patch, that should be compatible with both Linux and BSD. Cheers, Daniel diff --git a/xsd/examples/cxx/tree/makefile b/xsd/examples/cxx/tree/makefile index 172195a..d8c8198 100644 --- a/xsd/examples/cxx/tree/makefile +++ b/xsd/examples/cxx/tree/makefile @@ -39,7 +39,7 @@ $(install): $(addprefix $(out_base)/,$(addsuffix /.install,$(all_examples))) $(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(all_examples))) $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) -$(dist-win): export dirs := $(shell find $(src_base) -type d -exec test -f {}/driver.cxx ';' -printf '%P ') +$(dist-win): export dirs := $(shell find "$(src_base)" -type d -exec test -f {}/driver.cxx ';' -exec bash -c 'd="{}"; printf "%s " "${d#'"$(src_base)"'/}"' ";") $(dist-win): |$(out_root)/.dist-pre $(dist-win): $(addprefix $(out_base)/,$(addsuffix /.dist-win,$(all_examples))) $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt)