From boris at codesynthesis.com Thu May 3 09:14:25 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Re: using contianers - please advice In-Reply-To: <067201c78d81$c46f6200$5901010a@int.hyperroll.com> References: <067201c78d81$c46f6200$5901010a@int.hyperroll.com> Message-ID: <20070503131425.GA5692@karelia> Hi Uri, Please send technical questions like this to the xsd-users mailing (CC'ed) instead of directly to me. Note that I've already asked you to do so in my previous email. Uri Karagila writes: > Boris, > > Following provided cxx-tree-manual.pdf (XML Schema C++/Tree Mapping User > Manual, v1.2.5) sec. 2.8.3 (p. 31): > > "The sequence class template is defined in an implementation-specific > namespace. It conforms > > to the sequence interface as defined by the ISO/ANSI Standard for C++ > (ISO/IEC 14882:1998, > > Section 23.1.1, "Sequences"). Practically, this means that you can treat > such a sequence as if it > > was std::vector." > > The following code shows how one could use this mapping: > > .. > > .. > > // Setting a new container. > > // > > object::member::container n; > > n.push_back (1); > > o.member (n); > > .. > > > > I've written few code line in which: > > .. > > SourceList::source::container cont1; //set new container > > > > some how i'm not able to use my cont1 as std::vector. You need to show us the code where you are not able to do so. The above line simply creates an instance of the container without adding any elements to it or setting it as a member of a tree. > > > > Where am I wrong? > > > > Please advice > > > > Thanks in Advance > > Uri > hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070503/a2e9c8d5/attachment.pgp From boris at codesynthesis.com Mon May 7 10:11:57 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Article on XML Data Binding in The C++ Source Message-ID: <20070507141157.GC18522@karelia> Hi, An article introducing XML Data Binding in C++ just got published in The C++ Source online journal. It covers both in-memory and stream- oriented processing models and provides comparison to raw XML access APIs such as DOM and SAX: http://www.artima.com/cppsource/xml_data_binding.html There is also an interesting discussion going on: http://www.artima.com/forums/threaded.jsp?forum=226&thread=204721 Take care, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070507/6d72bbb3/attachment.pgp From uri at hyperroll.com Wed May 9 08:40:51 2007 From: uri at hyperroll.com (Uri Karagila) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] "flushing" xml object tree into xml file - please advise Message-ID: <783879783B65E44995520FEF376C4538C9D3@ilexch1.int.hyperroll.com> Hi, In case my xml tree is fully loaded, how can I "flush" it into file.xml? Can you please point to relevant documentation or provide useful example. 10x Uri From boris at codesynthesis.com Wed May 9 09:05:52 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] "flushing" xml object tree into xml file - please advise In-Reply-To: <783879783B65E44995520FEF376C4538C9D3@ilexch1.int.hyperroll.com> References: <783879783B65E44995520FEF376C4538C9D3@ilexch1.int.hyperroll.com> Message-ID: <20070509130552.GB28557@karelia> Hi Uri, Thanks for remembering to post your question to xsd-users. Uri Karagila writes: > In case my xml tree is fully loaded, how can I "flush" it into file.xml? > > Can you please point to relevant documentation or provide useful > example. First of all you will need to compile your schemas with the --generate-serialization option in order to generate the serialization code. The library example (in examples/cxx/tree) shows how to write the tree to stdout (std::cout object). In order to write it to a file, you can replace this line: catalog_ (std::cout, *c, map); with something like this: std::ofstream ofs ("file.xml"); catalog_ (ofs, *c, map); (You will also need to add #include at the beginning). For more information on serializing the in-memory representation to XML, refer to Chapter 4, "Serialization", of the C++/Tree Mapping User Manual: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#4 hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070509/972790d2/attachment.pgp From mhoffm1060 at aol.com Wed May 9 14:00:51 2007 From: mhoffm1060 at aol.com (mhoffm1060@aol.com) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] RE: serializing ##other Message-ID: <8C9607B1DA01B55-15D8-19FE@FWM-D32.sysops.aol.com> Hi Boris, I was wondering if this feature was still being perused. ( I would like to be able to get the DOMElement(s) for the xml that falls into the ##other category ). If this is still in development is there any idea of when it will make it into a release? Thanks, Mark [xsd-users] serializing ##other Boris Kolpackov boris at codesynthesis.com Thu Jan 11 16:06:01 EST 2007 Previous message: [xsd-users] serializing ##other Next message: [xsd-users] [Problem] Types not found. Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] Hi Bradley, Bradley Beddoes writes: > Secondly is there a search function for the mail list history? I > couldn't seem to locate one and google wasn't much help. Not yet. But google should be good for that. Just add site:codesynthesis.com to your search term (the added advantage being that other resources such as docs, wiki, etc. are also searched). > We have part of our schema defined as so: > > > maxOccurs="unbounded"/> > > > > For some reason when invoking the << operator the data that is in the > source document is not being serialized. Serialization does not yet support wildcards. In fact the data that is associated with a wildcard is normally ignored and the only way to get to it is to: 1. use DOM association (keep_dom flag) or 2. customize the type and extract the data in c-tor(DOMElement&). The way to add support for wildcard serialization would be to override the serialization operator and serialize the wildcard- corresponding elements yourself. If you use DOM association then you can just import the nodes from the associated DOM document to the one into which you are serializing. If you use the custom c-tor way then you will need to store the DOM sub-tree somehow in the instance. One way to do this would be to create a mini DOM document just for that instance and store the elements there (as you probably know, in Xerces-C++ DOM an element always belongs to some document). This should all work nicely except that at the moment you cannot override the generated serialization operator if you are also generating the original mapping to inherit from (the operator<< will be generated with the actual type name instead of the (renamed) base type name). But I think in your case you can implement ExtensionsType from scratch since there is nothing there except the wildcard. I am also going to fix this bug tomorrow so let me know if you need a binary with this fix. I would also like to add better support for wildcards in the generated code, including out of the box support for serialization. The problem is it's non-trivial to get it right in general case especially when there is no full validation in the generate code. I think the first step would be to generate a set of accessors/ modifiers for each wildcard and store the raw DOM fragments that correspond to them in the node. hth, -boris ________________________________________________________________________ AOL now offers free email to everyone. Find out more about what's free from AOL at AOL.com. From boris at codesynthesis.com Wed May 9 14:18:09 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] RE: serializing ##other In-Reply-To: <8C9607B1DA01B55-15D8-19FE@FWM-D32.sysops.aol.com> References: <8C9607B1DA01B55-15D8-19FE@FWM-D32.sysops.aol.com> Message-ID: <20070509181809.GB29106@karelia> Hi Mark, mhoffm1060@aol.com writes: > I was wondering if this feature was still being perused. ( I would > like to be able to get the DOMElement(s) for the xml that falls into > the ##other category ). > > If this is still in development is there any idea of when it will > make it into a release? Yes, this feature is in the development and should appear in the next beta and then in the 3.0.0 release. I will also be sending a more detailed writeup of the idea in the coming weeks for the community to comment. For the meantime, as a workaround, you can use the type customization technique described in the email you quoted. hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070509/27da1f1b/attachment.pgp From boris at codesynthesis.com Thu May 10 05:35:29 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Unexplained code size increase In-Reply-To: <147ae4280704231401o7b832a2bvee24e126d12fa383@mail.gmail.com> References: <147ae4280704231401o7b832a2bvee24e126d12fa383@mail.gmail.com> Message-ID: <20070510093529.GA32076@karelia> Hi Glenn, Glenn Nieuwenhuyse writes: > To illustrate my problem I have made a small test case (see attachment): > Currently my XML Schema is written as in the Large.xsd-file . The > Small.xsd-file is one of the possible solutions I'm looking into. Wanted to let you know that I've made some changes to the parsing and serialization code that resulted in about 20% code size reduction. I re-run your test case against the development version and 2.3.1. Here are the results: 2.3.1 dev ------------------------------- small_s 77352 77272 large_s 126488 118304 hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070510/dec6236b/attachment.pgp From boris at codesynthesis.com Thu May 10 08:50:12 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Poll: anonymous types without --morph-anonymous Message-ID: <20070510125012.GA1117@karelia> Hi, We are considering dropping support for anonymous types in the generated code for the C++/Tree mapping. The reason being significant complexity in the code generator. The plan is to turn the --morph-anonymous option on by default. This will result in all anonymous types automatically becoming named (with names derived from corresponding elements/attributes). What I would like to find out is if there is anybody who is compiling schemas with anonymous types and is not using the --morph-anonymous option. thanks, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070510/3fe9f941/attachment.pgp From hans.kjellegard at se.transport.bombardier.com Thu May 10 10:00:32 2007 From: hans.kjellegard at se.transport.bombardier.com (hans.kjellegard@se.transport.bombardier.com) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Visual C++ 6.0 Message-ID: Hi, Do you have any plans for a 'W3C XML Schema to C++ data binding compiler' supporting Visual C++ 6.0? Best Regards Hasse _______________________________________________________________________________________________________________ This e-mail communication (and any attachment/s) may contain confidential or privileged information and is intended only for the individual(s) or entity named above and to others who have been specifically authorized to receive it. If you are not the intended recipient, please do not read, copy, use or disclose the contents of this communication to others. Please notify the sender that you have received this e-mail in error by reply e-mail, and delete the e-mail subsequently. Please note that in order to protect the security of our information systems an AntiSPAM solution is in use and will browse through incoming emails. Thank you. _________________________________________________________________________________________________________________ Ce message (ainsi que le(s) fichier/s), transmis par courriel, peut contenir des renseignements confidentiels ou prot?g?s et est destin? ? l?usage exclusif du destinataire ci-dessus. Toute autre personne est par les pr?sentes avis?e qu?il est strictement interdit de le diffuser, le distribuer ou le reproduire. Si vous l?avez re?u par inadvertance, veuillez nous en aviser et d?truire ce message. Veuillez prendre note qu'une solution antipollupostage (AntiSPAM) est utilis?e afin d'assurer la s?curit? de nos systems d'information et qu'elle fur?tera les courriels entrant. Merci. _________________________________________________________________________________________________________________ From boris at codesynthesis.com Thu May 10 10:32:45 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Visual C++ 6.0 In-Reply-To: References: Message-ID: <20070510143245.GB1117@karelia> Hi Hans, hans.kjellegard@se.transport.bombardier.com writes: > Do you have any plans for a 'W3C XML Schema to C++ data binding compiler' > supporting Visual C++ 6.0? We do not plan to support VC++ 6.0 in XSD. However, XSD/e is known to work with VC++ 6. For more information on XSD/e see http://www.codesynthesis.com/products/xsde/ hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070510/d8d3d159/attachment.pgp From gerard at lanois.com Thu May 10 19:45:15 2007 From: gerard at lanois.com (Gerard Lanois) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Poll: anonymous types without --morph-anonymous In-Reply-To: <20070510125012.GA1117@karelia> References: <20070510125012.GA1117@karelia> Message-ID: <5a454940705101645o1c10c491na74225d3c1b8c950@mail.gmail.com> Hi - I'm in the situation you describe (C++/Tree, using anonymous types, but not specifying --morph-anonymous) for certain projects. I would be affected by this change, but I am willing to either fix my .xsd or fix my application code. -Gerard On 5/10/07, Boris Kolpackov wrote: > > Hi, > > We are considering dropping support for anonymous types in the > generated code for the C++/Tree mapping. The reason being > significant complexity in the code generator. The plan is to > turn the --morph-anonymous option on by default. This will result > in all anonymous types automatically becoming named (with names > derived from corresponding elements/attributes). > > What I would like to find out is if there is anybody who is > compiling schemas with anonymous types and is not using the > --morph-anonymous option. > > > thanks, > -boris > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.2.5 (GNU/Linux) > > iQGVAwUBRkMVBMiAKQuuCE8dAQLc7gv/cSwBGdAizM8oUtLs8MkDf+jYJoccZLSS > SJtsmaUzg8XxRRLlHZ89ZeNfktC/nfHGTq0Mym2DW/c4UQsGglk3fmuKXOZWDlt0 > QKP1BC4jRBORvZfSNUaLmhLmKaer4Gr+JWOHLN0n+JqGbq+NoCvf2x4n9CI4UHei > QzMWZEB6SaCJRSvioal6nKrDQlSzRtu6OtjebaTOIHlzOsH9oRZXYoBieRUc/+vL > 9k8VN+OCcExmWKWFvjaRbyAwB0Uzd1RQryTRC5c3bopjJ21PncvO0II85QJNFOfD > SRr3Cu0Lm2MhDP5mGG57TXI1HUZDDW4m+vD24H5/1d7vZn/zgl+wf9xKGiJ/Dg8y > 5TF5r/ENaxQMNdGal3WVstApbbVUsLrz7dIQZpn0EzA6n5/6pp3QEqaMD6SY6QVx > yegIHx1N/MI5DyV2Iz6OUyxLFvNxtkeqIn4ltim4XHY+IappCc83Um5J+66IvpZg > vjXcOFm+F7+E+P7wHRlOawHjZpPAfHVW > =tAui > -----END PGP SIGNATURE----- > > From boris at codesynthesis.com Mon May 14 10:35:01 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Re: Embedded XSD for games... In-Reply-To: <37ac304d0705140625r8bb8741v90650677d8e97179@mail.gmail.com> References: <37ac304d0705140625r8bb8741v90650677d8e97179@mail.gmail.com> Message-ID: <20070514143501.GB17741@karelia> Hi Sam, I think xsd-users is a more appropriate place to discuss this. I've CC'ed it to my reply. I am not sure if you looked into this but from your description it appear that the binary serialization of the in-memory representation can do what you want. The idea of this feature is that you can instruct XSD (see the --generate-insertion and --generate-extraction options as well as the 'binary' example) to generate stream insertion operators and extraction constructors. Pretty much any custom stream type can be used. ACE CDR (CORBA over-the-wire format) is supported out of the box. We've done some measurements and the resulting representation is a lot smaller and faster to parse. This would work like so: you will generate two version of the C++ code from your schema. The first is for the PC and will include XML parsing and binary serialization code. The second is for the console and will only include binary extraction code without any XML stuff. The PC code will parse XML, serialize to binary format, and send it to the console. The console will extract the data from the binary format which can then be used by the application. Let me know if I missed anything from your requirements. hth, -boris [The original email follows for context.] sam scott writes: > Hi Boris (no one else seems to post here!) - I hope I've got this post in > the right place but that's really what I'm trying to find out. I'm writing > an article which I hope to post on a game development website which proposes > an 'ideal' pipeline for getting all our data requirements through one > conversion utility from the many different source applications we use. > > All of these source apps (Maya, Proprietary Editor, MS Office) output XML in > varying formats and need converting to binary versions PC side - we're > incredibly data heavy and so any processing of XML data on the console side > is really out of bounds. So at home I've started to experiment with your > xsd lib which is fantastic it must be said but have found one large problem > to do with my problem domain. > > The problem goes like this: to get binary data off of the PC to console i > must deal with two problems: pointers and virtual table pointers. The > former is easy and the latter a little less so but none the less possible > I actually use a lib from an article in Games Programming Games 5: "1.13 A > Transparent Class Saving and Loading Trick". This basically replaces all > the pointers with a special 'smart pointer' which then gets turned into an > offset and put into a table at save time (PC side) and remapped out to the > correct memory address at load time (console side). > > This means that due to the autogenerated nature of XSD and XSDe, > I have to add in an extra conversion step PC side to: > > a) turn all the pointers into freeze pointers > b) strip down the data structures to there bare > bones (most just need to be simple arrays and structures) - actually XSDe > seems to provide a solution this point > c) remove as much inheritance as possible (usually i don't want any as > dealing with moving vtbl pointers over to target platform is a royal pain) > > This step is error prone and time consuming and goes against the reason of > using an XML data binding step - the data binding helps but I feel I should > be able to get to this format direct ie use the auto generated data > structures console side) > > So (and we fianlly get to the meat and potatoes here) to solve all my > problems I get the feeling I need to use your xsd frontend to write my own > version of XSD which fills my requirements: do you think this is so or is > there a method you've already devised of to deal with this type of > situation? > > Thanks -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070514/01bced63/attachment.pgp From billythefisherman at googlemail.com Mon May 14 10:56:03 2007 From: billythefisherman at googlemail.com (sam scott) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Re: Embedded XSD for games... In-Reply-To: <20070514143501.GB17741@karelia> References: <37ac304d0705140625r8bb8741v90650677d8e97179@mail.gmail.com> <20070514143501.GB17741@karelia> Message-ID: <37ac304d0705140756q536d792dyf205266e6fdb329c@mail.gmail.com> Brilliant this looks like the job - I thought I may have over complicated the task at hand. I need to spend some time looking at this avenue to fully assess whether it fully meets my needs, but in any case thank you very much for the speedy response! On 14/05/07, Boris Kolpackov wrote: > > Hi Sam, > > I think xsd-users is a more appropriate place to discuss this. I've > CC'ed it to my reply. > > I am not sure if you looked into this but from your description it > appear that the binary serialization of the in-memory representation > can do what you want. The idea of this feature is that you can > instruct XSD (see the --generate-insertion and --generate-extraction > options as well as the 'binary' example) to generate stream insertion > operators and extraction constructors. Pretty much any custom stream > type can be used. ACE CDR (CORBA over-the-wire format) is supported > out of the box. We've done some measurements and the resulting > representation is a lot smaller and faster to parse. > > This would work like so: you will generate two version of the C++ > code from your schema. The first is for the PC and will include XML > parsing and binary serialization code. The second is for the console > and will only include binary extraction code without any XML stuff. > The PC code will parse XML, serialize to binary format, and send > it to the console. The console will extract the data from the > binary format which can then be used by the application. > > Let me know if I missed anything from your requirements. > > hth, > -boris > > > [The original email follows for context.] > > sam scott writes: > > > Hi Boris (no one else seems to post here!) - I hope I've got this post > in > > the right place but that's really what I'm trying to find out. I'm > writing > > an article which I hope to post on a game development website which > proposes > > an 'ideal' pipeline for getting all our data requirements through one > > conversion utility from the many different source applications we use. > > > > All of these source apps (Maya, Proprietary Editor, MS Office) output > XML in > > varying formats and need converting to binary versions PC side - we're > > incredibly data heavy and so any processing of XML data on the console > side > > is really out of bounds. So at home I've started to experiment with > your > > xsd lib which is fantastic it must be said but have found one large > problem > > to do with my problem domain. > > > > The problem goes like this: to get binary data off of the PC to console > i > > must deal with two problems: pointers and virtual table pointers. The > > former is easy and the latter a little less so but none the less > possible > > I actually use a lib from an article in Games Programming Games 5: "1.13A > > Transparent Class Saving and Loading Trick". This basically replaces > all > > the pointers with a special 'smart pointer' which then gets turned into > an > > offset and put into a table at save time (PC side) and remapped out to > the > > correct memory address at load time (console side). > > > > This means that due to the autogenerated nature of XSD and XSDe, > > I have to add in an extra conversion step PC side to: > > > > a) turn all the pointers into freeze pointers > > b) strip down the data structures to there bare > > bones (most just need to be simple arrays and structures) - actually > XSDe > > seems to provide a solution this point > > c) remove as much inheritance as possible (usually i don't want any as > > dealing with moving vtbl pointers over to target platform is a royal > pain) > > > > This step is error prone and time consuming and goes against the reason > of > > using an XML data binding step - the data binding helps but I feel I > should > > be able to get to this format direct ie use the auto generated data > > structures console side) > > > > So (and we fianlly get to the meat and potatoes here) to solve all my > > problems I get the feeling I need to use your xsd frontend to write my > own > > version of XSD which fills my requirements: do you think this is so or > is > > there a method you've already devised of to deal with this type of > > situation? > > > > Thanks > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.2.5 (GNU/Linux) > > iQGVAwUBRkhzlciAKQuuCE8dAQJg2gv+MoDJTRmqp0cbWuOSZT35EYA6hg83+1OX > NVs9GLaDfOIKVHLLEhBhudKIWqPjJwe9aj2bHaLJCXGGwymt8uAjewo/Vno8S8pt > +S7gUUqUoQMqYQwJx12m9TA9OWIfjqoSizo1a1aOAXZTQX4lZu74+t0JeE1ktwoD > zz8f5b+C312Iwy0b7GASCczmrSM8ACxPkLyqoJE+V+ul4PyBYW6/MOAjqPUAYI3N > 9Aaf5uYE9mPy84tPRJnnRyI3026r0YbANPgvyPCHl2yW8kAbPhz9CEyCmdkUuEgQ > MxZrUGmh70ERCRNANmp71xTr7Va93EhewLIUqnCbOakOxMhy5Tl2cM31BcLFLUi2 > ziPBLyoPxRXwg/F8GH9VhKtAD/aRSF0SdM3P7d8o7Hiqf/Krha8Vjnx2RqfwuHUj > StI3YnQRVyZkv93uYIg9b+SmoI8s0WgI8r4nywl+7W2k5NYwFo1H5ZHwwZtFjKAw > +b3BHTtzjL7njd67uoeyUlT9j8zSr1bl > =up04 > -----END PGP SIGNATURE----- > > From vincent at vincent-jacques.net Tue May 15 14:10:53 2007 From: vincent at vincent-jacques.net (Vincent Jacques) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Streaming Message-ID: <4649F7AD.1000305@vincent-jacques.net> Hello, I've just downloaded XSD, and it seems to fit most of my needs. On http://www.codesynthesis.com/products/xsd/ in the advantages of C++/Parser, I can read "Perform immediate processing as parts of the document become available (streaming)" I'm very interested by this feature, but I'm not yet able to use it. I use xsd with the default xerces parser. Basicaly, my xml document will come from a std::istream and I'm testing with std::cin for the moment. I use the xml_schema::document::parse method which takes a std::istream. My problem is that I have to close the stream (with Ctrl+D under Linux) before any parse event is trigered. What have I missed ? Many thanks, -- Vincent Jacques "S'il n'y a pas de solution, c'est qu'il n'y a pas de probl?me" Devise Shadok From boris at codesynthesis.com Tue May 15 15:10:10 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Streaming In-Reply-To: <4649F7AD.1000305@vincent-jacques.net> References: <4649F7AD.1000305@vincent-jacques.net> Message-ID: <20070515191010.GB27389@karelia> Hi Vincent, Vincent Jacques writes: > I use xsd with the default xerces parser. > > Basicaly, my xml document will come from a std::istream and I'm testing > with std::cin for the moment. I use the xml_schema::document::parse > method which takes a std::istream. > > My problem is that I have to close the stream (with Ctrl+D under Linux) > before any parse event is trigered. This is most likely because the underlying parser (Xerces-C++ in this case) tries to read a chunk of data that is bigger than your document. As a result when the code calls read() on std::cin the implementation blocks until one of the two things happen: (1) the amount of data requested is read (2) the stream is finished (Ctrl+D) I did a quick test and my version of Xerces-C++ (2.7.0) asks for 49152 bytes at a time. If you are interested, the code that ties std::istream and the Xerces-C++ stream is in libxsd/xsd/cxx/xml/sax/std-input-source.hxx. One way to test that streaming works on small documents is to change the readByte implementation and always read, say, 64 bytes instead of what Xerces-C++ asks in the 'size' argument. hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070515/7d320d40/attachment.pgp From vincent at vincent-jacques.net Wed May 16 17:47:41 2007 From: vincent at vincent-jacques.net (Vincent Jacques) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Streaming In-Reply-To: <20070515191010.GB27389@karelia> References: <4649F7AD.1000305@vincent-jacques.net> <20070515191010.GB27389@karelia> Message-ID: <464B7BFD.5040105@vincent-jacques.net> Boris Kolpackov a ?crit : > Vincent Jacques writes: >> Basicaly, my xml document will come from a std::istream and I'm testing >> with std::cin for the moment. I use the xml_schema::document::parse >> method which takes a std::istream. >> My problem is that I have to close the stream (with Ctrl+D under Linux) >> before any parse event is trigered. > This is most likely because the underlying parser (Xerces-C++ in this > case) tries to read a chunk of data that is bigger than your document. > If you are interested, the code that ties > std::istream and the Xerces-C++ stream is in > libxsd/xsd/cxx/xml/sax/std-input-source.hxx. > One way to test that streaming works on small documents is to > change the readByte implementation and always read, say, 64 > bytes instead of what Xerces-C++ asks in the 'size' argument. Marvelous, many thanks :) Since I do need to process a tag as soon as it is finished, I've tried to read only 1 byte each time Xerces request, and it works exactly as I was expecting. I'll write a "fast_std_input_source" and use the method document::parse which takes a xercesc::InputSource&. I'm aware that it would not be efficient on big documents, but mine will stay small enought. Thanks again. I'll come back soon with my next question... PS : I'm on the mailling list, so you can respond only on the list. -- Vincent Jacques "S'il n'y a pas de solution, c'est qu'il n'y a pas de probl?me" Devise Shadok From boris at codesynthesis.com Thu May 17 09:38:01 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Streaming In-Reply-To: <464B7BFD.5040105@vincent-jacques.net> References: <4649F7AD.1000305@vincent-jacques.net> <20070515191010.GB27389@karelia> <464B7BFD.5040105@vincent-jacques.net> Message-ID: <20070517133801.GA10357@karelia> Hi Vincent, Vincent Jacques writes: > Since I do need to process a tag as soon as it is finished, I've tried > to read only 1 byte each time Xerces request, and it works exactly as I > was expecting. > > I'll write a "fast_std_input_source" and use the method document::parse > which takes a xercesc::InputSource&. > > I'm aware that it would not be efficient on big documents, but mine will > stay small enought. You can make it a bit more efficient by asking the underlying buffer for how much data is available to read and using that value instead of just 1 byte. The way to get this value is by calling the in_avail() function on the streambuf object associated with the stream: istream& is = ... streamsize n = is.rdbuf ()->in_avail (); hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070517/9a949314/attachment.pgp From rlischner at proteus-technologies.com Thu May 17 12:23:59 2007 From: rlischner at proteus-technologies.com (Ray Lischner) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Customizing a type with a typedef Message-ID: I want to implement a custom type with a typedef, but I can't because Code Synthesis generates a forward class declaration. Specifically, I am implementing a type that acts like an integer, but allows C-style string values, e.g., 0x42. Thus, in the schema, I define the type CUnsignedByte as a restriction of string, but I also provide a completely custom type--one that derives from fundamental_base. I implement the DOM functions to parse C-style strings. I want to implement CUnsignedByte, CUnsignedShort, CUnsignedInt, and CUnsignedLong. Naturally, I implemented a single template, CUnsigned, and want to define the specific types as typedefs: typedef CUnsigned CUnsignedByte; and so on. So, my question is, how can I do this? I don't need CUnsignedByte, etc., in the generated header. I don't want the forward class declaration. Is there a way to turn it off? -- Ray Lischner, Proteus Technologies From boris at codesynthesis.com Thu May 17 12:40:16 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Customizing a type with a typedef In-Reply-To: References: Message-ID: <20070517164016.GC10357@karelia> Hi Ray, Ray Lischner writes: > I want to implement a custom type with a typedef, but I can't because > Code Synthesis generates a forward class declaration. > > I want to implement CUnsignedByte, CUnsignedShort, CUnsignedInt, > and CUnsignedLong. Naturally, I implemented a single template, > CUnsigned, and want to define the specific types as typedefs: > > typedef CUnsigned CUnsignedByte; You can do it like this: --custom-type "CUnsignedByte=CUnsigned" This will result in typedef CUnsigned CUnsignedByte; Instead of the forward declaration. All you need to do is to include the header where the CUnsigned class template is defined (e.g., using the --hxx-prologue option). BTW, various ways to use the --custom-type option are covered in the C++/Tree Mapping Customization Guide: http://wiki.codesynthesis.com/Tree/Customization_guide hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070517/860a58a1/attachment.pgp From michael.coulman at gmail.com Sat May 19 14:21:07 2007 From: michael.coulman at gmail.com (Michael Coulman) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] how do I...? Message-ID: ...do something like this? if (!bc[ith].available ()) bc.erase (std::remove (bc.begin (), bc.end (), bc[ith])); (from the tree library example) Thanks for the great tool. -- Mike From boris at codesynthesis.com Sat May 19 17:10:52 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] how do I...? In-Reply-To: References: Message-ID: <20070519211052.GA17111@karelia> Hi Michael, Michael Coulman writes: > if (!bc[ith].available ()) > bc.erase (std::remove (bc.begin (), bc.end (), bc[ith])); I assume here you are trying to remove all instances of some book if it is not available (though you forgot to pass bc.end () to erase as a second argument). It won't work out of the box because there is no operator== defined for class book. There are several ways to make it work: (1) Rewrite it as a loop. (2) Create a functor that compares books and use std::remove_if. (3) Define operator== for comparing books. > Thanks for the great tool. You are welcome! I am glad you are enjoying it. hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070519/c81a914e/attachment.pgp From rlischner at proteus-technologies.com Sat May 19 17:35:39 2007 From: rlischner at proteus-technologies.com (Ray Lischner) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] how do I...? References: <20070519211052.GA17111@karelia> Message-ID: > (3) Define operator== for comparing books. I often wonder whether Code Synthesis should generate this operator for us. Optional items would be equal if both were absent, or both were present and equal. Cardinality > 1 items would be equal using the equivalent logic of the std::equals algorithm. Items deriving from fundamental types would be equal if the values were equal. Complex types would be equal if all their members were equal. I've often found myself wishing for an auto-generated operator== when writing unit tests. At other times, I've managed to get by writing operator== manually, but always, my definition has been memberwise comparison for equality. One of my co-workers assumed that Code Synthesis generated operator==, wrote her code with that assumption, and asked me for help when her code did not compile. -- Ray Lischner, Proteus Technologies From boris at codesynthesis.com Sat May 19 17:52:31 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] how do I...? In-Reply-To: References: <20070519211052.GA17111@karelia> Message-ID: <20070519215231.GB17111@karelia> Hi Ray, Ray Lischner writes: > > (3) Define operator== for comparing books. > > I often wonder whether Code Synthesis should generate this operator > for us. Optional items would be equal if both were absent, or both > were present and equal. Cardinality > 1 items would be equal using > the equivalent logic of the std::equals algorithm. Items deriving > from fundamental types would be equal if the values were equal. This all is already working like you described. > Complex types would be equal if all their members were equal. I think in many cases equality defined this way won't be what the application needs. In case of a book, for example, I would define equality as ISBNs being equal or IDs being equal or titles being equal, depending on the application What if two editions of the same book have different ISBNs? Finally, I doubt anybody would find comparing availability attribute meaningful. > I've often found myself wishing for an auto-generated operator== > when writing unit tests. At other times, I've managed to get by > writing operator== manually, but always, my definition has been > memberwise comparison for equality. Yes, unit tests are probably the only case where memberwise comparison is what one needs most of the time. I think we can have an option that triggers generation of operator== and operator!= for complex types. Thanks for the suggestion! -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070519/c9795331/attachment.pgp From michael.coulman at gmail.com Sat May 19 18:34:32 2007 From: michael.coulman at gmail.com (Michael Coulman) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] how do I...? In-Reply-To: References: <20070519211052.GA17111@karelia> Message-ID: <290C86E4-6E32-49E8-8DBD-6D297189E0AB@gmail.com> On May 19, 2007, at 11:35 AM, Ray Lischner wrote: >> (3) Define operator== for comparing books. > > I often wonder whether Code Synthesis should generate this operator > for us. Optional items would be equal if both were absent, or both > were present and equal. Cardinality > 1 items would be equal using > the equivalent logic of the std::equals algorithm. Items deriving > from fundamental types would be equal if the values were equal. > Complex types would be equal if all their members were equal. Agree, or trivially where an id attribute is specified in the schema for a given element and id values are equal. -- Mike From jiripoledna at seznam.cz Mon May 21 10:27:25 2007 From: jiripoledna at seznam.cz (Jiri Poledna) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] xsd:any in parser Message-ID: <4651AC4D.5090508@seznam.cz> Hi I need some help with XSD parser, I have following xsd file for xml I'm using xsd.exe utility to generate the hxx and txx, I obtained parserhooks to Title element, but I do not reach Reviewer element. I saw [3]http://www.codesynthesis.com/pipermail/xsd-announcements/2007/00002 0.html this line * Proper handling of an xsd:any nested content. Nested elements, attributes, and text are reported via _any_* hooks of the current parser. but I do not see _any_* hook, can you help me how to handle xsd:any attribute i n parser? Thanks Jiri References 1. http://www.w3.org/2001/XMLSchema 2. http://www.w3.org/2001/XMLSchema-instance 3. http://www.codesynthesis.com/pipermail/xsd-announcements/2007/000020.html From boris at codesynthesis.com Mon May 21 15:13:20 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] xsd:any in parser In-Reply-To: <4651AC4D.5090508@seznam.cz> References: <4651AC4D.5090508@seznam.cz> Message-ID: <20070521191320.GA22137@karelia> Hi Jiri, Jiri Poledna writes: > > > > > > > > > > > > > > > > > > > > > > > I'm using xsd.exe utility to generate the hxx and txx, I obtained > parserhooks to Title element, but I do not reach Reviewer element. The hooks you are interested in are: virtual void _start_any_element (const xml_schema::ro_string& ns, const xml_schema::ro_string& name); virtual void _end_any_element (const xml_schema::ro_string& ns, const xml_schema::ro_string& name); virtual void _any_attribute (const xml_schema::ro_string& ns, const xml_schema::ro_string& name, const xml_schema::ro_string& value); virtual void _any_characters (const xml_schema::ro_string&); They pretty much constitute SAX events and are triggered for elements, attributes, and text of wildcard/mixed content. In your case, you will need to override them in the implementation of the Title parser. The Reviewer element (in place of an any) and all its nested contents will be delivered via these hooks. hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070521/37977f9b/attachment.pgp From jiripoledna at seznam.cz Tue May 22 02:58:18 2007 From: jiripoledna at seznam.cz (Jiri Poledna) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] xsd:any in parser In-Reply-To: <20070521191320.GA22137@karelia> References: <4651AC4D.5090508@seznam.cz> <20070521191320.GA22137@karelia> Message-ID: <4652948A.3020702@seznam.cz> Hi Boris This is what I expect, override some methods, my problem is that I have nothing to override, when I run xsd.exe it do not generate that "any" methods to override. Do you think I need switch on some attribute in generation process to obtain such methods? I'm using "xsd cxx-parser --morph-anonymous book.xsd" Thanks Jiri Boris Kolpackov wrote: Hi Jiri, Jiri Poledna [1] writes: I'm using xsd.exe utility to generate the hxx and txx, I obtained parserhooks to Title element, but I do not reach Reviewer element. The hooks you are interested in are: virtual void _start_any_element (const xml_schema::ro_string& ns, const xml_schema::ro_string& name); virtual void _end_any_element (const xml_schema::ro_string& ns, const xml_schema::ro_string& name); virtual void _any_attribute (const xml_schema::ro_string& ns, const xml_schema::ro_string& name, const xml_schema::ro_string& value); virtual void _any_characters (const xml_schema::ro_string&); They pretty much constitute SAX events and are triggered for elements, attributes, and text of wildcard/mixed content. In your case, you will need to override them in the implementation of the Title parser. The Reviewer element (in place of an any) and all its nested contents will be delivered via these hooks. hth, -boris References 1. mailto:jiripoledna@seznam.cz From boris at codesynthesis.com Tue May 22 03:49:23 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] xsd:any in parser In-Reply-To: <4652948A.3020702@seznam.cz> References: <4651AC4D.5090508@seznam.cz> <20070521191320.GA22137@karelia> <4652948A.3020702@seznam.cz> Message-ID: <20070522074923.GA23957@karelia> Hi Jiri, Jiri Poledna writes: > This is what I expect, override some methods, my problem is that I have > nothing to override, when I run xsd.exe it do not generate that "any" > methods to override. These hooks are declared in the base class from which every parser template inherits. If you are interested, this base class is defined in libxsd/xsd/cxx/parser/non-validating/parser.hxx for non-validating parsing and in libxsd/xsd/cxx/parser/validating/parser.hxx for validating parsing. Just try to copy the function signatures of the hooks I sent in the previous email to your parser, implement them, and everything should work fine. hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070522/d2c86e38/attachment.pgp From jiripoledna at seznam.cz Tue May 22 05:45:53 2007 From: jiripoledna at seznam.cz (Jiri Poledna) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] xsd:any in parser In-Reply-To: <20070522074923.GA23957@karelia> References: <4651AC4D.5090508@seznam.cz> <20070521191320.GA22137@karelia> <4652948A.3020702@seznam.cz> <20070522074923.GA23957@karelia> Message-ID: <4652BBD1.4040701@seznam.cz> Hi Boris it is working, perfect. now I can reach the Rewiever tag data, I have last question to complete the process. Let's say I can implement Reviewer parser in my project, how to connect the Reviewer parser to complete parsing process. other worlds: I can implement Title parser, I can add it to process by "root_parser.Title_parser(title_parser);". Because I have no method to add Reviewer parser to root_parser, then I cannot reach Reviewer parser implementation. I can get data only using _any_ methods. Exist some method to skip that "any bridge" and continue parsing inside the reviewer as usual way? thanks a lot Jiri From boris at codesynthesis.com Tue May 22 06:58:14 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] xsd:any in parser In-Reply-To: <4652BBD1.4040701@seznam.cz> References: <4651AC4D.5090508@seznam.cz> <20070521191320.GA22137@karelia> <4652948A.3020702@seznam.cz> <20070522074923.GA23957@karelia> <4652BBD1.4040701@seznam.cz> Message-ID: <20070522105814.GD23957@karelia> Hi Jiri, Jiri Poledna writes: > Let's say I can implement Reviewer parser in my project, how to connect > the Reviewer parser to complete parsing process. > other worlds: I can implement Title parser, I can add it to process by > "root_parser.Title_parser(title_parser);". > > Because I have no method to add Reviewer parser to root_parser, then I > cannot reach Reviewer parser implementation. I can get data only using > _any_ methods. Exist some method to skip that "any bridge" and continue > parsing inside the reviewer as usual way? Hm, good question. You see, the wildcard can match any number of elements and XSD has no way to know which one it will. To achieve what you want you will need to route the parsing events to the Reviewer parser implementation manually. Here is how your code might look: class Reviewer_impl: ... { ... }; class root_impl: ... { public: ... root_impl (Reviewer_impl& reviewer) : reviewer_ (reviewer), depth_ (0) { } virtual void _start_any_element (const xml_schema::ro_string& ns, const xml_schema::ro_string& name) { if (depth_++ > 0) reviewer_._start_element (ns, name); else { if (name == "Reviewer" && ns.empty ()) { reviewer_.pre (); reviewer_._pre_impl (); } else { // Something else in place of the wildcard. } } } virtual void _end_any_element (const xml_schema::ro_string& ns, const xml_schema::ro_string& name) { if (--depth_ > 0) reviewer_._end_element (ns, name); else { reviewer_._post_impl (); reviewer_.post (); } } virtual void _any_attribute (const xml_schema::ro_string& ns, const xml_schema::ro_string& name, const xml_schema::ro_string& value) { reviewer_._attribute (ns, name, value); } virtual void _any_characters (const xml_schema::ro_string& s) { reviewer_._characters (s); } private: Reviewer_impl& reviewer_; std::size_t depth_; }; hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070522/323804d9/attachment.pgp From marc.wautier at eurocontrol.int Tue May 22 06:25:37 2007 From: marc.wautier at eurocontrol.int (WAUTIER Marc) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Which xsd compiler option could I use in order to isolate a redefine symbol within a namespace Message-ID: <1B2B2EF98D55CB41BD16F13B18B9B008F5BE79@FFBRUE001.cfmu.corp.eurocontrol.int> Hello gents, The XML schema I'm using is defined by a third party. When compiling the files generated by the xsd compiler, I get the following error message : Error 173: "AIXM-Features.hxx", line 404 # Redefined symbol 'SpecialDateType'; previously defined at ["/cm/vobs/esc/ESC/KERNEL/sources/include/SpecialDateState.h", line 29]. Which xsd compiler option could I use in order to isolate the offending declaration within a namespace or to rename the offending declaration ? I tried the following without success: xsd cxx-tree --anonymous-regex /SpecialDateType/EradSpecialDateType/ --anonymous-regex-trace ${FILE} xsd cxx-tree --custom-type-regex /SpecialDateType/EradSpecialDateType/ ${FILE} I hope you might help me. Regards, Wautier Marc _________________________________________________________________ Contractor - CFMU/DEVD/DC EUROCONTROL - CFMU* * +32 (0)2 729.97.38 Rue de la fus?e, 96 Fax +32 (0)2 729.90.22 B-1130Bruxelles - Brussel ** * marc.wautier@eurocontrol.int Belgium ____ This message and any files transmitted with it are legally privileged and intended for the sole use of the individual(s) or entity to whom they are addressed. If you are not the intended recipient, please notify the sender by reply and delete the message and any attachments from your system. Any unauthorised use or disclosure of the content of this message is strictly prohibited and may be unlawful. Nothing in this e-mail message amounts to a contractual or legal commitment on the part of EUROCONTROL, unless it is confirmed by appropriately signed hard copy. Any views expressed in this message are those of the sender. From boris at codesynthesis.com Tue May 22 08:08:12 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Which xsd compiler option could I use in order to isolate a redefine symbol within a namespace In-Reply-To: <1B2B2EF98D55CB41BD16F13B18B9B008F5BE79@FFBRUE001.cfmu.corp.eurocontrol.int> References: <1B2B2EF98D55CB41BD16F13B18B9B008F5BE79@FFBRUE001.cfmu.corp.eurocontrol.int> Message-ID: <20070522120812.GF23957@karelia> Hi Marc, WAUTIER Marc writes: > When compiling the files generated by the xsd compiler, I get the > following error message : > > Error 173: "AIXM-Features.hxx", line 404 # Redefined symbol > 'SpecialDateType'; previously defined at > ["/cm/vobs/esc/ESC/KERNEL/sources/include/SpecialDateState.h", line 29]. > > Which xsd compiler option could I use in order to isolate the offending > declaration within a namespace or to rename the offending declaration ? It seems like the generated type conflicts with an existing name in SpecialDateState.h. The easiest way to resolve this is to instruct XSD to put the generated code into a C++ namespace with the --namespace-map option. If your schema does not have a target namespace, then you can do: --namespace-map =MyNamespace Otherwise, something like this: --namespace-map =MyNamespace Where needs to be replaced with your schema's target namespace. > I tried the following without success: > > xsd cxx-tree --anonymous-regex /SpecialDateType/EradSpecialDateType/ > --anonymous-regex-trace ${FILE} This will only work if SpecialDateType in AIXM-Features.xsd is an anonymous type. > xsd cxx-tree --custom-type-regex /SpecialDateType/EradSpecialDateType/ > ${FILE} This will make SpecialDateType an alias for (custom) EradSpecialDateType, but won't change its name. hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070522/d20a6742/attachment.pgp From boris at codesynthesis.com Wed May 23 06:13:05 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] RFC: wildcard mapping for C++/Tree Message-ID: <20070523101305.GA2021@karelia> Hi, As promised, below is an overview of the proposed wildcard (xsd:any and xsd:anyAttribute) mapping for C++/Tree that we plan to implement for 3.0.0. Your comments on this proposal will be very much appreciated. For each wildcard a set of accessor and modifier functions will be generated that will allow accessing content matched by a wildcard as DOMElement (for element wildcard) and DOMAttr (for attribute wildcards). The names for the functions will be automatically selected in the form any, any1, etc., for element wildcards (xsd:any) and any_attribute, any_attribute1, etc. for attribute wildcards (xsd:anyAttribute). Since xsd:anyAttribute can match any number of attributes, its mapping will be to a set of DOMAttr nodes with the key being the attribute name. For xsd:any all three cardinality classes (one, optional, and sequence) are possible and the mapping will be similar to that of elements. Since Xerces-C++ DOM nodes always belong to a DOMDocument, each type with a wildcard will have a DOMDocument instance. This instance will be available via an accessor function called dom_document. The access to DOMDocument from user code will be necessary to create/modify wildcard content. Here is an example: class Type { public: const DOMDocument& dom_document () const; DOMDocument& dom_document (); // any // const DOMElement& any () const; DOMElement& any (); void any (const DOMElement&); // copy void any (DOMElement*); // assume ownership // anyAttribute // typedef set any_attribute_container; typedef any_attribute_container::iterator any_attribute_iterator; typedef any_attribute_container::const_iterator any_attribute_const_iterator; const any_attribute_container& any_attribute () const; any_attribute_container& any_attribute (); void any_attribute (const any_attribute_container&); }; void f (Type& t) { DOMElement& e (t.any ()); e.appendChild (t.dom_document ().createElement ("attr")); t.any_attribute ().insert (t.dom_document ().createAttribute ("attr")); } thanks, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070523/06df1979/attachment.pgp From allan.erskine at credit-suisse.com Wed May 23 11:31:56 2007 From: allan.erskine at credit-suisse.com (Erskine, Allan) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] runtime schema file location Message-ID: Greetings all -- I am experimenting with using XSD cxx-tree to generate classes for my apps config files (so far so good.!) An issue I have is keeping my AppConfig.xsd schema files (which I copy into my config directory) consistent with the actual schema files used to generate the headers. Is there any way I can avoid the need to keep the schema files in the same directory as the config files? Ideally I'd be able to have a config file reside in one directory, with eg: ... ... and my AppConfig.xsd file reside in the same directory as the binary. Thanks for any advice! Best wishes, Allan ============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ============================================================================== From boris at codesynthesis.com Wed May 23 11:57:51 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] runtime schema file location In-Reply-To: References: Message-ID: <20070523155751.GC2400@karelia> Hi Allan, Erskine, Allan writes: > Is there any way I can avoid the need to keep the schema files in the > same directory as the config files? Ideally I'd be able to have a > config file reside in one directory, with eg: > > ... > > ... > > and my AppConfig.xsd file reside in the same directory as the binary. You can use the properties argument to one of the parsing functions as described in FAQ 2.4: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/faq/#2.4 hth, -boris From Satish.Sundar at sprint.com Tue May 29 09:36:54 2007 From: Satish.Sundar at sprint.com (Sundar, Satish [IT]) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Compiliation issues on HP-UX Message-ID: <832939B998C22A4D8C5359B8A12BB0370D837CD8@PDAWB13C.ad.sprint.com> Hi, I am evaluating XSD on HP-UX platform. I am trying to compile the generated C++ source files after runnig the xsd command on a simple hello.xsd file. However I am getting lot of compilation errors, mostly dealing with the use of C++ Standard Library classes. I am having difficulty using the correct defines (-D) for the aCC compiler. Can you please help? Here are the details HP-UX B.11.11 U 9000/800 aCC version - A.03.33 I am using these defines -D_HP_NAMESPACE_STD -DRWSTD_NO_NEW_HEADER while compiling and get these errors [echo] Compiling ... [exec] Error 419: "/opt/aCC/include/stdexcept", line 69 # 'exception' is used as a type, but has not been defined as a type. [exec] class RWSTDExport logic_error : public exception [exec] ^^^^^^^^^ [exec] Error 376: "/opt/aCC/include/stdexcept", line 69 # Class name expected. [exec] class RWSTDExport logic_error : public exception [exec] ^^^^^^^^^ [exec] Error 419: "/opt/aCC/include/stdexcept", line 145 # 'exception' is used as a type, but has not been defined as a type. [exec] class RWSTDExport runtime_error : public exception [exec] ^^^^^^^^^ [exec] Error 376: "/opt/aCC/include/stdexcept", line 145 # Class name expected. [exec] class RWSTDExport runtime_error : public exception [exec] ^^^^^^^^^ [exec] Error 419: "/home/ssunda01/sw/XSD/xsd-2.3.1-hppa-hpux/libxsd/xsd/cxx/tree/exceptions.hxx", line 27 # 'basic_ostream' is used as a type, but has not been defined as a type. [exec] std::basic_ostream& [exec] ^^^^^^^^^^^^^ [exec] Error 318: "/home/ssunda01/sw/XSD/xsd-2.3.1-hppa-hpux/libxsd/xsd/cxx/tree/exceptions.hxx", line 27 # A template name was expected instead of ''. Did you forget to define the template? [exec] std::basic_ostream& [exec] ^^^ [exec] Error 419: "/home/ssunda01/sw/XSD/xsd-2.3.1-hppa-hpux/libxsd/xsd/cxx/tree/exceptions.hxx", line 28 # 'basic_ostream' is used as a type, but has not been defined as a type. [exec] operator<< (std::basic_ostream& os, const exception& e) [exec] ^^^^^^^^^^^^^ I am using ANT for compiling ... and here is what I am using Thanks - Satish Sundar From boris at codesynthesis.com Tue May 29 09:49:41 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Compiliation issues on HP-UX In-Reply-To: <832939B998C22A4D8C5359B8A12BB0370D837CD8@PDAWB13C.ad.sprint.com> References: <832939B998C22A4D8C5359B8A12BB0370D837CD8@PDAWB13C.ad.sprint.com> Message-ID: <20070529134941.GA28016@karelia> Hi Satish, Sundar, Satish [IT] writes: > I am evaluating XSD on HP-UX platform. I am trying to compile the > generated C++ source files after runnig the xsd command > on a simple hello.xsd file. However I am getting lot of compilation > errors, mostly dealing with the use of C++ Standard Library classes. > I am having difficulty using the correct defines (-D) for the > aCC compiler. Can you please help? > Here are the details > > HP-UX B.11.11 U 9000/800 > aCC version - A.03.33 Note that you are using a really old version of aCC and there is no guarantee it will work (we are testing on A.03.63). Having said that, I suggest you try to compile one of the examples in examples/cxx/tree, for example 'hello', using GNU make. This way you will be able to figure out whether there is something wrong with the way you compile the source code or the compiler is simply too buggy. The options that we use with this compiler are: -AA +W849 +W1039. I think your build configuration is missing -AA. hth, -boris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 652 bytes Desc: Digital signature Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070529/5737a1de/attachment.pgp From lmemmott at yahoo.com Thu May 31 18:11:32 2007 From: lmemmott at yahoo.com (Lester Memmott) Date: Sun Oct 11 15:33:56 2009 Subject: [xsd-users] Example of Anonymous Types Message-ID: <21532.66473.qm@web30815.mail.mud.yahoo.com> Dear xsd-users, I'm CodeSynthesis XSD on Windows using Microsoft Visual Studio 2005 and found that the schema creation (i.e. Tools -> "Create Schema") tool in VS creates a nice schema (see example 1) which I can readily edit but it always creates the schema using anonymous types. I can convert the anonymous type schema to named types as shown in Example 2. Once converted I am able to readily use the Tree parser in Code Synthesis XSD. (See source code in example 3) So my question is: I've seen some info about "--morph-anonymous" and have seen some info in the docs about using anonymous types but I've not found any examples in order to complete a working copy showing this in action. The key idea is that I would like to still use VS2005 to create the schema but I don't want to go to all the work and convert the anonymous types to named types. Is it possible? Can someone point in to the right documentation and examples? Thanks, LM Example 1 - Anonymous Types: Example 2 - Names Types: Example 3 - Code Synthesis Driver Code: void Test(char * argv[]) { std::auto_ptr h(AkodGuiConfig(argv[1])); //Get the PredefinedIdentifiers info within the AkodGuiConfig tag for (PredefinedIdentifiers_type::IdentifierDescription::iterator pii(h->PredefinedIdentifiers().IdentifierDescription().begin()); pii != h->PredefinedIdentifiers().IdentifierDescription().end(); ++pii) { //Get the XML attributes cout << "PredefinedIdentifiers Info: " << endl; cout << pii->Description() << endl; cout << pii->UnitOfMeasure() << endl; cout << pii->IntrinsicDataType() << endl; cout << pii->Multivalued() << endl; cout << pii->SupportsEvents() << endl; cout << pii->CanBeProjected() << endl; cout << pii->DefaultValue() << endl; //Get the XML Value (i.e. CDATA / content) cout << *pii << endl; cout << endl; } cout << endl << endl; //Get the CurrentlyUsedIdentifiers info within the AkodGuiConfig tag for (CurrentlyUsedIdentifiers_type::Identifier::iterator cuii(h->CurrentlyUsedIdentifiers().Identifier().begin()); cuii != h->CurrentlyUsedIdentifiers().Identifier().end(); ++cuii) { //Get the XML attributes cout << "CurrentlyUsedIdentifiers Info: " << endl; cout << cuii->Name() << endl; if (cuii->LastKnownValue().present()) //check for existance since it is an optional parameter cout << cuii->LastKnownValue().get() << endl; cout << endl; } } Example 4 - Example XML document to parse: Temperature Humidity Level Atmospheric Pressure