From boris at codesynthesis.com Wed Apr 1 06:48:08 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Apr 1 06:59:50 2015 Subject: [xsd-users] Can not compile hello example on Mac In-Reply-To: References: Message-ID: Hi Xiao, Xiao Han writes: > g++ -W -O3 -o driver driver.o hello.o -lxerces-c > > Undefined symbols for architecture x86_64: > > "_CFRelease", referenced from: > > xercesc_3_1::MacOSUnicodeConverter::upperCase(unsigned short*) in > libxerces-c.a(MacOSUnicodeConverter.o) You are linking to the static build of Xerces-C++ (libxerces-c.a) and on Mac OS Xerces-C++ depends on CoreServices. Try this: make LIBS="-framework CoreServices" Boris From john.michaloski at nist.gov Fri Apr 10 16:45:00 2015 From: john.michaloski at nist.gov (Michaloski, John L.) Date: Mon Apr 13 10:03:53 2015 Subject: [xsd-users] C++ tree introspection and self serialization? Message-ID: I am trying to write xml to database. (I already used CodeSynthesis to parse/serialize XML data). I am using Xerces to parse the XSD to create the SQL statements to generate the data base (somewhat automated somewhat hand crafted). Couldn't tell if CodeSynthesis handled this. I would like to populate the CodeSynthesis C++ tree and then save it to a Database as well as an XML file. (I am using Postgres since its array structure seems to handle ... ... .. pattern easiest.) Bunch of CodeSynthesis questions. Does CodeSynthesis: 1) Support xsd.exe flags to generate SQL statements (although a standard I realize they vary from vendor to vendor). 2) Non-XML serialization (to Database). Would mean starting at root and knowing where the child nodes are (in CodeSynthesis, not Xerces). 3) Introspection - so if I can navigate I know what node I'm at. I'm assuming I can use Xerces get node to retrieve element name. CodeSynthesis seems to offer a lot, often I just have trouble figuring out how to do some things. John From rvlebars at gmail.com Sat Apr 11 08:32:29 2015 From: rvlebars at gmail.com (=?UTF-8?Q?Herv=C3=A9_LE_BARS?=) Date: Mon Apr 13 10:03:54 2015 Subject: [xsd-users] [C2146] syntax error on typedef timeWef_type Message-ID: Hello I have an error when compiling the CS output files bases on these XSD files In AIXM-Features, there is a line : typedef ::time timeWef_type; My first (and quick) analisys could be that there is a conflict between "time" datatype defined in XSD datatypes and the internal time function declared in MSVC 2013 headers Could you confirm or not ? If so, is there a way to use a specific namespace to solve the problem ? Thank you in advance RV For more information, I'm using QtCreator/Qt5.4/MSVC2013 -------------- next part -------------- A non-text attachment was scrubbed... Name: AIXM-DataTypes.xsd Type: application/octet-stream Size: 203054 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20150411/92b7c7da/AIXM-DataTypes-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: AIXM-Features.xsd Type: application/octet-stream Size: 399297 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20150411/92b7c7da/AIXM-Features-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: AIXM-Snapshot.xsd Type: application/octet-stream Size: 21868 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20150411/92b7c7da/AIXM-Snapshot-0001.obj From rvlebars at gmail.com Sat Apr 11 16:53:29 2015 From: rvlebars at gmail.com (=?UTF-8?Q?Herv=C3=A9_LE_BARS?=) Date: Mon Apr 13 10:03:54 2015 Subject: [xsd-users] Compilation of XMLSchema schema Message-ID: Hi I'm trying to compile the XmlSchema schema definition in order to parse xsd file for custom use I looked for one of the first version of 2001 (files found are joined + error outputs) I don't manage to compile it, so my question is : Is possible to compile XMLShema in any version ? maybe 2009 ? or is it a know issue Thank you in advance RV -------------- next part -------------- A non-text attachment was scrubbed... Name: datatypes.dtd Type: application/xml-dtd Size: 6356 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20150411/db2d4437/datatypes-0001.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: errors.log Type: application/octet-stream Size: 9297 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20150411/db2d4437/errors-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: xml.xsd Type: application/octet-stream Size: 4725 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20150411/db2d4437/xml-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: XMLSchema.dtd Type: application/xml-dtd Size: 16074 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20150411/db2d4437/XMLSchema-0001.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: XMLSchema.xsd Type: application/octet-stream Size: 87653 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20150411/db2d4437/XMLSchema-0001.obj From boris at codesynthesis.com Mon Apr 13 10:01:07 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 13 10:12:40 2015 Subject: [xsd-users] C++ tree introspection and self serialization? In-Reply-To: References: Message-ID: Hi John, Michaloski, John L. writes: > I am using Postgres since its array structure seems to handle > ... ... .. pattern > easiest.) Note that this will only work for simple values in . > 1) Support xsd.exe flags to generate SQL statements (although > a standard I realize they vary from vendor to vendor). No. > 2) Non-XML serialization (to Database). Would mean starting at > root and knowing where the child nodes are (in CodeSynthesis, > not Xerces). No. > 3) Introspection - so if I can navigate I know what node I'm > at. I'm assuming I can use Xerces get node to retrieve > element name. Check the DOM association feature. It allows you to go back and forth between C++/Tree and DOM model nodes. > CodeSynthesis seems to offer a lot, often I just have trouble > figuring out how to do some things. You may want to check ODB out: http://www.codesynthesis.com/products/odb/ With a bit of effort one should be able to map a "sane" XML Schema model to a relational database with ODB. Boris From boris at codesynthesis.com Mon Apr 13 10:02:50 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 13 10:14:23 2015 Subject: [xsd-users] [C2146] syntax error on typedef timeWef_type In-Reply-To: References: Message-ID: Hi Herv?, Herv? LE BARS writes: > typedef ::time timeWef_type; > My first (and quick) analisys could be that there is a conflict between > "time" datatype defined in XSD datatypes and the internal time function > declared in MSVC 2013 headers Could you confirm or not? Yes, most likely. Add '--reserved-name time' to you XSD command line. Boris From boris at codesynthesis.com Mon Apr 13 10:05:32 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 13 10:17:05 2015 Subject: [xsd-users] Compilation of XMLSchema schema In-Reply-To: References: Message-ID: Hi Herv?, Herv? LE BARS writes: > I'm trying to compile the XmlSchema schema definition in order to parse xsd > file for custom use [...] XMLSchema.xsd is not really a valid XML Schema definition. The W3C standard says it is not normative and is just for illustration. Boris From doliva at magaya.com Mon Apr 13 11:38:58 2015 From: doliva at magaya.com (Daniel Oliva) Date: Tue Apr 14 09:58:46 2015 Subject: [xsd-users] exit code 1 Message-ID: Skipped content of type multipart/related-------------- next part -------------- A non-text attachment was scrubbed... Name: ReusableAggregateBusinessInformationEntity_3.xsd Type: text/xml Size: 16597 bytes Desc: ReusableAggregateBusinessInformationEntity_3.xsd Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20150413/165c9359/ReusableAggregateBusinessInformationEntity_3-0001.bin From boris at codesynthesis.com Tue Apr 14 10:04:17 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Apr 14 10:16:20 2015 Subject: [xsd-users] exit code 1 In-Reply-To: References: Message-ID: Hi Daniel, Daniel Oliva writes: > The error I'm getting when I try to generate classes from Visual > Studio 2013 is: > > error MSB3721: The command "xsd.exe [...] exited with code 1. Before exiting with non-zero return code XSD normally outputs diagnostics (error messages). I am not sure why you don't see them (or maybe you just didn't include them in the email). What I suggest you do is try to compile this schema with this exact command line from the command prompt and see if you get any diagnostics that will point you to the cause of this. Boris From yury.zaytsev at traveltainment.de Fri Apr 17 07:21:49 2015 From: yury.zaytsev at traveltainment.de (Yury Zaytsev) Date: Fri Apr 17 11:04:55 2015 Subject: [xsd-users] Extract common type definitions to a separate header Message-ID: Hello, I'm using XSD on a biggish schema of the order of magnitude of thousands of types. Since the schema is rather large and the definition spans many files with circular dependencies, I've opted for the excellent "--file-per-type" mode. However, I've noticed that every header file for the generated entities at the very beginning has a section that defines common types by including XSD runtime headers and populating the xml_schema namespace: #include ... namespace xml_schema { ... } As far as I can see (I could have easily missed something though), this code is completely stereotypical and same for all headers. If this is indeed the case, then putting these 5 Kbs into a separate header will shave off some 5 Mbs for a thousand types and will make the generated code much smaller and the compilation much faster. In addition, I could include this header instead of to get just xml_schema::exception, etc. Could this feature be possibly considered for implementation? All the best, -- Dr. Yury V. Zaytsev Senior Software Developer IT Data Production TravelTainment GmbH Carlo-Schmid-Stra?e 12 52146 W?rselen/Aachen, Germany yury.zaytsev@traveltainment.de http://www.traveltainment.de Amtsgericht Aachen, HRB 15873 Gesch?ftsf?hrer: Bernhard Steffens (Vorsitzender), Dr. Oliver Rengelshausen From chew.on.it at gmail.com Fri Apr 17 07:56:52 2015 From: chew.on.it at gmail.com (Chew kk) Date: Fri Apr 17 11:04:55 2015 Subject: [xsd-users] Polymorphism : Xml Validation Error Message-ID: Hi, I'm getting the following error when I tried out an example on polymorphism. Appreciate if you could help out. Error : myFileName.xml:4:12 error: no declaration found for element 'address' myFileName.xml:5:9 error: no declaration found for element 'city' myFileName.xml:6:12 error: no declaration found for element 'country' myFileName.xml:7:12 error: element 'address' is not allowed for content model '(name)' supermen.xsd file : myFileName.xml file : abc
789
123 456
Driver : int main (int argc, char* argv[]) { if (argc != 2) { cerr << "usage: " << argv[0] << " supermen.xml" << endl; return 1; } try { auto_ptr sm (supermen(argv[1])); } catch (const xml_schema::exception& e) { cerr << e << endl; return 1; } } Thank You, chew From boris at codesynthesis.com Fri Apr 17 10:58:18 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Apr 17 11:10:26 2015 Subject: [xsd-users] Extract common type definitions to a separate header In-Reply-To: References: Message-ID: Hi Yury, Yury Zaytsev writes: > Could this feature be possibly considered for implementation? Yes, and since now I have the power to travel back in time, I went ahead and implemented it, see the --generate-xml-schema and --extern-xml-schema. In fact, I've also added a warning when --file-per-type is used without --extern-xml-schema. Since I went back in time, you should have seen by now. Hm, must be something wrong with my time machine... Boris From boris at codesynthesis.com Fri Apr 17 11:16:06 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Apr 17 11:28:15 2015 Subject: [xsd-users] Polymorphism : Xml Validation Error In-Reply-To: References: Message-ID: Hi Chew, Chew kk writes: > myFileName.xml:4:12 error: no declaration found for element 'address' > myFileName.xml:5:9 error: no declaration found for element 'city' > myFileName.xml:6:12 error: no declaration found for element 'country' > myFileName.xml:7:12 error: element 'address' is not allowed for content > model '(name)' These are Xerces-C++ validation against schema errors. Make sure you use the latest version. Also, try to put xsi:type after xsi:noNamespaceSchemaLocation. Boris From mlang at delysid.org Sun Apr 19 12:06:42 2015 From: mlang at delysid.org (Mario Lang) Date: Sun Apr 19 12:06:47 2015 Subject: [xsd-users] embedding and fgXercesLoadExternalDTD? Message-ID: <87k2x85ch9.fsf@fx.delysid.org> Hi. I realize this is more a Xerces-C++ question, but since I stumbled across this issue while using the embedding example, I hope someone here might have an answer or at least a hint. I am using xsdcxx to generate MusicXML bindings[1]. I recently made use of the cxx/tree/embedding example to avoid having to distribute the XSD schema in a separate file. This is a very nice appproach which will make deployment simpler. However, MusicXML documents are somewhat strange as they usually *always* include a DocType definition in the XML. So currently, if I enable fgDOMValidate (which I actually *want*), Xerces-C always fetches the DTD from the net, because the canonical MusicXML DocType looks like this: I now discovered fgXercesLoadExternalDTD which looks like what I want. However, setting it to false does still load the DTD if I have fgDOMValidate set to true. Setting fgDOMValidate to false will skip loading the DTD, but will apparently also not err if there are unknown element names in the input document. I am sort of surprised about this, because fgXercesSchema is set to true and the grammar pool is also setup, so I was sort of expecting schema validation to kick in instead. I am sort of confused and stuck here. I am looking for a way to have the Schema grammar validate the input document, and still *skip* loading of the DTD from the net, either by just ignoring it, or by somehow caching it in the GrammarPool. However, I do not see how and if the GrammarPool can also embed DTDs. As an added complications, the MusicXML DTD is versioned and comes in two variants (partwise and timewise), so the public ID could be "-//Recordare//DTD MusicXML 3.0 Partwise//EN", but it could also be "-//Recordare//DTD MusicXML 2.0 Partwise//EN" for instance. 1. Can the embedding example be extended to embed several DTD variants? 2. If so, how does the public ID resolving work? AFAICS, the actual DTD file(s) do not include the public identifier, so I wonder how the grammar pool is supposed to know the public ID of a particular DTD it caches. 3. Is there a way to have fgDOMValidate enabled while setting fgXercesLoadExternalDTD to false and do what I mean? 4. Or do I have to create several grammar pools for each DTD variant, and use the DOMLSResourceResolver interface somehow to point the parser at the correct pool? I guess not, because the grammar pool is specified when instantiating the lsparser, not during resource resolving. Any other options I am missing? I once played with a DOMLSResourceResolver that makes use of the libxml2 catalog support, but this doesn't particularily look portable. I guess Xerces-C still has no native catalog support, does it? [1] http://github.com/mlang/xsdcxx-musicxml -- CYa, ????? From chew.on.it at gmail.com Sun Apr 19 23:15:29 2015 From: chew.on.it at gmail.com (Chew kk) Date: Mon Apr 20 09:35:39 2015 Subject: [xsd-users] Polymorphism : Xml Validation Error In-Reply-To: References: Message-ID: Hi Boris, I tried out your solution and it did fixed the error. Thank You, chew On Fri, Apr 17, 2015 at 11:16 PM, Boris Kolpackov wrote: > Hi Chew, > > Chew kk writes: > > > myFileName.xml:4:12 error: no declaration found for element 'address' > > myFileName.xml:5:9 error: no declaration found for element 'city' > > myFileName.xml:6:12 error: no declaration found for element 'country' > > myFileName.xml:7:12 error: element 'address' is not allowed for content > > model '(name)' > > These are Xerces-C++ validation against schema errors. Make sure you > use the latest version. Also, try to put xsi:type after > xsi:noNamespaceSchemaLocation. > > Boris > From boris at codesynthesis.com Mon Apr 20 10:00:45 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 20 10:12:58 2015 Subject: [xsd-users] embedding and fgXercesLoadExternalDTD? In-Reply-To: <87k2x85ch9.fsf@fx.delysid.org> References: <87k2x85ch9.fsf@fx.delysid.org> Message-ID: Hi Mario, I am not an expert in Xerces-C++ DTD support and even less so on DTD/XML Schema interaction. DTDs, unlike Schema, serve dual purpose: they may supply entities (content) and grammar (validation). As a result, I would be weary of ignoring DTDs outright. The way I would handle your situation is by providing Xerces-C++ EntityResolver and returning a local DTD (you could probably even do the embedding, it just won't be parsed grammar). Boris From mlang at delysid.org Mon Apr 20 19:18:08 2015 From: mlang at delysid.org (Mario Lang) Date: Mon Apr 20 19:18:12 2015 Subject: [xsd-users] embedding and fgXercesLoadExternalDTD? In-Reply-To: (Boris Kolpackov's message of "Mon, 20 Apr 2015 16:00:45 +0200") References: <87k2x85ch9.fsf@fx.delysid.org> Message-ID: <871tjemlsf.fsf@fx.delysid.org> Boris Kolpackov writes: > DTDs, unlike Schema, serve dual purpose: they may supply entities > (content) and grammar (validation). As a result, I would be weary > of ignoring DTDs outright. The way I would handle your situation > is by providing Xerces-C++ EntityResolver and returning a local > DTD (you could probably even do the embedding, it just won't be > parsed grammar). In fact, the MusicXML DTDs do indeed define some entities, so your suggestion is totally correct. Thanks for pointing me in the right direction. I now use DOMLSResourceResolver and MemBufInputSource + a small tool similar to xsdbin.cpp without the compression bits. Works just fine and is actually exactly what I wanted. Since the public ID includes the MusicXML version, I can support all 4 public versions of MusicXML DTDs with a signel binary without any external resources. P.S.: Any plans to make xsdbin's functionality part of the xsdcxx installed tools? While the source can be copied around into embedding projects, it seems like the tool is flexible enough to be distributed by default. Something like "xsdcxx xsdbin ...". -- CYa, ????? From mdkhatami at gmail.com Tue Apr 21 05:41:13 2015 From: mdkhatami at gmail.com (Mohammad Khatami) Date: Tue Apr 21 05:41:21 2015 Subject: [xsd-users] Receiving error using xsd on W3 PROV schema Message-ID: Hi all, I'm new to XML and for my project I need to XSD. I can use XSD tool for simple XML schema but when I apply to the following w3 PROV schema I get error. XML schema: http://www.w3.org/ns/prov-core.xsd However I changed these two lines with and put XML.xsd and xhtml-datatypes-1.xsd in the same directory. the by using this command I get the following error: xsd cxx-tree --generate-serialization prov-core.xsd prov-core.xsd:478:55: warning F001: element 'internalElement' is implicitly of anyType prov-core.xsd:478:55: info: did you forget to specify 'type' attribute? prov-core.xsd: warning T004: generating parsing and serialization functions for 35 global elements prov-core.xsd: info: use --root-element-* options to specify document root(s) prov-core.xsd:6:307: error: unable to map XML Schema namespace ' http://www.w3.org/ns/prov#' to C++ namespace prov-core.xsd:6:307: info: use the --namespace-map or --namespace-regex option to provide custom mapping Howeverusing xsd cxx-tree --generate-xml-schema --generate-serialization prov-core.xsd I get no error. Would you please help me how to solve it? Thanks, Mohammad From yury.zaytsev at traveltainment.de Tue Apr 21 04:15:52 2015 From: yury.zaytsev at traveltainment.de (Yury Zaytsev) Date: Tue Apr 21 07:51:56 2015 Subject: [xsd-users] Extract common type definitions to a separate header In-Reply-To: References: Message-ID: Hi Boris, On Fri, 17 Apr 2015, Boris Kolpackov wrote: > Yes, and since now I have the power to travel back in time, I > went ahead and implemented it, see the --generate-xml-schema > and --extern-xml-schema. In fact, I've also added a warning when > --file-per-type is used without --extern-xml-schema. Since I > went back in time, you should have seen by now. Hm, must be > something wrong with my time machine... I'm sorry for the lame question and thanks for the pointer. Indeed, I've noticed the warning, and tried to implement the support for --generate-xml-schema / --extern-xml-schema into my build system. However, originally, I failed to make it work, and then concluded that I misunderstood the documentation & these options serve some other purpose, so I quickly forgot about them. Upon a second reading (after gaining more experience with XSD), the documentation makes much more sense to me. It works now, and indeed I was able to cut down a couple of megabytes of generated source code. I would suggest to add a statement to the documentation of --generate-xml-schema along the following lines: "Note that the XSD compiler should be generally invoked with the same set of options in the --generate-xml-schema mode as would be used to compile the actual schema later with --extern-xml-schema. Failure to do so might cause compilation errors and/or malfunction of the generated code." While this is obvious in retrospect, at first I've missed some, which resulted in confusing compilation issues. Also, another thing that would have probably helped is to have a simple hello example, which only includes the commands to be executed, i.e. xsd ... xsd ... c++ ... I've tried to trace back the make logic in your blog post introducing the --file-per-type mode, and at first it was overwhelming, even though now it perfectly makes sense. All the best, -- Dr. Yury V. Zaytsev Senior Software Developer IT Data Production TravelTainment GmbH Carlo-Schmid-Stra?e 12 52146 W?rselen/Aachen, Germany yury.zaytsev@traveltainment.de http://www.traveltainment.de Amtsgericht Aachen, HRB 15873 Gesch?ftsf?hrer: Bernhard Steffens (Vorsitzender), Dr. Oliver Rengelshausen From yury.zaytsev at traveltainment.de Tue Apr 21 04:46:13 2015 From: yury.zaytsev at traveltainment.de (Yury Zaytsev) Date: Tue Apr 21 07:51:56 2015 Subject: [xsd-users] Handling of complex restrictions on types In-Reply-To: References: Message-ID: Hi Boris, Thank you very much for the clarification! On Mon, 23 Mar 2015, Boris Kolpackov wrote: > > While some could argue that this is not the right way to handle it (i.e., > this is a "programming error", from the object model's point of view), I > can also see why some might want this behavior. The good question to ask > is what are you going to do when such an exception is thrown? In > particular, there is almost certainly no way to automatically recover > from it. Well, my applications basically read and process the input data, open the root element and some container element, and then stream serialized elements of the same type one by one, finally closing the container element and the root element. So, from my perspective, there is a very clear way of handling such exceptions: I would simply conclude that there is an issue with how I'm filling the object model in, either due to invalid input that slipped through my checks, or due to missing / incorrect business logic. This means that I would just abort the attempt to emit this particular element, log the information that would allow me to identify the problem later, and happily continue processing the rest of the dataset. Of course, the situation could be completely different (and not that obvious at all) for other use cases... > If you do decide to implement this yourself, you may want to check > the type customization mechanism. This way you will be able to add > the extra checks transparently wrt to the users of the object model. For now, I opted to transform the input data in ways that it's going to be less likely to cause problems, but, indeed, it's just a stop-gap solution. Is this what you referred to (also in the enum thread): http://wiki.codesynthesis.com/Tree/Customization_guide So, the idea is basically to have XSD to generate base classes, and inherit manually written ones implementing custom restrictions from those? All the best, -- Dr. Yury V. Zaytsev Senior Software Developer IT Data Production TravelTainment GmbH Carlo-Schmid-Stra?e 12 52146 W?rselen/Aachen, Germany yury.zaytsev@traveltainment.de http://www.traveltainment.de Amtsgericht Aachen, HRB 15873 Gesch?ftsf?hrer: Bernhard Steffens (Vorsitzender), Dr. Oliver Rengelshausen From boris at codesynthesis.com Wed Apr 22 12:21:21 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Apr 22 12:33:30 2015 Subject: [xsd-users] Receiving error using xsd on W3 PROV schema In-Reply-To: References: Message-ID: Hi Mohammad, Mohammad Khatami writes: > prov-core.xsd:6:307: error: unable to map XML Schema namespace ' > http://www.w3.org/ns/prov#' to C++ namespace > prov-core.xsd:6:307: info: use the --namespace-map or --namespace-regex > option to provide custom mapping See the documentation for the --namespace-map option, as suggested in the diagnostics: http://codesynthesis.com/projects/xsd/documentation/xsd.xhtml Boris From Joseph.Gagnon at ll.mit.edu Thu Apr 23 09:52:45 2015 From: Joseph.Gagnon at ll.mit.edu (Gagnon, Joseph - 0553 - MITLL) Date: Thu Apr 23 09:53:31 2015 Subject: [xsd-users] Examples of serializing to DOM Message-ID: Hello, I've just started investigating Code Synthesis XSD and what it can do. In the C++/Tree Mapping user manual there's a chapter on serialization, but it does not provide a full example of how to go about serialization to DOM. // Obtain the object model. // std::auto_ptr r = ... using namespace xercesc; XMLPlatformUtils::Initialize (); { // Create a DOM instance. Set custom namespace mapping and schema // location attributes. // DOMDocument& doc = ... // Serialize to DOM. // name (doc, *r); // Serialize the DOM document to XML. // ... } XMLPlatformUtils::Terminate (); For example, what needs to be done to complete the assignment to the DOM document object? Also, the last part that indicates that the DOM will be serialized to XML. What are the steps needed to do that? Thanks, Joe Gagnon Engineer II Group 58 - Cyber Systems & Technology MIT Lincoln Laboratory Lexington, MA -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 5625 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20150423/0f476826/smime.bin From boris at codesynthesis.com Thu Apr 23 10:30:37 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Apr 23 10:42:46 2015 Subject: [xsd-users] Examples of serializing to DOM In-Reply-To: References: Message-ID: Hi Joseph, Gagnon, Joseph - 0553 - MITLL writes: > In the C++/Tree Mapping user manual there's a chapter on serialization, > but it does not provide a full example of how to go about serialization > to DOM. See the FAQ: http://wiki.codesynthesis.com/Tree/FAQ As well as the examples that come with XSD. A few of them do what you want (e.g., 'messaging', 'performance'). Boris From Joseph.Gagnon at ll.mit.edu Fri Apr 24 07:55:52 2015 From: Joseph.Gagnon at ll.mit.edu (Gagnon, Joseph - 0553 - MITLL) Date: Fri Apr 24 07:56:01 2015 Subject: [xsd-users] API documentation Message-ID: Is there any documentation for the Code Synthesis XSD API? Does anyone know if there is any similar documentation for the Xerces C++ API? Thanks, Joe Gagnon Engineer II Group 58 - Cyber Systems & Technology MIT Lincoln Laboratory Lexington, MA -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 5625 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20150424/3c0d61fa/smime.bin From mdkhatami at gmail.com Mon Apr 27 06:07:16 2015 From: mdkhatami at gmail.com (Mohammad Khatami) Date: Mon Apr 27 06:07:24 2015 Subject: [xsd-users] Receiving error using xsd on W3 PROV schema In-Reply-To: References: Message-ID: Thanks Boris, Now it's works fine and have access to function for serialization . The only problem the prov:id which is used in Entity type is defined as follow in XML schema: and the produced code for in Entity name space is: // id // typedef ::xml_schema::qname id_type; typedef ::xsd::cxx::tree::optional< id_type > id_optional; typedef ::xsd::cxx::tree::traits< id_type, char > id_traits; const id_optional& id () const; id_optional& id (); void id (const id_type& x); void id (const id_optional& x); void id (::std::auto_ptr< id_type > p); but the problem is I can't set the value for this attribute according to manual page. void f (object& o) { using xml_schema::string; if (o.member ().present ()) // test { string& s (o.member ().get ()); // get o.member ("hello"); // set, deep copy o.member ().set ("hello"); // set, deep copy o.member ().reset (); // reset } // Same as above but using pointer notation: // if (o.member ()) // test { string& s (*o.member ()); // get o.member ("hello"); // set, deep copy *o.member () = "hello"; // set, deep copy o.member ().reset (); // reset } would you please help me how to set id attribute (generally optional value) ? Best Regards, Mohammad On 22 April 2015 at 18:21, Boris Kolpackov wrote: > Hi Mohammad, > > Mohammad Khatami writes: > > > prov-core.xsd:6:307: error: unable to map XML Schema namespace ' > > http://www.w3.org/ns/prov#' to C++ namespace > > prov-core.xsd:6:307: info: use the --namespace-map or --namespace-regex > > option to provide custom mapping > > See the documentation for the --namespace-map option, as suggested > in the diagnostics: > > http://codesynthesis.com/projects/xsd/documentation/xsd.xhtml > > Boris > From yury.zaytsev at traveltainment.de Mon Apr 27 07:42:58 2015 From: yury.zaytsev at traveltainment.de (Yury Zaytsev) Date: Mon Apr 27 12:31:59 2015 Subject: [xsd-users] Get tag name of a generated type Message-ID: Hi, I'm wondering what's the easiest / recommended way of finding out the tag name corresponding to the C++/Tree type? I can see that the tag name is hard-coded in the generated code for parsing and serialization, but it doesn't seem to be available for external use through any kind of public interface. I imagine that the generator could encode it as a static constexpr char* class member with a public getter and use its symbolic name for parsing and serialization. Could this possibly the added to XSD, or this is a bad idea for reasons that I have overlooked? In any case, what would be the easiest way to get it as it stands? All I can think of right now is to create a dummy containing element, serialize a dummy child element to DOM and do something like that on it: const ::xsd::cxx::xml::qualified_name< char > n ( ::xsd::cxx::xml::dom::name< char > (e)); but this doesn't really look like a an elegant solution... All the best, -- Dr. Yury V. Zaytsev Senior Software Developer IT Data Production TravelTainment GmbH Carlo-Schmid-Stra?e 12 52146 W?rselen/Aachen, Germany yury.zaytsev@traveltainment.de http://www.traveltainment.de Amtsgericht Aachen, HRB 15873 Gesch?ftsf?hrer: Bernhard Steffens (Vorsitzender), Dr. Oliver Rengelshausen From boris at codesynthesis.com Tue Apr 28 09:53:07 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Apr 28 10:05:17 2015 Subject: [xsd-users] Get tag name of a generated type In-Reply-To: References: Message-ID: Hi Yury, Yury Zaytsev writes: > I'm wondering what's the easiest / recommended way of finding out the tag > name corresponding to the C++/Tree type? There could be no such way since an (XML Schema) type can be used to classify several elements (and even attributes). Which element name do you want returned? Some things that you may find relevant: 1. DOM Assocication. 2. Element types (see the 'messaging' example). Boris From yury.zaytsev at traveltainment.de Tue Apr 28 11:05:52 2015 From: yury.zaytsev at traveltainment.de (Yury Zaytsev) Date: Wed Apr 29 07:32:57 2015 Subject: [xsd-users] Get tag name of a generated type In-Reply-To: References: Message-ID: Hi Boris, On Tue, 28 Apr 2015, Boris Kolpackov wrote: > There could be no such way since an (XML Schema) type can be used to > classify several elements (and even attributes). Which element name > do you want returned? Thank you very much for the explanation! Now I understand the problem a bit better: in my schemas, many types correspond to single elements, so I have overlooked this issue. > Some things that you may find relevant: > > 1. DOM Assocication. > 2. Element types (see the 'messaging' example). These pointers are highly appreciated, it solves the problem when parsing. The motivation for my original question, however, was as follows: I'm using streaming to serialize a large number of child elements of a parent element, and for now I had to hardcode the element names for s.next() calls. So, I thought that it would be great if I could get this information from the types instead. It seems that I should just keep on using hardcoded values though, as there is no easy way around it :-/ All the best, -- Dr. Yury V. Zaytsev Senior Software Developer IT Data Production TravelTainment GmbH Carlo-Schmid-Stra?e 12 52146 W?rselen/Aachen, Germany yury.zaytsev@traveltainment.de http://www.traveltainment.de Amtsgericht Aachen, HRB 15873 Gesch?ftsf?hrer: Bernhard Steffens (Vorsitzender), Dr. Oliver Rengelshausen