From boris at codesynthesis.com Sat Mar 1 00:19:58 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sat Mar 1 00:23:09 2014 Subject: [xsd-users] Pointers to references In-Reply-To: References: <362490BF-B8AD-4ABE-883C-CBA09B00EAD4@gmail.com> <065F4DF4-55C5-48EB-909C-02E2DB4C0A64@gmail.com> Message-ID: Hi Mathew, Mathew Benson writes: > Could you tell me the best way to retrieve > 'argumentTypeRef="IpAddressType"' given I have a pointer/reference to the > '' object? If you have an IDREF reference, then please read this section in the manual, it explains how to use them: http://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.5.5 If something is still not clear, please specify what exactly (i.e., "I tried foo and bar and biz did not work" instead of "tell me how to do foo"). Boris From mathew.benson at gmail.com Sat Mar 1 13:33:21 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Sat Mar 1 13:33:29 2014 Subject: [xsd-users] Pointers to references In-Reply-To: References: <362490BF-B8AD-4ABE-883C-CBA09B00EAD4@gmail.com> <065F4DF4-55C5-48EB-909C-02E2DB4C0A64@gmail.com> Message-ID: I already found that section, but to avoid confusion I tried to faithly perform the steps detailed in that section. The sample code doesn't work for me out of the box, having problems just parsing the schema, compiling, and unmarshalling the xml. Either I don't have my build environment setup correctly, or the sample code in the manual is really incomplete code snippets. For the benefit of anybody else that finds this post, I'm attaching a tarball of my build project with a functioning example taken from section 2.5.5 of the manual. I apologize if the attachment doesn't go through. For a detailed example of what had failed and the changes required, build the code exactly as found in the manual and diff that with the example attached here. The xsd command to generate the .cpp and .h file is: xsd cxx-tree --generate-serialization --generate-ostream --cxx-suffix .cpp --hxx-suffix .h --fwd-suffix -fwd.h test.xsd I couldn't get the second half of the example to compile. Not that I don't think that it should matter, but I didn't know what function to call to unmarshall from a file and return a reference. Any attempt to use "root_type&" like the example resulted in the following compiler error: ../src/XSDTest.cpp:18:43: error: invalid initialization of non-const reference of type 'test::root_type&' from an rvalue of type 'std::auto_ptr I also got an error on the following line from the example: object_type& obj (*ref); ../src/XSDTest.cpp:20:25: error: invalid initialization of reference of type 'test::object_type&' from expression of type 'xsd::cxx::tree::idref > > > > >, xsd::cxx::tree::_type>::ref_type {aka xsd::cxx::tree::_type}' I would really like to get that second half of the example working so I don't have to cast. Lastly, using "root" as a variable name in the examples is probably not a good idea when the example xsd file results in a class also called "root". Its a bit confusing. On Fri, Feb 28, 2014 at 11:19 PM, Boris Kolpackov wrote: > Hi Mathew, > > Mathew Benson writes: > > > Could you tell me the best way to retrieve > > 'argumentTypeRef="IpAddressType"' given I have a pointer/reference to the > > '' object? > > If you have an IDREF reference, then please read this section in the > manual, it explains how to use them: > > http://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.5.5 > > If something is still not clear, please specify what exactly (i.e., "I > tried foo and bar and biz did not work" instead of "tell me how to > do foo"). > > Boris > -------------- next part -------------- A non-text attachment was scrubbed... Name: Debug.tar.gz Type: application/x-gzip Size: 1548 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20140301/9ddf815b/Debug.tar.bin From mathew.benson at gmail.com Sat Mar 1 17:38:48 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Sat Mar 1 17:38:56 2014 Subject: [xsd-users] Pointers to references In-Reply-To: References: <362490BF-B8AD-4ABE-883C-CBA09B00EAD4@gmail.com> <065F4DF4-55C5-48EB-909C-02E2DB4C0A64@gmail.com> Message-ID: I found my problem. For my attributes that were supposed to be references, I kept them as a simpleType but added " to the simpleType. That enforced references had corresponding ID's, but it didn't generate code that I expected. It returned the simpleType. I just set the attribute type to IDREF directly, rather than use a custom attribute. Now it works. On Sat, Mar 1, 2014 at 12:33 PM, Mathew Benson wrote: > I already found that section, but to avoid confusion I tried to faithly > perform the steps detailed in that section. The sample code doesn't work > for me out of the box, having problems just parsing the schema, compiling, > and unmarshalling the xml. Either I don't have my build environment setup > correctly, or the sample code in the manual is really incomplete code > snippets. For the benefit of anybody else that finds this post, I'm > attaching a tarball of my build project with a functioning example taken > from section 2.5.5 of the manual. I apologize if the attachment doesn't go > through. For a detailed example of what had failed and the changes > required, build the code exactly as found in the manual and diff that with > the example attached here. The xsd command to generate the .cpp and .h > file is: > > xsd cxx-tree --generate-serialization --generate-ostream --cxx-suffix .cpp > --hxx-suffix .h --fwd-suffix -fwd.h test.xsd > > I couldn't get the second half of the example to compile. Not that I > don't think that it should matter, but I didn't know what function to call > to unmarshall from a file and return a reference. Any attempt to use > "root_type&" like the example resulted in the following compiler error: > ../src/XSDTest.cpp:18:43: error: invalid initialization of non-const > reference of type 'test::root_type&' from an rvalue of type > 'std::auto_ptr > > I also got an error on the following line from the example: > > object_type& obj (*ref); > > ../src/XSDTest.cpp:20:25: error: invalid initialization of reference of > type 'test::object_type&' from expression of type > 'xsd::cxx::tree::idref xsd::cxx::tree::name xsd::cxx::tree::normalized_string xsd::cxx::tree::simple_type > > > > >, > xsd::cxx::tree::_type>::ref_type {aka xsd::cxx::tree::_type}' > > I would really like to get that second half of the example working so I > don't have to cast. > > Lastly, using "root" as a variable name in the examples is probably not a > good idea when the example xsd file results in a class also called "root". > Its a bit confusing. > > > On Fri, Feb 28, 2014 at 11:19 PM, Boris Kolpackov > wrote: > >> Hi Mathew, >> >> Mathew Benson writes: >> >> > Could you tell me the best way to retrieve >> > 'argumentTypeRef="IpAddressType"' given I have a pointer/reference to >> the >> > '' object? >> >> If you have an IDREF reference, then please read this section in the >> manual, it explains how to use them: >> >> http://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.5.5 >> >> If something is still not clear, please specify what exactly (i.e., "I >> tried foo and bar and biz did not work" instead of "tell me how to >> do foo"). >> >> Boris >> > > From mathew.benson at gmail.com Sat Mar 1 18:09:01 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Sat Mar 1 18:09:09 2014 Subject: [xsd-users] cxx-tree and XPath Message-ID: Is it possible to retrieve an object by the XPath using the xsd generated code and API? From mathew.benson at gmail.com Sat Mar 1 21:03:26 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Sat Mar 1 21:03:34 2014 Subject: [xsd-users] Pointers to references In-Reply-To: References: <362490BF-B8AD-4ABE-883C-CBA09B00EAD4@gmail.com> <065F4DF4-55C5-48EB-909C-02E2DB4C0A64@gmail.com> Message-ID: I'm closer, but now I get a seg fault when it hits the dynamic_cast statement. I added typid(...).name() on the object retrieved in the example from the manual to see what type I was actually getting, and see: N3xsd3cxx4tree5idrefIcNS1_6ncnameIcNS1_4nameIcNS1_5tokenIcNS1_17normalized_stringIcNS1_6stringIcNS1_11simple_typeINS1_5_typeEEEEEEEEEEEEES9_EE Once I fixed the xsd file in my project, I verified I was finally getting the same type as above, building confidence that it was finally working. Here's my code: space::xtce::ArgumentRefEntry::argumentRef_type& argRef(argRefEntry[iArgRef].argumentRef()); std::cout << typeid(argRef).name() << std::endl; space::xtce::ArgumentList::Argument_type& argObj (dynamic_cast (*argRef)); In the 3rd line above, I get a seg fault. Before I'm reminded to read that section of the manual, I did read it and as far as I can tell, I'm following the instructions as best I understand them. Why is it seg faulting and how do you recommend debugging the seg fault? On Sat, Mar 1, 2014 at 4:38 PM, Mathew Benson wrote: > I found my problem. For my attributes that were supposed to be > references, I kept them as a simpleType but added " base="IDREF"/> to the simpleType. That enforced references had > corresponding ID's, but it didn't generate code that I expected. It > returned the simpleType. I just set the attribute type to IDREF directly, > rather than use a custom attribute. Now it works. > > > On Sat, Mar 1, 2014 at 12:33 PM, Mathew Benson wrote: > >> I already found that section, but to avoid confusion I tried to faithly >> perform the steps detailed in that section. The sample code doesn't work >> for me out of the box, having problems just parsing the schema, compiling, >> and unmarshalling the xml. Either I don't have my build environment setup >> correctly, or the sample code in the manual is really incomplete code >> snippets. For the benefit of anybody else that finds this post, I'm >> attaching a tarball of my build project with a functioning example taken >> from section 2.5.5 of the manual. I apologize if the attachment doesn't go >> through. For a detailed example of what had failed and the changes >> required, build the code exactly as found in the manual and diff that with >> the example attached here. The xsd command to generate the .cpp and .h >> file is: >> >> xsd cxx-tree --generate-serialization --generate-ostream --cxx-suffix >> .cpp --hxx-suffix .h --fwd-suffix -fwd.h test.xsd >> >> I couldn't get the second half of the example to compile. Not that I >> don't think that it should matter, but I didn't know what function to call >> to unmarshall from a file and return a reference. Any attempt to use >> "root_type&" like the example resulted in the following compiler error: >> ../src/XSDTest.cpp:18:43: error: invalid initialization of non-const >> reference of type 'test::root_type&' from an rvalue of type >> 'std::auto_ptr >> >> I also got an error on the following line from the example: >> >> object_type& obj (*ref); >> >> ../src/XSDTest.cpp:20:25: error: invalid initialization of reference of >> type 'test::object_type&' from expression of type >> 'xsd::cxx::tree::idref> xsd::cxx::tree::name> xsd::cxx::tree::normalized_string> xsd::cxx::tree::simple_type > > > > >, >> xsd::cxx::tree::_type>::ref_type {aka xsd::cxx::tree::_type}' >> >> I would really like to get that second half of the example working so I >> don't have to cast. >> >> Lastly, using "root" as a variable name in the examples is probably not a >> good idea when the example xsd file results in a class also called "root". >> Its a bit confusing. >> >> >> On Fri, Feb 28, 2014 at 11:19 PM, Boris Kolpackov < >> boris@codesynthesis.com> wrote: >> >>> Hi Mathew, >>> >>> Mathew Benson writes: >>> >>> > Could you tell me the best way to retrieve >>> > 'argumentTypeRef="IpAddressType"' given I have a pointer/reference to >>> the >>> > '' object? >>> >>> If you have an IDREF reference, then please read this section in the >>> manual, it explains how to use them: >>> >>> >>> http://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.5.5 >>> >>> If something is still not clear, please specify what exactly (i.e., "I >>> tried foo and bar and biz did not work" instead of "tell me how to >>> do foo"). >>> >>> Boris >>> >> >> > From boris at codesynthesis.com Sun Mar 2 09:32:11 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Mar 2 09:35:22 2014 Subject: [xsd-users] Pointers to references In-Reply-To: References: <362490BF-B8AD-4ABE-883C-CBA09B00EAD4@gmail.com> <065F4DF4-55C5-48EB-909C-02E2DB4C0A64@gmail.com> Message-ID: Hi Mathew, Mathew Benson writes: > std::cout << typeid(argRef).name() << std::endl; > space::xtce::ArgumentList::Argument_type& argObj > (dynamic_cast (*argRef)); You are printing the type name of argRef but trying to cast *argRef. Try to print the type name of what you are actually trying to cast (typeid(*argRef)) Boris From boris at codesynthesis.com Sun Mar 2 09:33:39 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Mar 2 09:36:48 2014 Subject: [xsd-users] cxx-tree and XPath In-Reply-To: References: Message-ID: Hi Mathew, Mathew Benson writes: > Is it possible to retrieve an object by the XPath using the xsd generated > code and API? Yes, look at the 'xpath' example. Boris From mathew.benson at gmail.com Sun Mar 2 11:13:25 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Sun Mar 2 11:13:32 2014 Subject: [xsd-users] Pointers to references In-Reply-To: References: <362490BF-B8AD-4ABE-883C-CBA09B00EAD4@gmail.com> <065F4DF4-55C5-48EB-909C-02E2DB4C0A64@gmail.com> Message-ID: When I dereference the pointer, I get a seg fault on that first line now. It looks like the function that should be returning the argumentRef property (type="IDREF"), isn't returning what I think it was. On Sun, Mar 2, 2014 at 8:32 AM, Boris Kolpackov wrote: > Hi Mathew, > > Mathew Benson writes: > > > std::cout << typeid(argRef).name() << std::endl; > > space::xtce::ArgumentList::Argument_type& argObj > > (dynamic_cast (*argRef)); > > You are printing the type name of argRef but trying to cast > *argRef. Try to print the type name of what you are actually > trying to cast (typeid(*argRef)) > > Boris > From mathew.benson at gmail.com Sun Mar 2 13:10:01 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Sun Mar 2 13:10:09 2014 Subject: [xsd-users] cxx-tree and XPath In-Reply-To: References: Message-ID: I found this in the manual but it appears that it keeps the initial document in memory for searches, and then retrieves the object from the tree. Does it really keep the document as well as the object tree in memory? My current project is small, but I may eventually decide to extend it to a much larger project with a 1GB+ XML file. How well does the xsd implementation scale up to large DOM's? On Sun, Mar 2, 2014 at 8:33 AM, Boris Kolpackov wrote: > Hi Mathew, > > Mathew Benson writes: > > > Is it possible to retrieve an object by the XPath using the xsd generated > > code and API? > > Yes, look at the 'xpath' example. > > Boris > > From mathew.benson at gmail.com Sun Mar 2 16:22:05 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Sun Mar 2 16:22:14 2014 Subject: [xsd-users] Pointers to references In-Reply-To: References: <362490BF-B8AD-4ABE-883C-CBA09B00EAD4@gmail.com> <065F4DF4-55C5-48EB-909C-02E2DB4C0A64@gmail.com> Message-ID: Thanks for the help. I have it worked out now. The root of the problem is that I was trying to use xsd in a traditional "c" way. It was very confusing. I read through the samples and embraced using xsd in a c++ manner (I.e. iterators). It sounds trivial but it's a fundamental difference that has made my implementation MUCH simpler now and much easier to understand. Sent from my iPhone > On Mar 2, 2014, at 8:32 AM, Boris Kolpackov wrote: > > Hi Mathew, > > Mathew Benson writes: > >> std::cout << typeid(argRef).name() << std::endl; >> space::xtce::ArgumentList::Argument_type& argObj >> (dynamic_cast (*argRef)); > > You are printing the type name of argRef but trying to cast > *argRef. Try to print the type name of what you are actually > trying to cast (typeid(*argRef)) > > Boris From boris at codesynthesis.com Mon Mar 3 03:59:56 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Mar 3 04:03:05 2014 Subject: [xsd-users] Pointers to references In-Reply-To: References: <779373584.772.1393599812271.JavaMail.root@birdun> Message-ID: Wesley Peters writes: > Boris, I'd just like to thank you again for your detailed answers to > questions from the XSD userbase. Your products are innovative and > helpful and your customer service is fantastic. Thanks, Wesley! I appreciate the kind words. Boris From boris at codesynthesis.com Mon Mar 3 04:04:41 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Mar 3 04:07:51 2014 Subject: [xsd-users] latest xsd+dep In-Reply-To: <5310E8DF.3020006@gmail.com> References: <5310E8DF.3020006@gmail.com> Message-ID: Hi Timur, Timur Gamerov writes: > Would anybody tell me how to cook xsd+dep from git repository? To make xsd+dep you need to have a normal development build of XSD and all its prerequisites (see the INSTALL file). But once you have that, you probably don't need xsd+dep. Here is also the xsd+dep package for the latest repository: http://codesynthesis.com/~boris/tmp/xsd/xsd-4.0.0.a13+dep.tar.bz2 Boris From boris at codesynthesis.com Mon Mar 3 04:58:32 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Mar 3 05:01:42 2014 Subject: [xsd-users] cxx-tree and XPath In-Reply-To: References: Message-ID: Hi Mathew, Mathew Benson writes: > I found this in the manual but it appears that it keeps the initial > document in memory for searches, and then retrieves the object from the > tree. Does it really keep the document as well as the object tree in > memory? Yes, that's correct. To run XPath you need a type-less model (DOM). > My current project is small, but I may eventually decide to extend > it to a much larger project with a 1GB+ XML file. How well does the > xsd implementation scale up to large DOM's? If you want to use XPath, then you will obviously incur some memory overhead because of DOM. Without XPath, C++/Tree allows you to handle very large documents with relatively small memory consumption using the streaming mechanism (see the 'streaming' example). Boris From vladimir.zykov at doctormobile.us Mon Mar 3 11:46:33 2014 From: vladimir.zykov at doctormobile.us (Vladimir Zykov) Date: Tue Mar 4 00:30:12 2014 Subject: [xsd-users] Sequence of choices in code generated by xsd Message-ID: <549FA52E-C9D9-431C-A46B-E121F59FE6E5@doctormofile.us> Hi Boris, I encountered a problem with xsd when I have an unbounded sequence of choices. I use xsd built from latest sources in cxx-tree mode. It generates for each member of choice a sequence but I'd rather expect to have something like in code generated by xsde in cxx-hybrid mode. It generates a union for a choice and puts in a sequence. For example, for the following XML Schema: I have in 'a' two separate sequences for 'b' and 'c'. For me it's important to preserve an order of 'b' and 'c' from the original XML document. Can it be done with xsd and if not will it ever support such a feature? Note: code generation is very much the same even if sequence is removed. I.e. Thanks Vladimir Zykov Software Engineer Doctor Mobile, LLC From gerard_odonnell at yahoo.co.uk Mon Mar 3 17:33:59 2014 From: gerard_odonnell at yahoo.co.uk (Gerard O'Donnell) Date: Tue Mar 4 00:30:12 2014 Subject: [xsd-users] xmldsig# signatures In-Reply-To: <1393011924.42616.YahooMailNeo@web172806.mail.ir2.yahoo.com> References: <1392903087.30182.YahooMailNeo@web172803.mail.ir2.yahoo.com> <1393011924.42616.YahooMailNeo@web172806.mail.ir2.yahoo.com> Message-ID: <1393886039.25811.YahooMailNeo@web172806.mail.ir2.yahoo.com> Not as straightforward as it sounds, Boris. Santuario will generate an XMLDSig signature easily enough, but not with the wse:SecurityToken in it. At least I can't see a way to make it do that. The KeyInfo code in Santuario requires X509Data to be an immediate child of KeyInfo. ... ??? ?? ? ??? ?? ??? ??? ? ??? ?? ??? ??? ??? ??? ? ??? ?? ??? ??? ??? ??? ??? ??? ?CN="..." ??? ?? ??? ??? ??? ??? ??? ??? ?... ??? ?? ??? ??? ??? ??? ? ??? ?? ??? ??? ? ??? ?? ? ? I've tried and failed to convince CryptXml (Windows SDK) and Santuario to work with WS-Security. Aleksey's XMLSec library sounds like it might work but requires libXML2, so my solution would need that as well as Xerces (for CodeSynthesis). Apache Rampart/C seems to be dead, even the download links don't work. CryptXML appears dead as well - information-free documentation and not a single blog post since it was released. I guess the XML Security standards are so convoluted that .NET and Java are the only players standing :) Thanks for your help, Ger O'Donnell ________________________________ From: Gerard O'Donnell To: "xsd-users@codesynthesis.com" Sent: Friday, 21 February 2014, 19:45:24 Subject: Re: [xsd-users] xmldsig# signatures Thanks for the rapid response Boris, I'll try that out. ________________________________ From: Boris Kolpackov To: Gerard O'Donnell Cc: "xsd-users@codesynthesis.com" Sent: Friday, 21 February 2014, 6:05:14 Subject: Re: [xsd-users] xmldsig# signatures Hi Gerard, Gerard O'Donnell writes: > These schemas use ##any elements - would I be right in saying that > I need to modify the XSD files locally, and replace ##any with > references to the elements that the web service will actually use? No, I would suggest that you do not modify the schema and instead "assemble" your complete document from individually serialized fragments, as shown in the 'messaging' example. > From there though I'm stuck - does CodeSynthesis offer any help with > calculating the SignatureValue and DigestValues for xmldsig? No, XSD does not provide this functionality out of the box. The recommended way is to serialize the document into DOM and then use something like Apache XML Security to add the signature: http://santuario.apache.org/ Boris From boris at codesynthesis.com Tue Mar 4 05:42:30 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Mar 4 05:45:40 2014 Subject: [xsd-users] xmldsig# signatures In-Reply-To: <1393886039.25811.YahooMailNeo@web172806.mail.ir2.yahoo.com> References: <1392903087.30182.YahooMailNeo@web172803.mail.ir2.yahoo.com> <1393011924.42616.YahooMailNeo@web172806.mail.ir2.yahoo.com> <1393886039.25811.YahooMailNeo@web172806.mail.ir2.yahoo.com> Message-ID: Hi Gerard, Gerard O'Donnell writes: > Santuario will generate an XMLDSig signature easily enough, but not with > the wse:SecurityToken in it. At least I can't see a way to make it do that. I am pretty ignorant of all things Web Services (and want to stay that way, for sanity's sake ;-)), but can't you manipulate the resulting DOM generated by Santuario to add this SecurityToken? Also, thanks for provided the state of the land overview on this topic, much appreciated. Boris From boris at codesynthesis.com Tue Mar 4 06:20:56 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Mar 4 06:24:07 2014 Subject: [xsd-users] Sequence of choices in code generated by xsd In-Reply-To: <549FA52E-C9D9-431C-A46B-E121F59FE6E5@doctormofile.us> References: <549FA52E-C9D9-431C-A46B-E121F59FE6E5@doctormofile.us> Message-ID: Hi Vladimir, Vladimir Zykov writes: > I encountered a problem with xsd when I have an unbounded sequence of > choices. I use xsd built from latest sources in cxx-tree mode. It > generates for each member of choice a sequence but I'd rather expect > to have something like in code generated by xsde in cxx-hybrid mode. Yes, C++/Tree and C++/Hybrid use different approaches to mapping compositors to C++. C++/Tree flattens the structure which results in simpler to use API but looses ordering information in some cases. C++/Hybrid recreates the compositor structure precisely which can lead to a fairly complex API for complex content models. This earlier email has more information on this: http://www.codesynthesis.com/pipermail/xsd-users/2010-March/002741.html We are also thinking of adding some extra mechanism to C++/Tree to allow preserving/specifying the element order for certain types. Let me know if you are interested in hearing what we have so far and maybe provide some feedback. Boris From mathew.benson at gmail.com Tue Mar 4 06:58:17 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Tue Mar 4 06:58:25 2014 Subject: [xsd-users] Extending the XSD code generator Message-ID: <66B20E0F-45F8-4411-BFF7-7545404273F7@gmail.com> I'm adding a set of functions to the code generated by XSD using the examples and documentation. It's going very well but was wondering if there is a mechanism in place to easily extend the code generation functionality. The functions that I'm adding are very formulaic and just extend on code already being generated. I'm adding V8 bindings so I can build my XSD generated code as a Node JS module and access all the data from c++ and the V8 JavaScript engine. Basically making a really fast javascript data engine that does not suffer from the V8 memory cap. It's similar to overriding the << operator but builds and returns a V8 object rather than a standard string. Is there an add-on mechanism to easily add code generation ability, or would this require a fork of the XSD code base? From hzazzi at kth.se Tue Mar 4 07:03:40 2014 From: hzazzi at kth.se (Henric Zazzi) Date: Tue Mar 4 08:41:22 2014 Subject: [xsd-users] parsing using cxx/tre. Possible? Message-ID: Hi I am at the moment developing a parser using cxx/tree, and would like to parse the files since they can be quite big. I know that you can use cxx/parser for this, but I have already built some code using cxx/tree, and also am worried that my XML is too complex for cxx/parser. I have tried one approach where I open a XML file like.... MyValue MyValue MyValue MyValue ..... ..... Insteaod of just loading the whole XML tree with auto_ptr p (head_(file)) I open the file for streaming and search for the tag, I then reset the filepointer to the same row as the tag and... auto_ptr p (level3_(streamfilepointer)) This would permit me to only load into RAM the object and not the whole tree. Unfortunately it did not work since it gave an error upoen execution saying "element p not recognized" or something similar. Have I missed something or is this approach feasible?? Are there any ways to achieve to stream an XML file using CodeSynthesis cxx/tree?? With kind regards Henric Zazzi From vladimir.zykov at doctormobile.us Tue Mar 4 08:00:06 2014 From: vladimir.zykov at doctormobile.us (Vladimir Zykov) Date: Tue Mar 4 08:41:22 2014 Subject: [xsd-users] Sequence of choices in code generated by xsd In-Reply-To: References: <549FA52E-C9D9-431C-A46B-E121F59FE6E5@doctormofile.us> Message-ID: <2F7C13A2-09F3-4938-9F54-AF6FDD03CB32@doctormofile.us> On Mar 4, 2014, at 1:20 PM, Boris Kolpackov wrote: > We are also thinking of adding some extra mechanism to C++/Tree to > allow preserving/specifying the element order for certain types. > Let me know if you are interested in hearing what we have so far > and maybe provide some feedback. As far as understand those mechanisms are only ideas and it will take some time to implement them. Right now the other project activities are pressing me to choose from what is currently available and this means that xsd cannot do what is very important for the project. Anyway, it would be interesting to hear your new ideas. What immediately comes to my mind is that such mechanism should allow both loading and saving preserving order of XML elements. Currently loading with preserved order is possible with XML DOM associations but as far as I understood it's not possible to save XML with arbitrary order of XML elements using similar approach. Thanks. Vladimir Zykov Software Engineer Doctor Mobile, LLC From boris at codesynthesis.com Tue Mar 4 08:48:30 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Mar 4 08:51:39 2014 Subject: [xsd-users] parsing using cxx/tre. Possible? In-Reply-To: References: Message-ID: Hi Henric, Henric Zazzi writes: > Are there any ways to achieve to stream an XML file using CodeSynthesis > cxx/tree?? Yes, see the 'streaming' example. Boris From timur.gamerov at gmail.com Tue Mar 4 14:14:37 2014 From: timur.gamerov at gmail.com (Timur Gamerov) Date: Tue Mar 4 14:14:50 2014 Subject: [xsd-users] latest xsd+dep In-Reply-To: References: <5310E8DF.3020006@gmail.com> Message-ID: <5316261D.9000706@gmail.com> Hi Boris, Would you explain how you cook xsd-4.0.0.a13+dep.tar.bz2 from git? I see, it is almost the same xsd+dep and libcutl, build, libxsd-frontend inside, all from git. But I see differences too, some files missed in git (fundamentals.*, options.* etc) On 03.03.2014 13:04, Boris Kolpackov wrote: > Hi Timur, > > Timur Gamerov writes: > >> Would anybody tell me how to cook xsd+dep from git repository? > To make xsd+dep you need to have a normal development build of > XSD and all its prerequisites (see the INSTALL file). But once > you have that, you probably don't need xsd+dep. > > Here is also the xsd+dep package for the latest repository: > > http://codesynthesis.com/~boris/tmp/xsd/xsd-4.0.0.a13+dep.tar.bz2 > > Boris -- Timur Gamerov +7 918 638-33-93 skype: timur.gamerov From Gene.Falendysz at itron.com Tue Mar 4 15:24:56 2014 From: Gene.Falendysz at itron.com (Falendysz, Gene) Date: Tue Mar 4 15:25:06 2014 Subject: [xsd-users] parsing using cxx/tre. Possible? In-Reply-To: References: Message-ID: <0d643574576940bd94bf038669c3faf8@BLUPR04MB385.namprd04.prod.outlook.com> Can you please remove me from this mailing list? Thank you, Gene Falendysz 864-718-6676 -----Original Message----- From: xsd-users-bounces@codesynthesis.com [mailto:xsd-users-bounces@codesynthesis.com] On Behalf Of Boris Kolpackov Sent: Tuesday, March 04, 2014 8:49 AM To: Henric Zazzi Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] parsing using cxx/tre. Possible? Hi Henric, Henric Zazzi writes: > Are there any ways to achieve to stream an XML file using > CodeSynthesis cxx/tree?? Yes, see the 'streaming' example. Boris From hzazzi at kth.se Tue Mar 4 10:34:55 2014 From: hzazzi at kth.se (Henric Zazzi) Date: Wed Mar 5 04:20:19 2014 Subject: [xsd-users] parsing using cxx/tre. Possible? In-Reply-To: References: , Message-ID: Thanks for your answer, I have looked at the streaming examples and also read the documents regarding stream. If I use CodeSynthesis cxx/tree to open an XML, with auto_ptr var1 (XML(streampointer)) I guessed that you do load the entire document into memory or am I wrong?? But perhaps you are referring to the streaming example in examples/cxx/tree/streaming ? I have read through that code, but it seems to me that the code is much more centered on using Xerces C++ rather than CodeSynthesis XSD, so that all the nice functionality within CodeSynthesis XSD is lost, and I can use Xerces C++ instead, or some other faster XML parser? Or is there a streaming way to access my data in the example I gave? Thanks again for your advice ________________________________________ From: Boris Kolpackov [boris@codesynthesis.com] Sent: Tuesday, March 04, 2014 2:48 PM To: Henric Zazzi Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] parsing using cxx/tre. Possible? Hi Henric, Henric Zazzi writes: > Are there any ways to achieve to stream an XML file using CodeSynthesis > cxx/tree?? Yes, see the 'streaming' example. Boris From boris at codesynthesis.com Wed Mar 5 04:25:32 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Mar 5 04:28:40 2014 Subject: [xsd-users] Extending the XSD code generator In-Reply-To: <66B20E0F-45F8-4411-BFF7-7545404273F7@gmail.com> References: <66B20E0F-45F8-4411-BFF7-7545404273F7@gmail.com> Message-ID: Hi Mathew, Mathew Benson writes: > Is there an add-on mechanism to easily add code generation ability, or > would this require a fork of the XSD code base? There are ideas to add plugin support to XSD but for now they are just that, ideas. So, yes, if you want to generate custom code then you will need to customize the XSD compiler. Boris From boris at codesynthesis.com Wed Mar 5 08:24:16 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Mar 5 08:27:25 2014 Subject: [xsd-users] latest xsd+dep In-Reply-To: <5316261D.9000706@gmail.com> References: <5310E8DF.3020006@gmail.com> <5316261D.9000706@gmail.com> Message-ID: Hi Timur, Timur Gamerov writes: > Would you explain how you cook xsd-4.0.0.a13+dep.tar.bz2 from git? I've added the dist.sh script for xsd (xsd-etc git module) as well as for all the prerequisites (*-etc modules). You will have to study that script to figure out how to make xsd+dep. > But I see differences too, some files missed in git (fundamentals.*, > options.* etc) There are generated source code files that are copied to xsd+dep so that you don't need m4, cli. Boris From mathew.benson at gmail.com Fri Mar 7 21:28:36 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Fri Mar 7 21:28:44 2014 Subject: [xsd-users] ID/IDREF problem Message-ID: I get a seg fault when I try to dereference the IDREF property. xml_schema::idref& paramRef(this->parameterRef()); std::cout << typeid(*paramRef).name() << std::endl; It crashes on the second line. I'm not really sure how to continue debugging this since I just get a seg fault. Does anybody have any ideas of what to look at? Are there any known conditions that cause a seg fault when trying to dereference a ::xml_schema::idref variable? I'm sorry for the vague question, but I've been working on this for 2 days with nothing more to go on than "segmentation fault". I worked though the sample code in the manual with no problem, and applied that to my project. From boris at codesynthesis.com Sat Mar 8 01:43:06 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sat Mar 8 01:46:28 2014 Subject: [xsd-users] ID/IDREF problem In-Reply-To: References: Message-ID: Hi Mathew, Mathew Benson writes: > I get a seg fault when I try to dereference the IDREF property. > > xml_schema::idref& paramRef(this->parameterRef()); > std::cout << typeid(*paramRef).name() << std::endl; > > It crashes on the second line. I'm not really sure how to continue > debugging this since I just get a seg fault. Does anybody have any ideas > of what to look at? Are there any known conditions that cause a seg fault > when trying to dereference a ::xml_schema::idref variable? xml_schema::idref is a smart pointer. What is a common condition that causes a seg fault when trying to dereference a smart pointer? A NULL pointer. Try printing the raw pointer to the object model node that idref is supposed to reference: std::cout << paramRef.get () << std::endl; If it is NULL, then that means there is no corresponding ID in your object model. Print the ID value like that the IDREF refers like this: std::cout << paramRef << std::endl; Then try to figure out why there is no such ID in your object model. One common cause of such problem is making a copy of a fragment of the object model rather than using references. Boris From mathew.benson at gmail.com Sat Mar 8 08:36:25 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Sat Mar 8 08:36:33 2014 Subject: [xsd-users] ID/IDREF problem In-Reply-To: References: Message-ID: Thats exactly what it looks like. I checked and it is a null pointer. The corresponding ID is defined and is in my input XML. When I delete or rename it, it fails to unmarshall and displays a correct error indicating the ID is referenced but not found. But when it is set correctly, passes validation, and should work, I get a null pointer. I'm using the xsd published by OMG and CCSDS. They apparently had not considered ID and IDREF when it was written because I had to add that myself anyway. They were just defined as unique strings. Below is a snippet of the xsd section that defines that particular ID: I'm new to the XML schema language. Is this schema malformed? The ID should be the "name" property of the "Parameter" element. On Sat, Mar 8, 2014 at 12:43 AM, Boris Kolpackov wrote: > Hi Mathew, > > Mathew Benson writes: > > > I get a seg fault when I try to dereference the IDREF property. > > > > xml_schema::idref& paramRef(this->parameterRef()); > > std::cout << typeid(*paramRef).name() << std::endl; > > > > It crashes on the second line. I'm not really sure how to continue > > debugging this since I just get a seg fault. Does anybody have any ideas > > of what to look at? Are there any known conditions that cause a seg > fault > > when trying to dereference a ::xml_schema::idref variable? > > xml_schema::idref is a smart pointer. What is a common condition that > causes a seg fault when trying to dereference a smart pointer? A NULL > pointer. Try printing the raw pointer to the object model node that > idref is supposed to reference: > > std::cout << paramRef.get () << std::endl; > > If it is NULL, then that means there is no corresponding ID in your > object model. Print the ID value like that the IDREF refers like > this: > > std::cout << paramRef << std::endl; > > Then try to figure out why there is no such ID in your object > model. One common cause of such problem is making a copy of > a fragment of the object model rather than using references. > > Boris > From mathew.benson at gmail.com Sun Mar 9 04:11:58 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Sun Mar 9 04:12:07 2014 Subject: [xsd-users] ID/IDREF problem In-Reply-To: References: Message-ID: I narrowed it down to the schema element. When I put an ID and an IDREF in a block, everything works perfectly. But when I put them in blocks, the unmarshaller validates correctly but the smart pointer is null. Can an item in a choice block not have an IDREF? What am I doing wrong? On Sat, Mar 8, 2014 at 7:36 AM, Mathew Benson wrote: > Thats exactly what it looks like. I checked and it is a null pointer. > The corresponding ID is defined and is in my input XML. When I delete or > rename it, it fails to unmarshall and displays a correct error indicating > the ID is referenced but not found. But when it is set correctly, passes > validation, and should work, I get a null pointer. > > I'm using the xsd published by OMG and CCSDS. They apparently had not > considered ID and IDREF when it was written because I had to add that > myself anyway. They were just defined as unique strings. Below is a > snippet of the xsd section that defines that particular ID: > > > > > > > > > minOccurs="0"/> > > > > > > > > > > > I'm new to the XML schema language. Is this schema malformed? The ID > should be the "name" property of the "Parameter" element. > > > On Sat, Mar 8, 2014 at 12:43 AM, Boris Kolpackov wrote: > >> Hi Mathew, >> >> Mathew Benson writes: >> >> > I get a seg fault when I try to dereference the IDREF property. >> > >> > xml_schema::idref& paramRef(this->parameterRef()); >> > std::cout << typeid(*paramRef).name() << std::endl; >> > >> > It crashes on the second line. I'm not really sure how to continue >> > debugging this since I just get a seg fault. Does anybody have any >> ideas >> > of what to look at? Are there any known conditions that cause a seg >> fault >> > when trying to dereference a ::xml_schema::idref variable? >> >> xml_schema::idref is a smart pointer. What is a common condition that >> causes a seg fault when trying to dereference a smart pointer? A NULL >> pointer. Try printing the raw pointer to the object model node that >> idref is supposed to reference: >> >> std::cout << paramRef.get () << std::endl; >> >> If it is NULL, then that means there is no corresponding ID in your >> object model. Print the ID value like that the IDREF refers like >> this: >> >> std::cout << paramRef << std::endl; >> >> Then try to figure out why there is no such ID in your object >> model. One common cause of such problem is making a copy of >> a fragment of the object model rather than using references. >> >> Boris >> > > From mathew.benson at gmail.com Sun Mar 9 18:37:21 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Sun Mar 9 18:37:30 2014 Subject: [xsd-users] ID in Message-ID: XSD doesn't associate an item with an ID attribute in a block. When I move it to a . It works just fine. What is special with the block? What can I do to make it work? From boris at codesynthesis.com Mon Mar 10 02:13:38 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Mar 10 02:17:01 2014 Subject: [xsd-users] ID/IDREF problem In-Reply-To: References: Message-ID: Hi Mathew, Mathew Benson writes: > What am I doing wrong? If the schema validates correctly, then that means you have a valid ID-IDREF link. The problem is most likely a copy of the object model fragment that you are making while getting to the IDREF element. If you make a copy of the object model fragment, it becomes independant of the whole model and does not contain the ID element. Make sure you are using references when accessing the data. If not sure, show us the code that you have from parsing the object model to where you dereference IDREF. Boris From mathew.benson at gmail.com Mon Mar 10 12:19:14 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Mon Mar 10 12:19:21 2014 Subject: [xsd-users] ID/IDREF problem In-Reply-To: References: Message-ID: Thanks for the help. I don't want to waste your time, so I'm trying to verify that the object model is not copied anywhere in my code or the framework I'm using. I can't see how the underlying framework (not xsd generated code) would copy just a fragment of the object model, but it is possible the framework is copying the entire object I created and unmarshalled. Could that cause this problem? What if the copy constructor was not overridden in the derived class? Also, why would this work when I move the ID and IDREF elements from the block to a block? On Mon, Mar 10, 2014 at 1:13 AM, Boris Kolpackov wrote: > Hi Mathew, > > Mathew Benson writes: > > > What am I doing wrong? > > If the schema validates correctly, then that means you have a > valid ID-IDREF link. The problem is most likely a copy of the > object model fragment that you are making while getting to the > IDREF element. If you make a copy of the object model fragment, > it becomes independant of the whole model and does not contain > the ID element. Make sure you are using references when accessing > the data. If not sure, show us the code that you have from parsing > the object model to where you dereference IDREF. > > Boris > From mathew.benson at gmail.com Mon Mar 10 18:39:12 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Mon Mar 10 18:39:20 2014 Subject: [xsd-users] ID/IDREF problem In-Reply-To: References: Message-ID: I figured it out. When I moved it from the to , that also changed how I referenced the object, so that was a red herring. The problem was I casted all my dereferenced iterators as objects, not as references to objects. I was running code in code space, but the data space was incorrect so all my member attributes were messed up. I would have found it faster if it had crashed while traversing the tree. Once I put my code back together again, it should all work. Thanks. On Mon, Mar 10, 2014 at 11:19 AM, Mathew Benson wrote: > Thanks for the help. I don't want to waste your time, so I'm trying to > verify that the object model is not copied anywhere in my code or the > framework I'm using. I can't see how the underlying framework (not xsd > generated code) would copy just a fragment of the object model, but it is > possible the framework is copying the entire object I created and > unmarshalled. Could that cause this problem? What if the copy constructor > was not overridden in the derived class? Also, why would this work when I > move the ID and IDREF elements from the block to a > block? > > > On Mon, Mar 10, 2014 at 1:13 AM, Boris Kolpackov wrote: > >> Hi Mathew, >> >> Mathew Benson writes: >> >> > What am I doing wrong? >> >> If the schema validates correctly, then that means you have a >> valid ID-IDREF link. The problem is most likely a copy of the >> object model fragment that you are making while getting to the >> IDREF element. If you make a copy of the object model fragment, >> it becomes independant of the whole model and does not contain >> the ID element. Make sure you are using references when accessing >> the data. If not sure, show us the code that you have from parsing >> the object model to where you dereference IDREF. >> >> Boris >> > > From mathew.benson at gmail.com Mon Mar 10 23:23:25 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Mon Mar 10 23:23:33 2014 Subject: [xsd-users] Subclassing XSD generated subclasses Message-ID: What is the best way to provide a custom class (subclass) XSD generated subclasses? I wrote custom classes for all my first tier classes but it would make things much easier if I could write custom classes for the classes they inherit from too. The problem is I run into circular references. Any recommendations? From Reiner.Rohlfs at unige.ch Mon Mar 10 12:19:11 2014 From: Reiner.Rohlfs at unige.ch (Reiner Rohlfs) Date: Tue Mar 11 01:00:37 2014 Subject: [xsd-users] XSD generated code does not compile with g++ 4.8 In-Reply-To: References: Message-ID: Dear Boris, we applied the path and it is working fine. Do you have already an RPM for LINUX x86-64 with this patch? This would make it easier for us to install it on several machines. Thanks Reiner. On Feb 12, 2014, at 3:35 PM, Boris Kolpackov wrote: > Hi Reiner, > > Reiner Rohlfs writes: > >> and try to compile it with g++ 4.8.2: >> >> g++ -c fits_data_model_schema.cxx >> >> and get following error from the compiler: > > Yes, this is a know problem which is fixed for the next release > of XSD. In the meantime, you can apply the following patch to > your XSD 3.3.0 installation to fix this issue: > > http://codesynthesis.com/~boris/tmp/xsd/xsd-3.3.0-gcc-4.7-clang.patch > > Boris > > From boris at codesynthesis.com Tue Mar 11 00:59:11 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Mar 11 01:02:33 2014 Subject: [xsd-users] Subclassing XSD generated subclasses In-Reply-To: References: Message-ID: Hi Mathew, Mathew Benson writes: > What is the best way to provide a custom class (subclass) XSD generated > subclasses? [...] The problem is I run into circular references. See the C++/Tree Mapping Customization Guide: http://wiki.codesynthesis.com/Tree/Customization_guide As well as the examples in the examples/cxx/tree/custom/ directory. Boris From mathew.benson at gmail.com Tue Mar 11 01:37:28 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Tue Mar 11 01:37:37 2014 Subject: [xsd-users] Subclassing XSD generated subclasses In-Reply-To: References: Message-ID: <6475C89F-2CAD-4C37-9324-672BD5D59009@gmail.com> I found those immediately after sending the email. I kept running into circular inclusions trying to get my constructors arguments to compile. I have 300 classes to subtype to inherit a couple hundred properties. At the time, it seemed like far more effort to get this to work, than to just put all the smarts in my 30 derived classes and not put custom functions in the base classes. I thought this would be faster than cutting and pasting code. Sent from my iPhone > On Mar 10, 2014, at 11:59 PM, Boris Kolpackov wrote: > > Hi Mathew, > > Mathew Benson writes: > >> What is the best way to provide a custom class (subclass) XSD generated >> subclasses? [...] The problem is I run into circular references. > > See the C++/Tree Mapping Customization Guide: > > http://wiki.codesynthesis.com/Tree/Customization_guide > > As well as the examples in the examples/cxx/tree/custom/ directory. > > Boris From boris at codesynthesis.com Tue Mar 11 07:25:14 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Mar 11 07:28:36 2014 Subject: [xsd-users] XSD generated code does not compile with g++ 4.8 In-Reply-To: References: Message-ID: Hi Reiner, Reiner Rohlfs writes: > we applied the path and it is working fine. Do you have already an RPM > for LINUX x86-64 with this patch? Not yet. The new release with all the fixes is coming soon. Boris From marcus.a.brubaker at gmail.com Tue Mar 11 18:31:30 2014 From: marcus.a.brubaker at gmail.com (Marcus Brubaker) Date: Tue Mar 11 18:31:37 2014 Subject: [xsd-users] Help using xsd::cxx::tree::date_time Message-ID: Hi, I'm currently trying to update some old C++ code which used XSD to write out XML files. As part of it, one of the fields is a date_time object. I need to be able to construct one of these by parsing a std::wstring but seem to be unable to do so. It looks like there is an istream constructor for the date_time object, but compilation fails (with MSVC2010) when I attempt to use a std::wistringstream with it. It seems like this should be a simple task to perform, but I haven't had much luck finding information in the documentation. Could someone maybe post a short code snippet that should work for this task? I would greatly appreciate it. Thanks! Cheers, Marcus From boris at codesynthesis.com Wed Mar 12 09:30:58 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Mar 12 09:34:21 2014 Subject: [xsd-users] Help using xsd::cxx::tree::date_time In-Reply-To: References: Message-ID: Hi Marcus, Marcus Brubaker writes: > I need to be able to construct one of these by parsing a std::wstring > but seem to be unable to do so. The easiest way would be to convert your std::wstring to std::string (a valid date-time value cannot have any non-ANSI characters in it) and then use std::istringstream to parse it into xml_schema::date_time. Boris From albert.babinskas at imagingsciences.com Fri Mar 14 11:24:50 2014 From: albert.babinskas at imagingsciences.com (Babinskas, Albert) Date: Fri Mar 14 11:25:00 2014 Subject: [xsd-users] Parsing of any type of xml fails Message-ID: <004e3cb154404f5fb6b3c3abdfd497c2@DENORASPEXCH1.sds.sybrondental.com> Hi, My Xml snippet looks like this: 0 0 My Xsd snippet for that data looks like this: When I try to parse the xml, I get an std exception, when it is parsing the xml into dom object (xml::dom::auto_ptr doc (domParser->parse (&wrap))). If I remove that xml snippet from my xml, I am able to parse the whole xml document. -Albert From boris at codesynthesis.com Mon Mar 17 09:28:05 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Mar 17 09:31:26 2014 Subject: [xsd-users] Parsing of any type of xml fails In-Reply-To: <004e3cb154404f5fb6b3c3abdfd497c2@DENORASPEXCH1.sds.sybrondental.com> References: <004e3cb154404f5fb6b3c3abdfd497c2@DENORASPEXCH1.sds.sybrondental.com> Message-ID: Hi Albert, Babinskas, Albert writes: > When I try to parse the xml, I get an std exception, when it is parsing > the xml into dom object (xml::dom::auto_ptr doc ( > domParser->parse (&wrap))). I assume you are doing your own DOM parsing (i.e., you have created domParser yourself). If you are catching std::exception, try to print it's descirption to find out more about what's going on: catch (const std::exception& e) { cerr << e.what () << endl; } Boris From Arul.Prakash2 at rsa.com Fri Mar 21 14:57:30 2014 From: Arul.Prakash2 at rsa.com (Prakash, Arul) Date: Sat Mar 22 02:04:56 2014 Subject: [xsd-users] Help to find the cause of the crash Message-ID: <812A2F2BABC6B44BB698704DBF6713AA2643DE80@MX34A.corp.emc.com> Hi, When I run my multithreaded application an quadcore machine I am facing a crash in xerces dll. My windbg stacktrace points out this FAULTING_IP: xerces_c_3_1_vc80!xercesc_3_1::DOMImplementationRegistry::getDOMImplementation+31 120e2681 8b30 mov esi,dword ptr [eax] EXCEPTION_RECORD: ffffffff -- (.exr 0xffffffffffffffff) ExceptionAddress: 120e2681 (xerces_c_3_1_vc80!xercesc_3_1::DOMImplementationRegistry::getDOMImplementation+0x00000031) ExceptionCode: c0000005 (Access violation) ExceptionFlags: 00000000 NumberParameters: 2 Parameter[0]: 00000000 Parameter[1]: 00000000 Attempt to read from address 00000000 FAULTING_THREAD: 000019ec I tried to catch this exception with these catch blocks unsuccessfully catch (const XMLException& toCatch) { char* message = XMLString::transcode(toCatch.getMessage()); cout << "xerces exception :" << message; XMLString::release(&message); return -1; } catch (const DOMException& toCatch) { char* message = XMLString::transcode(toCatch.msg); cout <<"xerces DOMexception :" << message; XMLString::release(&message); return -1; } What could be the reason for this exception? Thanks Arul From mathew.benson at gmail.com Sat Mar 22 13:10:35 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Sat Mar 22 13:10:43 2014 Subject: [xsd-users] Copying objects Message-ID: What's the best way to copy an object or reference to an object and retain the IDREF pointers? I'm writing a function that needs to collect various objects in the object model and I wanted to use one of the XSD created objects as a container. It already contains vectors containing the objects I want to collect. But I noticed when I call push_back() to store the object away, its making a copy and the IDREF pointers are null. Or should I just create a custom container and store pointers? From mathew.benson at gmail.com Sat Mar 22 13:32:38 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Sat Mar 22 13:32:46 2014 Subject: [xsd-users] Re: Copying objects In-Reply-To: References: Message-ID: I should clarify. My model has a container class called CommandContainerEntryListType which contains various objects including a ParameterRefEntry sequence. My function walks the model and basically merges the various CommandContainerEntryListType objects together into a single object returned by the function. But the IDREF pointers are null. I think the following is the root of the problem: getEntryList() { CommandContainerEntryListType entryList; /* This is the problem. */ /* Start walking the model. */ That "entryList" object is meant to contain the collected objects. The problem is that its created outside the DOM so IDREFs couldn't possibly point to the original ID. I would really need to create the entryList object in the same DOM. Just for closure is it even possible to create an object in the DOM without actually attaching it as a child to another object? I'm thinking no. I'm thinking this is a bad solution anyway. I think a better solution is to just create a custom container and store references to the objects. On Sat, Mar 22, 2014 at 12:10 PM, Mathew Benson wrote: > What's the best way to copy an object or reference to an object and retain > the IDREF pointers? I'm writing a function that needs to collect various > objects in the object model and I wanted to use one of the XSD created > objects as a container. It already contains vectors containing the objects > I want to collect. But I noticed when I call push_back() to store the > object away, its making a copy and the IDREF pointers are null. Or should > I just create a custom container and store pointers? > From Arul.Prakash2 at rsa.com Sat Mar 22 13:37:08 2014 From: Arul.Prakash2 at rsa.com (Prakash, Arul) Date: Sun Mar 23 03:31:34 2014 Subject: [xsd-users] RE: Help to find the cause of the crash Message-ID: <812A2F2BABC6B44BB698704DBF6713AA2643DE95@MX34A.corp.emc.com> More detailed stack trace . I don't know what could be the reason for this Im getting this very rarely in my multithreaded program. Any pointers would be much appreciated. Thanks ULTING_IP: aceclnt_tcp!xercesc_3_1::XMLMutex::lock+a [c:\work\xerces-c-3.1.1\xerces-c-3.1.1\src\xercesc\util\mutexes.cpp @ 61] 00537e9a 8b08 mov ecx,dword ptr [eax] EXCEPTION_RECORD: ffffffff -- (.exr 0xffffffffffffffff) ExceptionAddress: 00537e9a (aceclnt_tcp!xercesc_3_1::XMLMutex::lock+0x0000000a) ExceptionCode: c0000005 (Access violation) ExceptionFlags: 00000000 NumberParameters: 2 Parameter[0]: 00000000 Parameter[1]: 00000000 Attempt to read from address 00000000 FAULTING_THREAD: 000011c4 PROCESS_NAME: sample.exe ADDITIONAL_DEBUG_TEXT: Use '!findthebuild' command to search for the target build information. If the build information is available, run '!findthebuild -s ; .reload' to set symbol path and load symbols. FAULTING_MODULE: 7c800000 ntdll DEBUG_FLR_IMAGE_TIMESTAMP: 532daa1b ERROR_CODE: (NTSTATUS) 0xc0000005 - The instruction at "0x%08lx" referenced memory at "0x%08lx". The memory could not be "%s". EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - The instruction at "0x%08lx" referenced memory at "0x%08lx". The memory could not be "%s". EXCEPTION_PARAMETER1: 00000000 EXCEPTION_PARAMETER2: 00000000 READ_ADDRESS: 00000000 FOLLOWUP_IP: aceclnt_tcp!xercesc_3_1::XMLMutex::lock+a [c:\work\xerces-c-3.1.1\xerces-c-3.1.1\src\xercesc\util\mutexes.cpp @ 61] 00537e9a 8b08 mov ecx,dword ptr [eax] BUGCHECK_STR: APPLICATION_FAULT_NULL_POINTER_READ_WRONG_SYMBOLS PRIMARY_PROBLEM_CLASS: NULL_POINTER_READ DEFAULT_BUCKET_ID: NULL_POINTER_READ LAST_CONTROL_TRANSFER: from 00537ef1 to 00537e9a STACK_TEXT: 0264e49c 00537ef1 0264e4d8 0264e4e8 0054c453 aceclnt_tcp!xercesc_3_1::XMLMutex::lock+0xa [c:\work\xerces-c-3.1.1\xerces-c-3.1.1\src\xercesc\util\mutexes.cpp @ 61] 0264e4a8 0054c453 00000000 f90fe718 0264e4d8 aceclnt_tcp!xercesc_3_1::XMLMutexLock::XMLMutexLock+0x21 [c:\work\xerces-c-3.1.1\xerces-c-3.1.1\src\xercesc\util\mutexes.cpp @ 79] 0264e4e8 00464f14 0264e7cc f90febb4 7c83dd0b aceclnt_tcp!xercesc_3_1::DOMImplementationRegistry::getDOMImplementation+0x33 [c:\work\xerces-c-3.1.1\xerces-c-3.1.1\src\xercesc\dom\impl\domimplementationregistry.cpp @ 62] 0264e844 0046211c 0264e880 0264e884 0264e8a0 aceclnt_tcp!xsd::cxx::xml::dom::serialize+0x124 [c:\work\prakaa2_rsablrlegp1-125_2564\library\codesynthesis\xsd\cxx\xml\dom\serialization-source.txx @ 164] 0264e8c8 006fc7dc 0264e8f4 009fa618 009fa5dc aceclnt_tcp!xsd::cxx::xml::dom::serialize+0x7c [c:\work\prakaa2_rsablrlegp1-125_2564\library\codesynthesis\xsd\cxx\xml\dom\serialization-source.hxx @ 74] 0264e908 006fc8c3 0264e92c 0264f864 0264f180 aceclnt_tcp!CommonAPI::authentication::AuthnRequest+0x4c [c:\work\prakaa2_rsablrlegp1-125_2564\dev\auth-agent-sdk\src\auth-c_api\xmllayer\xsdtocpp\commonapi-authn.cxx @ 13886] 0264ed74 00715ff0 0264f71c 0264f864 0264f180 aceclnt_tcp!CommonAPI::authentication::AuthnRequest+0x63 [c:\work\prakaa2_rsablrlegp1-125_2564\dev\auth-agent-sdk\src\auth-c_api\xmllayer\xsdtocpp\commonapi-authn.cxx @ 13755] 0264fa24 00433ac0 01056ee8 0264fb4c f90ff9c8 aceclnt_tcp!XMLWrapper::MarshalUnmarshal::CreateRequest+0x9f0 [c:\work\prakaa2_rsablrlegp1-125_2564\dev\auth-agent-sdk\src\auth-c_api\xmllayer\marshalunmarshal\marshalunmarshal.cpp @ 514] 0264fd1c 00432880 0264fd48 f90ffedc 00000001 aceclnt_tcp!AuthV8Session::processAuthRequest+0x360 [c:\work\prakaa2_rsablrlegp1-125_2564\dev\auth-agent-sdk\src\auth-c_api\authinterface\authv8session.cpp @ 1049] 0264fd90 004326b1 012f4b08 74736574 0264fd00 aceclnt_tcp!AuthV8Session::check+0x110 [c:\work\prakaa2_rsablrlegp1-125_2564\dev\auth-agent-sdk\src\auth-c_api\authinterface\authv8session.cpp @ 786] 0264fdec 004157de f90ffe08 0012e49c 0264fe6b aceclnt_tcp!AuthV8Session::check+0xd1 [c:\work\prakaa2_rsablrlegp1-125_2564\dev\auth-agent-sdk\src\auth-c_api\authinterface\authv8session.cpp @ 755] 0264fe20 67fd23e1 00018690 00404024 0040401c aceclnt_tcp!SD_Check+0x41e [c:\work\prakaa2_rsablrlegp1-125_2564\dev\auth-agent-sdk\src\auth-c_api\aceclnt\sd_api.cpp @ 691] 0264fe34 00401196 00018690 00404024 0040401c ACECLNT!SD_Check+0x29 [c:\work\prakaa2_rsablrlegp1-125_2564\dev\auth-agent-sdk\src\auth-c_api\shim\newsd_api.c @ 103] WARNING: Stack unwind information not available. Following frames may be wrong. 0264ffb8 77e6482f 00000000 00000000 00000000 sample+0x1196 0264ffec 00000000 00401000 00000000 00000000 kernel32!GetModuleHandleA+0xdf SYMBOL_STACK_INDEX: 0 SYMBOL_NAME: aceclnt_tcp!xercesc_3_1::XMLMutex::lock+a FOLLOWUP_NAME: MachineOwner MODULE_NAME: aceclnt_tcp IMAGE_NAME: aceclnt_tcp.dll STACK_COMMAND: ~28s ; kb BUCKET_ID: WRONG_SYMBOLS FAILURE_BUCKET_ID: NULL_POINTER_READ_c0000005_aceclnt_tcp.dll!xercesc_3_1::XMLMutex::lock Followup: MachineOwner --------- From: Prakash, Arul Sent: Saturday, March 22, 2014 12:28 AM To: xsd-users@codesynthesis.com Subject: Help to find the cause of the crash Hi, When I run my multithreaded application an quadcore machine I am facing a crash in xerces dll. My windbg stacktrace points out this FAULTING_IP: xerces_c_3_1_vc80!xercesc_3_1::DOMImplementationRegistry::getDOMImplementation+31 120e2681 8b30 mov esi,dword ptr [eax] EXCEPTION_RECORD: ffffffff -- (.exr 0xffffffffffffffff) ExceptionAddress: 120e2681 (xerces_c_3_1_vc80!xercesc_3_1::DOMImplementationRegistry::getDOMImplementation+0x00000031) ExceptionCode: c0000005 (Access violation) ExceptionFlags: 00000000 NumberParameters: 2 Parameter[0]: 00000000 Parameter[1]: 00000000 Attempt to read from address 00000000 FAULTING_THREAD: 000019ec I tried to catch this exception with these catch blocks unsuccessfully catch (const XMLException& toCatch) { char* message = XMLString::transcode(toCatch.getMessage()); cout << "xerces exception :" << message; XMLString::release(&message); return -1; } catch (const DOMException& toCatch) { char* message = XMLString::transcode(toCatch.msg); cout <<"xerces DOMexception :" << message; XMLString::release(&message); return -1; } What could be the reason for this exception? Thanks Arul From mathew.benson at gmail.com Sun Mar 23 23:34:32 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Sun Mar 23 23:34:40 2014 Subject: [xsd-users] Element order Message-ID: XSD didn't generate code that I expected. My xsd file has the following definition: an XML snippet might look like: Maybe the xsd is defined wrong, but its supposed to be an ordered list of a mix of various elements. The problem is the generated code results in separate sequences of each separate element so overall order within the container is lost. What can I do to retain order? From boris at codesynthesis.com Mon Mar 24 10:26:14 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Mar 24 10:29:37 2014 Subject: [xsd-users] RE: Help to find the cause of the crash In-Reply-To: <812A2F2BABC6B44BB698704DBF6713AA2643DE95@MX34A.corp.emc.com> References: <812A2F2BABC6B44BB698704DBF6713AA2643DE95@MX34A.corp.emc.com> Message-ID: Hi Arul, My first guess would be that you are initializing the Xerces-C++ runtime (implicitly or explicitly) concurrently from multiple threads. See this FAQ entry for further information: http://wiki.codesynthesis.com/Tree/FAQ#Is_the_generated_code_thread-safe.3F Boris From boris at codesynthesis.com Mon Mar 24 10:43:12 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Mar 24 10:46:34 2014 Subject: [xsd-users] Re: Copying objects In-Reply-To: References: Message-ID: Hi Mathew, You really have a knack for overcomplicating things. I am typically lost at about the second sentence of your email ;-). Here is how the ID/IDREF stuff works in C++/Tree. The resolution of the IDREF is dynamic. That is, every time you call get() or operator->(), the idref class searches the object model that it belongs to for the matching ID. In particular, notice this phrase in the above sentence: "searches the object model that it belongs to". That's the important part to understand and that I believe is the key to your struggles. Let me try to illustrate this with an example. Say we have type Root that has two elements of type Foo and Bar. Foo has the ID attribute (let's call it id) and Bar has the IDREF attribute (let's call it ref). Here is some code that illustrates what I am talking about: Bar b; b.ref ("a"); // b.ref is NULL. Foo f; f.id ("a"); // b.ref is still NULL since f and b don't belong to the same model. Root r; r.bar (b); // r.bar.ref is still NULL. r.foo (f); // r.bar.ref now points to r.foo. BUT: b.ref is still NULL. Bar b1 (r.bar ()); // b1.ref is NULL since it does not belong to r (a copy). Bar& b2 (r.bar ()); // b2.ref is not NULL. r.foo ().id ("b"); // r.bar.ref is now NULL since there is no ID "a" in the object model. Boris From boris at codesynthesis.com Mon Mar 24 10:48:29 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Mar 24 10:51:52 2014 Subject: [xsd-users] Element order In-Reply-To: References: Message-ID: Hi Mathew, Mathew Benson writes: > The problem is the generated code results in separate sequences of > each separate element so overall order within the container is lost. This earlier email has more information on this: http://www.codesynthesis.com/pipermail/xsd-users/2010-March/002741.html I am also working on better support for element ordering for the next release as we speak. It should be ready for beta-testing in about a week, if you are interested. Boris From mathew.benson at gmail.com Mon Mar 24 11:15:07 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Mon Mar 24 11:15:17 2014 Subject: [xsd-users] Re: Copying objects In-Reply-To: References: Message-ID: I got it. I think we were saying the same thing, you are just able to state it better. The problem is when I created an object with the new operator, it didn't belong to the DOM. I found a better solution. Sent from my iPhone > On Mar 24, 2014, at 9:43 AM, Boris Kolpackov wrote: > > Hi Mathew, > > You really have a knack for overcomplicating things. I am typically > lost at about the second sentence of your email ;-). > > Here is how the ID/IDREF stuff works in C++/Tree. The resolution > of the IDREF is dynamic. That is, every time you call get() or > operator->(), the idref class searches the object model that it > belongs to for the matching ID. > > In particular, notice this phrase in the above sentence: "searches > the object model that it belongs to". That's the important part > to understand and that I believe is the key to your struggles. > > Let me try to illustrate this with an example. Say we have type > Root that has two elements of type Foo and Bar. Foo has the ID > attribute (let's call it id) and Bar has the IDREF attribute > (let's call it ref). Here is some code that illustrates what > I am talking about: > > Bar b; > b.ref ("a"); > > // b.ref is NULL. > > Foo f; > f.id ("a"); > > // b.ref is still NULL since f and b don't belong to the same model. > > Root r; > r.bar (b); > > // r.bar.ref is still NULL. > > r.foo (f); > > // r.bar.ref now points to r.foo. BUT: b.ref is still NULL. > > Bar b1 (r.bar ()); > > // b1.ref is NULL since it does not belong to r (a copy). > > Bar& b2 (r.bar ()); > > // b2.ref is not NULL. > > r.foo ().id ("b"); > > // r.bar.ref is now NULL since there is no ID "a" in the object model. > > Boris From mathew.benson at gmail.com Mon Mar 24 11:18:22 2014 From: mathew.benson at gmail.com (Mathew Benson) Date: Mon Mar 24 11:18:30 2014 Subject: [xsd-users] Element order In-Reply-To: References: Message-ID: <04A71E67-C9F8-4726-B177-329F1667691E@gmail.com> Yes. I would definitely be interested. This would have been a show stopper for me. I understand it's in beta and am willing to work with you on any issues. Thanks. Sent from my iPhone > On Mar 24, 2014, at 9:48 AM, Boris Kolpackov wrote: > > Hi Mathew, > > Mathew Benson writes: > >> The problem is the generated code results in separate sequences of >> each separate element so overall order within the container is lost. > > This earlier email has more information on this: > > http://www.codesynthesis.com/pipermail/xsd-users/2010-March/002741.html > > I am also working on better support for element ordering for the > next release as we speak. It should be ready for beta-testing in > about a week, if you are interested. > > Boris From boris at codesynthesis.com Tue Mar 25 09:23:04 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Mar 25 09:26:25 2014 Subject: [xsd-users] Element order In-Reply-To: <04A71E67-C9F8-4726-B177-329F1667691E@gmail.com> References: <04A71E67-C9F8-4726-B177-329F1667691E@gmail.com> Message-ID: Hi Mathew, Mathew Benson writes: > I would definitely be interested. This would have been a show > stopper for me. I understand it's in beta and am willing to work > with you on any issues. Great, I will let you know when it's ready. Boris