From rmcavalcante at gmail.com Mon May 3 05:04:36 2010 From: rmcavalcante at gmail.com (Roberto Cavalcante) Date: Mon May 3 05:04:40 2010 Subject: [xsd-users] Problem to transform XML to C++ Message-ID: Hello everybody! Firstly, I'd like to say I'm no XML expert and this is the first time I've used XSD, so please be patient and forgive me in advance if I say something senseless ;-) I have some .XSDs files I need to convert to C++. I've successfully configured the environment and ran the example. However, when I tried to convert my .XSD, it complained that it cannot find some external XSDs files; like for instance, http://www.w3.org/2001/03/xml.xsd, among others. So, after a look at xsd.xhtml, I've decided to download all XSDs one-by-one because I could not identify a parameter that could allow xsd.exe to search on web for external xsd files. After all downloads, I used this command line: xsd cxx-tree --location-map http://www.w3.org/2001/03/xml.xsd=xml.xsd--location-map http://dublincore.org/schemas/xmls/qdc/2008/02/11/dc.xsd=dc.xsd --location-map http://www.w3.org/Math/XMLSchema/mathml2/mathml2.xsd=mathml2.xsd railML.xsd I've got the following error message: xsd cxx-tree --location-map http://www.w3.org/2001/03/xml.xsd=xml.xsd--location-map http://dublincore.org/schemas/xmls/qdc/2008/02/11/dc.xsd=dc.xsd --location-map http://www.w3.org/Math/XMLSchema/mathml2/mathml2.xsd=mathml2.xsd railML.xsd dc.xsd:72:53: warning F001: element 'title' is implicitly of anyType dc.xsd:72:53: info: did you forget to specify 'type' attribute? dc.xsd:73:55: warning F001: element 'creator' is implicitly of anyType dc.xsd:73:55: info: did you forget to specify 'type' attribute? dc.xsd:74:55: warning F001: element 'subject' is implicitly of anyType dc.xsd:74:55: info: did you forget to specify 'type' attribute? dc.xsd:75:59: warning F001: element 'description' is implicitly of anyType dc.xsd:75:59: info: did you forget to specify 'type' attribute? dc.xsd:76:57: warning F001: element 'publisher' is implicitly of anyType dc.xsd:76:57: info: did you forget to specify 'type' attribute? dc.xsd:77:59: warning F001: element 'contributor' is implicitly of anyType dc.xsd:77:59: info: did you forget to specify 'type' attribute? dc.xsd:78:52: warning F001: element 'date' is implicitly of anyType dc.xsd:78:52: info: did you forget to specify 'type' attribute? dc.xsd:79:52: warning F001: element 'type' is implicitly of anyType dc.xsd:79:52: info: did you forget to specify 'type' attribute? dc.xsd:80:54: warning F001: element 'format' is implicitly of anyType dc.xsd:80:54: info: did you forget to specify 'type' attribute? dc.xsd:81:58: warning F001: element 'identifier' is implicitly of anyType dc.xsd:81:58: info: did you forget to specify 'type' attribute? dc.xsd:82:54: warning F001: element 'source' is implicitly of anyType dc.xsd:82:54: info: did you forget to specify 'type' attribute? dc.xsd:83:56: warning F001: element 'language' is implicitly of anyType dc.xsd:83:56: info: did you forget to specify 'type' attribute? dc.xsd:84:56: warning F001: element 'relation' is implicitly of anyType dc.xsd:84:56: info: did you forget to specify 'type' attribute? dc.xsd:85:56: warning F001: element 'coverage' is implicitly of anyType dc.xsd:85:56: info: did you forget to specify 'type' attribute? dc.xsd:86:54: warning F001: element 'rights' is implicitly of anyType dc.xsd:86:54: info: did you forget to specify 'type' attribute? presentation\style.xsd:40:50: error: attribute name 'mstyle.attlist/linethickness' creates an unstable conflict when used as a type name presentation\layout.xsd:37:20: info: conflicting type is defined here presentation\style.xsd:40:50: info: use --anonymous-regex to resolve this conflict presentation\style.xsd:40:50: info: and don't forget to pass the same option when translating 'style.xsd' and all the schemas that refer to it -------- As you can see, the XSD target is railML.xsd. In case you wanna reproduce the "problem" you'll can find all files here http://www.railml.org/2010/index.php/namespace-2009.html. Additionally, you'll need other files because as I said before, xsd.exe seems does not have an option/command/configuration to allow external(internet) search. I really don't know what this error message mean and how to create this regex. Any help you can provide in this regard is welcome. Thanks in advance. Roberto From boris at codesynthesis.com Mon May 3 06:28:40 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon May 3 06:19:38 2010 Subject: [xsd-users] Problem to transform XML to C++ In-Reply-To: References: Message-ID: Hi Roberto, Roberto Cavalcante writes: > In case you wanna reproduce the "problem" you'll can find all files here > http://www.railml.org/2010/index.php/namespace-2009.html. I have created a wiki page for this schema with the instructions on how to compile everything with XSD: http://wiki.codesynthesis.com/Schemas/RailML > Additionally, you'll need other files because as I said before, xsd.exe > seems does not have an option/command/configuration to allow external > (internet) search. XSD does not support network downloading of schemas for security, efficiency, and predictability reasons. Boris From rmcavalcante at gmail.com Mon May 3 07:55:31 2010 From: rmcavalcante at gmail.com (Roberto Cavalcante) Date: Mon May 3 07:55:40 2010 Subject: [xsd-users] Problem to transform XML to C++ In-Reply-To: References: Message-ID: Boris, Thank you very much for your fast answer. I'll try your solution right away. I'll let you know when I have finish it. Thanks again. Roberto On Mon, May 3, 2010 at 12:28 PM, Boris Kolpackov wrote: > Hi Roberto, > > Roberto Cavalcante writes: > > > In case you wanna reproduce the "problem" you'll can find all files here > > http://www.railml.org/2010/index.php/namespace-2009.html. > > I have created a wiki page for this schema with the instructions on how > to compile everything with XSD: > > http://wiki.codesynthesis.com/Schemas/RailML > > > > Additionally, you'll need other files because as I said before, xsd.exe > > seems does not have an option/command/configuration to allow external > > (internet) search. > > XSD does not support network downloading of schemas for security, > efficiency, and predictability reasons. > > Boris > From rmcavalcante at gmail.com Mon May 3 09:29:17 2010 From: rmcavalcante at gmail.com (Roberto Cavalcante) Date: Mon May 3 09:29:28 2010 Subject: [xsd-users] Problem to transform XML to C++ In-Reply-To: References: Message-ID: It works!!!!! Thank you very much Boris! Now I need to generate C++ instances from a XML that uses railML.xsd. Any other tips? Thanks again! Roberto On Mon, May 3, 2010 at 1:55 PM, Roberto Cavalcante wrote: > Boris, > > > Thank you very much for your fast answer. > I'll try your solution right away. > I'll let you know when I have finish it. > > Thanks again. > > Roberto > > > On Mon, May 3, 2010 at 12:28 PM, Boris Kolpackov wrote: > >> Hi Roberto, >> >> Roberto Cavalcante writes: >> >> > In case you wanna reproduce the "problem" you'll can find all files here >> > http://www.railml.org/2010/index.php/namespace-2009.html. >> >> I have created a wiki page for this schema with the instructions on how >> to compile everything with XSD: >> >> http://wiki.codesynthesis.com/Schemas/RailML >> >> >> > Additionally, you'll need other files because as I said before, xsd.exe >> > seems does not have an option/command/configuration to allow external >> > (internet) search. >> >> XSD does not support network downloading of schemas for security, >> efficiency, and predictability reasons. >> >> Boris >> > > From howes at ll.mit.edu Mon May 3 09:37:32 2010 From: howes at ll.mit.edu (Brad Howes) Date: Mon May 3 09:37:43 2010 Subject: [xsd-users] GML 3.2.1 w/ --generate-inline Message-ID: <2C1EBF37-F3D7-4F0F-81D4-F0EFD21585EC@ll.mit.edu> Boris, FYI, the GML 3.2.1 tarball compiles just fine with the settings you provided. However, adding --generate-inline will make it fail due to an incomplete type 'const struct gco::Boolean_PropertyType' Brad -- Brad Howes Group 42 MIT Lincoln Laboratory ? 244 Wood St. ? Lexington, MA 02173 Phone: 781.981.5292 ? Fax: 781.981.3495 ? Secretary: 781.981.7420 From boris at codesynthesis.com Mon May 3 11:13:07 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon May 3 11:05:55 2010 Subject: [xsd-users] GML 3.2.1 w/ --generate-inline In-Reply-To: <2C1EBF37-F3D7-4F0F-81D4-F0EFD21585EC@ll.mit.edu> References: <2C1EBF37-F3D7-4F0F-81D4-F0EFD21585EC@ll.mit.edu> Message-ID: Hi Brad, Brad Howes writes: > FYI, the GML 3.2.1 tarball compiles just fine with the settings you > provided. However, adding --generate-inline will make it fail due to > an incomplete type 'const struct gco::Boolean_PropertyType' The problem is this: there is a type in the gco namespace named Boolean_PropertyType. And there is a type in gml named BooleanPropertyType. When this is compiled in the file-per- type mode, the two sets of generated files are named as Boolean_PropertyType.?xx and BooleanPropertyType.?xx. However, the header inclusion guards for both sets end up being the same BOOLEAN_PROPERTY_TYPE_HXX. This results in proper files not being included. The -split-code package compiles fine since there the files are placed into different directroies and the guards include the directory prefixed. For the other package this can be resolved by adding the following option to gml.options to rename one of the files to something more unique: --type-file-regex %http://www.isotc211.org/2005/gco Boolean_PropertyType%GcoBooleanPropertyType% I will upload the updated package to the wiki shortly. Boris From boris at codesynthesis.com Mon May 3 11:51:45 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon May 3 11:43:03 2010 Subject: [xsd-users] Problem to transform XML to C++ In-Reply-To: References: Message-ID: Hi Roberto, Roberto Cavalcante writes: > Now I need to generate C++ instances from a XML that uses railML.xsd. > > Any other tips? I suggest that you read the documentation and study the examples: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/ Boris From erik.sjolund at gmail.com Tue May 4 08:43:21 2010 From: erik.sjolund at gmail.com (=?ISO-8859-1?Q?Erik_Sj=F6lund?=) Date: Tue May 4 08:43:30 2010 Subject: [xsd-users] bug fix in the streaming example Message-ID: There seems to be a problem with name spaces in the streaming example. The example program can't handle some valid input files. For details see the terminal session in the attached file "terminal.txt". What do you think about the attached patch? cheers, Erik Sj?lund -------------- next part -------------- user@linux:/tmp/xsd-git/xsd/examples/cxx/tree/streaming$ cp position.xml position2.xml user@linux:/tmp/xsd-git/xsd/examples/cxx/tree/streaming$ emacs position2.xml user@linux:/tmp/xsd-git/xsd/examples/cxx/tree/streaming$ xmllint -noout -schema position.xsd position2.xml position2.xml validates user@linux:/tmp/xsd-git/xsd/examples/cxx/tree/streaming$ xmllint -noout -schema position.xsd position.xml position.xml validates user@linux:/tmp/xsd-git/xsd/examples/cxx/tree/streaming$ ./driver position.xml id: 123 name: Lion's Head type: rock lat: -33.8569 lon: 18.5083 lat: -33.8568 lon: 18.5083 lat: -33.8568 lon: 18.5082 lat: -33.857 lon: 18.5083 lat: -33.8569 lon: 18.5084 lat: -33.857 lon: 18.5084 lat: -33.857 lon: 18.5082 lat: -33.8569 lon: 18.5082 user@linux:/tmp/xsd-git/xsd/examples/cxx/tree/streaming$ ./driver position2.xml terminate called after throwing an instance of 'xercesc_3_0::DOMException' Aborted user@linux:/tmp/xsd-git/xsd/examples/cxx/tree/streaming$ diff -u position.xml position2.xml --- position.xml 2010-05-04 11:57:13.000000000 +0200 +++ position2.xml 2010-05-04 13:53:24.000000000 +0200 @@ -8,23 +8,23 @@ --> - -
+
Lion's Head rock
- - - - - - - - + + + + + + + + - + user@linux:/tmp/xsd-git/xsd/examples/cxx/tree/streaming$ git branch streaming_example * master user@linux:/tmp/xsd-git/xsd/examples/cxx/tree/streaming$ git checkout streaming_example M examples/cxx/tree/streaming/makefile Switched to branch 'streaming_example' user@linux:/tmp/xsd-git/xsd/examples/cxx/tree/streaming$ ./driver position2.xml id: 123 name: Lion's Head type: rock lat: -33.8569 lon: 18.5083 lat: -33.8568 lon: 18.5083 lat: -33.8568 lon: 18.5082 lat: -33.857 lon: 18.5083 lat: -33.8569 lon: 18.5084 lat: -33.857 lon: 18.5084 lat: -33.857 lon: 18.5082 lat: -33.8569 lon: 18.5082 user@linux:/tmp/xsd-git/xsd/examples/cxx/tree/streaming$ ./driver position.xml id: 123 name: Lion's Head type: rock lat: -33.8569 lon: 18.5083 lat: -33.8568 lon: 18.5083 lat: -33.8568 lon: 18.5082 lat: -33.857 lon: 18.5083 lat: -33.8569 lon: 18.5084 lat: -33.857 lon: 18.5084 lat: -33.857 lon: 18.5082 lat: -33.8569 lon: 18.5082 -------------- next part -------------- A non-text attachment was scrubbed... Name: streaming_example_fix.patch Type: text/x-diff Size: 1357 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20100504/21345649/streaming_example_fix.bin From boris at codesynthesis.com Tue May 4 12:30:31 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue May 4 12:21:35 2010 Subject: [xsd-users] bug fix in the streaming example In-Reply-To: References: Message-ID: Hi Erik, Erik Sj?lund writes: > There seems to be a problem with name spaces in the streaming example. > The example program can't handle some valid input files. > > [...] > > -
> +
It appears that Xerces-C++ SAX implementation has a bug/deficiency in that it does not supply the proper namespace for the xmlns attributes in the form xmlns="..." (i.e., when there is no prefix). > - cur_->setAttributeNS (attr.getURI (i), > - attr.getQName (i), > - attr.getValue (i)); > + if (! XMLString::startsWith(attr.getQName(i), xmlnsStr)) { > + cur_->setAttributeNS (attr.getURI (i), > + attr.getQName (i), > + attr.getValue (i)); > + } I instead fixed it like this: const XMLCh* qn (attr.getQName (i)); const XMLCh* ns (attr.getURI (i)); // When SAX2 reports the xmlns attribute, it does not include // the proper attribute namespace. So we have to detect and // handle this case. // if (XMLString::equals (qn, XMLUni::fgXMLNSString)) ns = XMLUni::fgXMLNSURIName; cur_->setAttributeNS (ns, qn, attr.getValue (i)); Thanks for reporting this! Boris From jim.pacyga at control-pt.com Tue May 4 16:50:04 2010 From: jim.pacyga at control-pt.com (Jim Pacyga) Date: Wed May 5 02:16:26 2010 Subject: [xsd-users] Compiling XSD with Qt Creator (Qt v4.6) Message-ID: <003201caebcb$6035afa0$20a10ee0$@pacyga@control-pt.com> Hello all, I've just recently found out about XSD, and was wondering if anyone has tried to compile any of the examples using Qt Creator, part of the Qt SDK v4.6 on Windows XP SP3. I've tried a few things, namely including the correct "include" directory in the "INCLUDEPATH" of my .pro file. However, I believe I'm getting stuck on the fact that there is no pre-compiled Xerces library to link to, so I get a bunch of "undefined references to..." during link time. I've tried compiling Xerces-C in Cygwin using the instructions here: http://www.codesynthesis.com/projects/xsd/extras/build-windows.xhtml The Xerces library compiles fine, but the resulting library (.a file) does not seem to satisfy Qt Creator when linking. Any help would be appreciated. Thanks. Jim Pacyga From boris at codesynthesis.com Wed May 5 14:01:41 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed May 5 13:52:59 2010 Subject: [xsd-users] Compiling XSD with Qt Creator (Qt v4.6) Message-ID: Hi Jim, Jim Pacyga writes: > I've tried compiling Xerces-C in Cygwin using the instructions here: > > http://www.codesynthesis.com/projects/xsd/extras/build-windows.xhtml > > The Xerces library compiles fine, but the resulting library (.a file) does > not seem to satisfy Qt Creator when linking. I have downloaded Qt Creator and gave it a try. I have added the instructions to the Wiki: http://wiki.codesynthesis.com/Using_XSD_with_Qt_Creator I got to the step 5. That is, I successfully built XSD examples with Xerces-C++ built with Qt's MinGW compiler. While I haven't tried to create a project in Qt Creator, I don't see a reason why this won't work. Also, it would be great if you could expand the above page to include some specific information about where and how to add the various search paths. Also, if you are planning to add XSD as a custom build step to Qt Reactor, instructions on that would be most welcome as well. Boris From jim.pacyga at control-pt.com Wed May 5 15:20:23 2010 From: jim.pacyga at control-pt.com (Jim Pacyga) Date: Wed May 5 15:42:17 2010 Subject: [xsd-users] Compiling XSD with Qt Creator (Qt v4.6) In-Reply-To: References: Message-ID: <003d01caec88$04d955e0$0e8c01a0$@pacyga@control-pt.com> Hi Boris, Thank you for the instructions on building Xerces with Cygwin. I've accomplished that and it seemed to build without errors. However, I am still struggling with the next step of compiling a project in Qt Creator that uses the library. I'm getting a bunch of "undefined reference"s during link time. If it helps, the following lists my "main.cpp" file (which does nothing but include my generated class) and the Qt .pro file. You should easily be able to reproduce this (using your own generated .h file from XSD) using Qt Creator. Any additional help would be appreciated. Thanks, Jim main.cpp: #include #include "VhmVddmMsgsV0_0.hxx" int main(int argc, char *argv[]) { return 0; } xml_example.pro: TARGET = xml_example TEMPLATE = app LIBS += -L"C:\Program Files\CodeSynthesis XSD 3.3\xerces-c-3.1.1\src\.libs" -lxerces-c INCLUDEPATH += "C:\Program Files\CodeSynthesis XSD 3.3\include" \ "C:\Program Files\CodeSynthesis XSD 3.3\xerces-c-3.1.1\src" SOURCES += main.cpp \ VhmVddmMsgsV0_0.cxx HEADERS += VhmVddmMsgsV0_0.hxx ---------------------------------- Jim Pacyga Software Engineer Control Point Corporation (248) 740-1512 x227 -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Wednesday, May 05, 2010 2:02 PM To: Jim Pacyga Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] Compiling XSD with Qt Creator (Qt v4.6) Hi Jim, Jim Pacyga writes: > I've tried compiling Xerces-C in Cygwin using the instructions here: > > http://www.codesynthesis.com/projects/xsd/extras/build-windows.xhtml > > The Xerces library compiles fine, but the resulting library (.a file) does > not seem to satisfy Qt Creator when linking. I have downloaded Qt Creator and gave it a try. I have added the instructions to the Wiki: http://wiki.codesynthesis.com/Using_XSD_with_Qt_Creator I got to the step 5. That is, I successfully built XSD examples with Xerces-C++ built with Qt's MinGW compiler. While I haven't tried to create a project in Qt Creator, I don't see a reason why this won't work. Also, it would be great if you could expand the above page to include some specific information about where and how to add the various search paths. Also, if you are planning to add XSD as a custom build step to Qt Reactor, instructions on that would be most welcome as well. Boris From boris at codesynthesis.com Wed May 5 16:06:15 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed May 5 15:57:23 2010 Subject: [xsd-users] Compiling XSD with Qt Creator (Qt v4.6) Message-ID: Hi Jim, Jim Pacyga writes: > If it helps, the following lists my "main.cpp" file (which does > nothing but include my generated class) and the Qt .pro file. > You should easily be able to reproduce this (using your own > generated .h file from XSD) using Qt Creator. I tried your project but apparently I need a Qt SDK to build anything with Qt Creator (I only downloaded the IDE). So I am getting the whole thing now. I have some suggestions in the meantime: > INCLUDEPATH += "C:\Program Files\CodeSynthesis XSD 3.3\include" \ > "C:\Program Files\CodeSynthesis XSD 3.3\xerces-c-3.1.1\src" I don't know if you installed Xerces-C++ headers when installing XSD-3.3.msi. If you did then they will be placed into the include directory and the C++ compiler will pick them up instead of the ones from the second path. This would be consistent with the errors that you get (those headers would cause the symbols to be DLL-imported). If that's the case, try to put the xerces-c-3.1.1\src path first or uninstall the Xerces-C++ headers. Boris From jim.pacyga at control-pt.com Wed May 5 16:22:25 2010 From: jim.pacyga at control-pt.com (Jim Pacyga) Date: Wed May 5 17:24:27 2010 Subject: [xsd-users] Compiling XSD with Qt Creator (Qt v4.6) In-Reply-To: References: Message-ID: <003e01caec90$ae780f30$0b682d90$@pacyga@control-pt.com> Hi Boris, > If that's the case, try to put the xerces-c-3.1.1\src path first or uninstall the Xerces-C++ headers. Putting the "xerces-c-3.1.1\src" first seems to have done the trick. Now I'm compiling and linking without any errors. Thank you for your help! My xml_example.pro now looks like this: TARGET = xml_example TEMPLATE = app LIBS += -L"C:\Program Files\CodeSynthesis XSD 3.3\xerces-c-3.1.1\src\.libs" \ -lxerces-c INCLUDEPATH += "C:\Program Files\CodeSynthesis XSD 3.3\xerces-c-3.1.1\src" \ "C:\Program Files\CodeSynthesis XSD 3.3\include" SOURCES += main.cpp \ VhmVddmMsgsV0_0.cxx HEADERS += VhmVddmMsgsV0_0.hxx Now to give this all a spin... Jim ---------------------------------- Jim Pacyga Software Engineer Control Point Corporation (248) 740-1512 x227 -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Wednesday, May 05, 2010 4:06 PM To: Jim Pacyga Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] Compiling XSD with Qt Creator (Qt v4.6) Hi Jim, Jim Pacyga writes: > If it helps, the following lists my "main.cpp" file (which does > nothing but include my generated class) and the Qt .pro file. > You should easily be able to reproduce this (using your own > generated .h file from XSD) using Qt Creator. I tried your project but apparently I need a Qt SDK to build anything with Qt Creator (I only downloaded the IDE). So I am getting the whole thing now. I have some suggestions in the meantime: > INCLUDEPATH += "C:\Program Files\CodeSynthesis XSD 3.3\include" \ > "C:\Program Files\CodeSynthesis XSD 3.3\xerces-c-3.1.1\src" I don't know if you installed Xerces-C++ headers when installing XSD-3.3.msi. If you did then they will be placed into the include directory and the C++ compiler will pick them up instead of the ones from the second path. This would be consistent with the errors that you get (those headers would cause the symbols to be DLL-imported). If that's the case, try to put the xerces-c-3.1.1\src path first or uninstall the Xerces-C++ headers. Boris From howes at ll.mit.edu Thu May 6 10:21:16 2010 From: howes at ll.mit.edu (Brad Howes) Date: Thu May 6 10:21:24 2010 Subject: [xsd-users] Graphml and Message-ID: <302A122B-5767-4FE4-9488-DA1580D16330@ll.mit.edu> Does XSD support the schema element? I'm trying to process GraphML, and I get graphml.xsd:10:55 unexpected top-level element: 'redefine' Here's the beginning of the graphml.xsd file: The file graphml-structure.xsd is there, and if I change redefine to include (and strip out the redefinitions) XSD works just fine. Brad -- Brad Howes Group 42 MIT Lincoln Laboratory ? 244 Wood St. ? Lexington, MA 02173 Phone: 781.981.5292 ? Fax: 781.981.3495 ? Secretary: 781.981.7420 From boris at codesynthesis.com Thu May 6 10:52:35 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu May 6 10:43:46 2010 Subject: [xsd-users] Graphml and In-Reply-To: <302A122B-5767-4FE4-9488-DA1580D16330@ll.mit.edu> References: <302A122B-5767-4FE4-9488-DA1580D16330@ll.mit.edu> Message-ID: Hi Brad. Brad Howes writes: > Does XSD support the schema element? No, and there are currently no plans to support it. Boris From rlischner at proteuseng.com Thu May 6 11:18:15 2010 From: rlischner at proteuseng.com (Ray Lischner) Date: Thu May 6 13:43:23 2010 Subject: [xsd-users] abstract and substitutionGroup Message-ID: We are trying to use substitutionGroup and abstract types. Below is a simplified form of our schema: A program constructs a Msg object as follows: #include "schema.h" int main() { xml_schema::namespace_infomap ns; ns[""].name = "msg"; msg::Der2 d(1, "str"); msg::Msg m(d); msg::message(std::cout, m, ns); } The resulting document is: 1 str The author of the schema claims that the abstract property should prevent the use of , and therefore force the use of : 1 str The author of the schema therefore claims that Code Synthesis has a defect. I'm afraid this dispute exceeds my level of XML Schema subtlety. Can you offer any help or suggestions? Thank you. Ray Lischner, Senior Member of Technical Staff 133 National Business Pkwy, Ste 150 t. 443.539.3448 Annapolis Junction, MD 20701 c. 410.854.5170 rlischner@proteuseng.com f. 443.539.3370 This electronic message and any files transmitted with it contain information which may be privileged and/or proprietary. The information is intended for use solely by the intended recipient(s). If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of this information is prohibited. If you have received this electronic message in error, please advise the sender by reply email or by telephone (443.539.3400) and delete the message. From boris at codesynthesis.com Thu May 6 14:08:06 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu May 6 13:59:32 2010 Subject: [xsd-users] abstract and substitutionGroup In-Reply-To: References: Message-ID: Hi Ray, Ray Lischner writes: > > > > > > > > > > > > > > > > > > > > > > > > > > ^^^^^ I assume you mean "base" here. > > > [...] > > The resulting document is: > > > > 1 > str > > > > The author of the schema claims that the abstract property should > prevent the use of , and therefore force the use of : > > > > 1 > str > > No, either or are valid forms since they both specify the actual type of the element which is not abstract. However, if the the base element itself were declared abstract: Then it is possible (thought I am not 100% sure) that the first version would have been invalid. Boris From rlischner at proteuseng.com Fri May 7 20:22:54 2010 From: rlischner at proteuseng.com (Ray Lischner) Date: Sun May 9 11:41:13 2010 Subject: [xsd-users] abstract and substitutionGroup In-Reply-To: References: , Message-ID: >No, either or are valid >forms since they both specify the actual type of the element which is >not abstract. However, if the the base element itself were declared >abstract: > >Then it is possible (thought I am not 100% sure) that the first version >would have been invalid. Is there a way we can get Code Synthesis to produce the second form instead of the first form when serializing to XML? P.S. this time I attached working examples instead of the hand-transcribed stuff I posted earlier. The makefile is suitable for use in a subdirectory of xsd/examples/cxx/tree/. Ray Lischner, Senior Member of Technical Staff 133 National Business Pkwy, Ste 150 t. 443.539.3448 Annapolis Junction, MD 20701 c. 410.854.5170 rlischner@proteuseng.com f. 443.539.3370 This electronic message and any files transmitted with it contain information which may be privileged and/or proprietary. The information is intended for use solely by the intended recipient(s). If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of this information is prohibited. If you have received this electronic message in error, please advise the sender by reply email or by telephone (443.539.3400) and delete the message. -------------- next part -------------- A non-text attachment was scrubbed... Name: schema.xsd Type: application/xsd Size: 1025 bytes Desc: schema.xsd Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20100507/3b6fc0ef/schema.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: driver.cxx Type: text/x-c++src Size: 217 bytes Desc: driver.cxx Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20100507/3b6fc0ef/driver.cxx -------------- next part -------------- A non-text attachment was scrubbed... Name: makefile Type: application/octet-stream Size: 3057 bytes Desc: makefile Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20100507/3b6fc0ef/makefile.obj From boris at codesynthesis.com Sun May 9 12:48:17 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun May 9 12:39:49 2010 Subject: [xsd-users] abstract and substitutionGroup In-Reply-To: References: Message-ID: Hi Ray, Ray Lischner writes: > Is there a way we can get Code Synthesis to produce the second form > instead of the first form when serializing to XML? The polymorphic type maps do not contain sufficient information to perform this kind of serialization. If I were to implement this I would probably generate a map containing base-derived information for polymorphic types. Then I would go down the inheritance hierarchy trying to find a substitution. It would be much easier to define a substituting element for Der2 in the schema. > P.S. this time I attached working examples instead of the hand- > transcribed stuff I posted earlier. That's always appreciated. Boris From bschindler at inf.ethz.ch Tue May 11 07:12:24 2010 From: bschindler at inf.ethz.ch (Benjamin Schindler) Date: Tue May 11 07:12:10 2010 Subject: [xsd-users] cmake module Message-ID: <4BE93B98.4090401@inf.ethz.ch> Hi I'm using xsd as one of my projects and I wrote a small module for cmake that will compile your files for you. The usage is similar to the qt module. Sobasically what you do is: WRAP_XSD(SERVER_XSDS_SRCS SERVER_XSDS_INCLUDE ${XSD_OUTPUT_DIR}/schema/core/server ${SERVER_XSDS} OPTIONS ${SERVER_XSD_ARGS}) INCLUDE_DIRECTORIES(${SERVER_XSDS_INCLUDE}) ADD_LIBRARY(server SHARED ${SERVER_SRCS} ${SERVER_XSDS_SRCS}) What it does is it copies the xsd over to the build directory and compile it from there. This might seem unintuitive but I wanted to have a self-contained build dir so I can support validation. Also I wanted to more easily support install targets (which I do not really yet). This means that if you include a schema which includes some other schema you wrote, the include path need to match the way the files are laid out in the build directory and not the source directory. I'm posting this here mostly to get some feedback and may be it's of use to some other people. It has taken a non-unsignificant amount of time to write :) It has been test in a linux-environment and under visual studio Cheers Benjamin -------------- next part -------------- # - Find CodeSource Xsd # This module can be used to find Xsd and it's include path # Variables: # XSD_EXECUTABLE # XSD_INCLUDE_DIR # XSD_FOUND SET(XSD_FOUND FALSE) if(WIN32) SET(__XSD_NAME xsd.exe) else(WIN32) SET(__XSD_NAME xsd) endif(WIN32) if(XSD_INCLUDE_DIR) #in cache already SET(XSD_FOUND TRUE) else(XSD_INCLUDE_DIR) find_file(XSD_EXECUTABLE NAMES ${__XSD_NAME} PATHS ${XSD_DIR}/bin /usr/bin /usr/local/bin ) if(XSD_EXECUTABLE) SET(XSD_FOUND TRUE) else(XSD_EXECUTABLE) SET(XSD_EXECUTABLE "xsd-NOTFOUND" CACHE FILE "xsd executable path") endif(XSD_EXECUTABLE) find_path(XSD_INCLUDE_DIR NAMES xsd PATHS ${XSD_DIR}/include /usr/include /usr/local/include ) if(XSD_INCLUDE_DIR) SET(XSD_FOUND TRUE) else(XSD_INCLUDE_DIR) SET(XSD_INCLUDE_DIR "xsd-include-NOTFOUND" CACHE PATH "xsd include path") endif(XSD_INCLUDE_DIR) endif(XSD_INCLUDE_DIR) FUNCTION(XSD_EXTRACT_OPTIONS _xsd_files _xsd_options) foreach(current_arg ${ARGN}) IF(${current_arg} STREQUAL "OPTIONS") SET(_XSD_DOING_OPTIONS TRUE) else(${current_arg} STREQUAL "OPTIONS") if(_XSD_DOING_OPTIONS) SET(_xsd_options_p ${_xsd_options_p} ${current_arg}) else(_XSD_DOING_OPTIONS) SET(_xsd_files_p ${_xsd_files_p} ${current_arg}) endif(_XSD_DOING_OPTIONS) endif(${current_arg} STREQUAL "OPTIONS") endforeach(current_arg) SET(${_xsd_files} ${_xsd_files_p} PARENT_SCOPE) SET(${_xsd_options} ${_xsd_options_p} PARENT_SCOPE) ENDFUNCTION(XSD_EXTRACT_OPTIONS) FUNCTION(WRAP_XSD XSD_SRCS XSD_INCLUDES OUT_PATH) SET(OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/src/xsd) FILE(MAKE_DIRECTORY ${OUTPUT_DIR}) SET(${XSD_INCLUDES} ${OUTPUT_DIR} PARENT_SCOPE) XSD_EXTRACT_OPTIONS(xsd_files xsd_options ${ARGN}) FOREACH(it ${xsd_files}) STRING(REGEX REPLACE ".*/" "" BARE_XSD "${it}" ) STRING(REGEX REPLACE ".xsd" ".cpp" SOURCE "${BARE_XSD}" ) STRING(REGEX REPLACE ".xsd" ".h" HEADER "${BARE_XSD}" ) CONFIGURE_FILE(${it} ${OUT_PATH}/${BARE_XSD} COPY_ONLY) SET(SOURCE ${OUTPUT_DIR}/${SOURCE}) SET(HEADER ${OUTPUT_DIR}/${HEADER}) ADD_CUSTOM_COMMAND(OUTPUT ${SOURCE} ${HEADER} COMMAND ${XSD_EXECUTABLE} ${xsd_options} "--output-dir" ${OUTPUT_DIR} ${OUT_PATH}/${BARE_XSD} DEPENDS ${it} VERBATIM ) set_source_files_properties(${HEADER} PROPERTIES GENERATED TRUE) set_source_files_properties(${SOURCE} PROPERTIES GENERATED TRUE) SET(_XSD_SRCS ${_XSD_SRCS} ${SOURCE} ${HEADER}) ENDFOREACH(it) SET(${XSD_SRCS} ${_XSD_SRCS} PARENT_SCOPE) ENDFUNCTION(WRAP_XSD) From boris at codesynthesis.com Tue May 11 09:33:50 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue May 11 09:25:22 2010 Subject: [xsd-users] cmake module In-Reply-To: <4BE93B98.4090401@inf.ethz.ch> References: <4BE93B98.4090401@inf.ethz.ch> Message-ID: Hi Benjamin, Benjamin Schindler writes: > What it does is it copies the xsd over to the build directory and > compile it from there. By "xsd" I assume you mean "xsd schema file", right? > This might seem unintuitive but I wanted to have a self-contained > build dir so I can support validation. One alternative to having to have schema files around for validation is to pre-compile them and embed the resulting binary representation into the application executable. See the 'embedded' example in the XSD 3.3.0 distribution for more information. > I'm posting this here mostly to get some feedback and may be it's of use > to some other people. It has taken a non-unsignificant amount of time to > write :) Thanks. I have added your .cmake file to the "Using XSD with CMake" Wiki page. BTW, there is already FindXSD.cmake by Brad Howes on this page which you may want to check out for ideas. Boris From gleonid at yahoo.com Tue May 11 17:09:37 2010 From: gleonid at yahoo.com (Leonid Gershanovich) Date: Tue May 11 17:09:45 2010 Subject: [xsd-users] xerces exceptions Message-ID: <193905.50070.qm@web112414.mail.gq1.yahoo.com> >Hi Eric, > >Eric Niebler writes: > >>I've discovered (a bit too late sadly) that xsd lets xerces exceptions >>propagate. Ideally, I'd like to deal exclusively with std and xsd types>>and not let any xerces types leak into my code. Is there an option to >>have xsd catch and translate xerces exceptions? > >No, no such option yet. Though I agree we should do it and I have >added an item to the TODO list. > >What can make it less of a problem is the fact that only "hard" >errors are reported by Xerces-C++ as exceptions (e.g., an out of >memory condition). Things like XML parsing errors are handled via >error handlers and are translated by the XSD-generated code. Hi, Boris, ? as long as exceptions are being discussed here I want to ask slightly another question. ? While looking at CodeSynthesis code (version 3.2.0) I have noticed that under?certain conditions generated code?throws a variaty of exceptions. ? Some of those exceptions are derived (directly or indirectly) from std::exception: 1. xsd::cxx:tree::_type::bad_dom_node_type 2. xsd::cxx:tree::_type::not_registered 3. xsd::cxx::tree::ace_cdr_stream_extraction 4. xsd::cxx::tree::ace_cdr_stream_insertion 5. xsd::cxx::tree::bounds 6. xsd::cxx::tree::duplicate_id 7. xsd::cxx::tree::expected_attribute 8. xsd::cxx::tree::expected_element 9. xsd::cxx::tree::expected_text_content 10. xsd::cxx::tree::no_prefix_mapping 11. xsd::cxx::tree::no_type_info 12. xsd::cxx::tree::parsing 13. xsd::cxx::tree::xdr_stream_extraction 14. xsd::cxx::tree::xdr_stream_insertion 15. xsd::cxx::parser::parsing Also there is a group of exceptions that has a common parent (xsd::cxx::parser::schema_exception), but not derived from std::exception: 1. xsd::cxx::parser::dynamic_type 2. xsd::cxx::parser::validating::expected_attribute 3. xsd::cxx::parser::expected_element 4. xsd::cxx::parser::validating::invalid_value 5. xsd::cxx::parser::validating::unexpected_attribute 6. xsd::cxx::parser::validating::unexpected_characters 7. xsd::cxx::parser::unexpected_element And there is another set of exceptions, which are essentially an empty struct declarations: 1. xsd::cxx::xml::sax::std_input_source::copy {} 2. xsd::cxx::xml::properties::argument {} 3. xsd::cxx::parser::buffer::bounds {} 4. xsd::cxx::xml::invalid_utf16_string {} 5. xsd::cxx::xml::invalid_utf8_string {} I briefly checked CodeSynthesis version 3.3.0 and in most cases it seem the same. ? So my questions are: 1. Have you considered to make all exceptions in CodeSynthesis to be derived from std::exception? 2. What was the original reason not use std::exception? ? Thanks in advance ?Leonid Gershanovich From boris at codesynthesis.com Wed May 12 13:08:29 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed May 12 12:58:11 2010 Subject: [xsd-users] xerces exceptions In-Reply-To: <193905.50070.qm@web112414.mail.gq1.yahoo.com> References: <193905.50070.qm@web112414.mail.gq1.yahoo.com> Message-ID: Hi Leonid, Leonid Gershanovich writes: > Also there is a group of exceptions that has a common parent > (xsd::cxx::parser::schema_exception), but not derived from > std::exception: > 1. xsd::cxx::parser::dynamic_type > 2. xsd::cxx::parser::validating::expected_attribute > 3. xsd::cxx::parser::expected_element > 4. xsd::cxx::parser::validating::invalid_value > 5. xsd::cxx::parser::validating::unexpected_attribute > 6. xsd::cxx::parser::validating::unexpected_characters > 7. xsd::cxx::parser::unexpected_element These are internal C++/Parser exception. They never rich the user code and instead are translated to the error handler calls. They are not derived from std::exception since that would simply add more overhead without any benefit. > And there is another set of exceptions, which are essentially an > empty struct declarations: > 1. xsd::cxx::xml::sax::std_input_source::copy {} > 2. xsd::cxx::xml::properties::argument {} > 3. xsd::cxx::parser::buffer::bounds {} > 4. xsd::cxx::xml::invalid_utf16_string {} > 5. xsd::cxx::xml::invalid_utf8_string {} > > [...] > > So my questions are: > 1. Have you considered to make all exceptions in CodeSynthesis to > be derived from std::exception? Yes, these should be derived from xsd::exception (which derives from std::exception). I have an item in the TODO list for the next release. > 2. What was the original reason not use std::exception? The original reason for not deriving them from std::exception was that if any of these exceptions is thrown, it most likely means there is a bug in the program or XSD and the best course of action is probably not to catch them and let the program terminate with some debug information. But, I agree, we (as in XSD developers), shouldn't be making this decision. If the program needs to catch all the exceptions we shouldn't be making it more difficult to do so. Thanks for preparing the detailed analysis of the current situation! Boris From sancelot at free.fr Fri May 14 11:05:36 2010 From: sancelot at free.fr (stephane ancelot) Date: Fri May 14 11:05:57 2010 Subject: [xsd-users] problem with namespace mapping Message-ID: I have probleme when parsing my xml file, I have always this error : outillage_default.xml:3:64 error: schema document 'outillage.xsd' has different target namespace from the one specified in instance document 'outillage' outillage_default.xml:3:64 error: no declaration found for element 'outillage' outillage_default.xml:3:64 error: attribute 'machine' is not declared for element 'outillage' xsd cxx-tree --namespace-map outillage.xsd="outillage" outillage.xsd outillage.xsd: Definition de l'outillage. outillage.xml : Any idea ? Best Regards Steph From boris at codesynthesis.com Fri May 14 11:48:22 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri May 14 11:38:11 2010 Subject: [xsd-users] problem with namespace mapping In-Reply-To: References: Message-ID: Hi Stephane stephane ancelot writes: > outillage_default.xml:3:64 error: schema document 'outillage.xsd' has > different target namespace from the one specified in instance document > 'outillage' > > [...] > > outillage.xsd: > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:xhtml="http://www.w3.org/1999/xhtml" > xmlns:ns1="outillage.xsd" > targetNamespace="outillage.xsd" > elementFormDefault="qualified" > attributeFormDefault="unqualified"> > Your schema has 'outillage.xsd' as its target namespace. This means that all the elements in your vocabulary are in this namespace. > outillage.xml : > > xsi:schemaLocation="outillage outillage.xsd" machine=""> Your instance document uses the outillage element (and other elements) unqualified while your schema says they should be in the 'outillage.xsd' namespace. Try adding the xmlns="outillage.xsd" to the root element: I'm using XSD tree mapping. I would like to be able to force empty elements to be written out as start end tags instead of an empty tag, i.e. start/end tags: instead of empty tag: Is there a way to do this? Just to answer the obvious question, why? We transform XML produced and consumed by a 3rd party application. It turns out this application doesn't like . Thanks, Barrie Kovish From boris at codesynthesis.com Tue May 18 07:03:05 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue May 18 06:53:19 2010 Subject: [xsd-users] start/end tags versus empty tag In-Reply-To: <4C5C799C-B4D9-4DA0-8B49-4588518CABE2@singularsoftware.com> References: <4C5C799C-B4D9-4DA0-8B49-4588518CABE2@singularsoftware.com> Message-ID: Hi Barrie, Barrie Kovish writes: > I'm using XSD tree mapping. I would like to be able to force empty > elements to be written out as start end tags instead of an empty tag, > i.e. start/end tags: > > > > instead of empty tag: > > There is no easy way to get this behavior. One thing that you can do is to add a whitespace as the value of the element: This will work for elements that have complex content and for which mixed is not set to true. For such elements whitespaces are ignored, provided, of course, the other end will ignore them as well. If this approach works for you, the best way to implement it would probably be to serialize the object model to a DOM document, then recursively traverse this document and add a space to every empty element. Once this is done, you can serialize the document to XML. Boris From barrie.kovish at singularsoftware.com Tue May 18 07:43:48 2010 From: barrie.kovish at singularsoftware.com (Barrie Kovish) Date: Tue May 18 07:43:58 2010 Subject: [xsd-users] start/end tags versus empty tag In-Reply-To: References: <4C5C799C-B4D9-4DA0-8B49-4588518CABE2@singularsoftware.com> Message-ID: <3CC1CBEA-5094-4775-B2D2-5A8B3FD3B4D8@singularsoftware.com> Boris, Thanks for the quick response. Unfortunately virtually everything in our xsd is a mixed complex type so presumably your suggestion won't work. I'm thinking I will need to write some custom XML parsing code to deal with this issue. Barrie On 2010-05-18, at 4:03 AM, Boris Kolpackov wrote: > Hi Barrie, > > Barrie Kovish writes: > >> I'm using XSD tree mapping. I would like to be able to force empty >> elements to be written out as start end tags instead of an empty tag, >> i.e. start/end tags: >> >> >> >> instead of empty tag: >> >> > > There is no easy way to get this behavior. One thing that you can > do is to add a whitespace as the value of the element: > > > > This will work for elements that have complex content and for which > mixed is not set to true. For such elements whitespaces are ignored, > provided, of course, the other end will ignore them as well. > > If this approach works for you, the best way to implement it would > probably be to serialize the object model to a DOM document, then > recursively traverse this document and add a space to every empty > element. Once this is done, you can serialize the document to XML. > > Boris From toby.ealden at gmail.com Thu May 20 04:26:27 2010 From: toby.ealden at gmail.com (Toby Ealden) Date: Thu May 20 04:26:54 2010 Subject: [xsd-users] building example code Message-ID: Hi Forgive the basic question, but I'm having problems getting the example code to build. I think I've got it all installed and set up correctly, but I'm a complete novice when it comes to this so can somebody point me in the right direction? This is the error I get when I try to build the xpath sample: eideteal@head:~/xpath-build/xsd/xsd-3.3.0.b1/examples/cxx/tree/xpath> make ../../../../build/bootstrap.make:16: build-0.3/bootstrap.make: No such file or directory make: *** No rule to make target `build-0.3/bootstrap.make'. Stop. Running on SUSE LINUX 10.1 (X86-64) - Kernel \r (\l). 2.6.16.54-0.2.5-smp Thanks in advance Toby From boris at codesynthesis.com Thu May 20 09:58:06 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu May 20 09:48:47 2010 Subject: [xsd-users] building example code In-Reply-To: References: Message-ID: Hi Toby, Toby Ealden writes: > This is the error I get when I try to build the xpath sample: > > eideteal@head:~/xpath-build/xsd/xsd-3.3.0.b1/examples/cxx/tree/xpath> make > ../../../../build/bootstrap.make:16: build-0.3/bootstrap.make: No such file > or directory > make: *** No rule to make target `build-0.3/bootstrap.make'. Stop. You seem to be using the source distribution of the XSD compiler (plus it is an outdated beta). To build the XSD compiler this way you will need to build a substantial list of additional packages. There are, however, easier ways to go about this: 1. Unless you have a good reason to want to build the XSD compiler yourself, I suggest that you get a pre-compiled binary package from the download page: http://www.codesynthesis.com/products/xsd/download.xhtml xsd-3.3.0-x86_64-linux-gnu.tar.bz2 will work for your OS. You can also try the RPM package (xsd-3.3.0-1.x86_64.rpm). Once you unpack this, simply cd to examples/cxx/tree/xpath and run make. Everything should build without problems provided you have Xerces-C++ and XQilla installed. 2. If you do want to build the XSD compiler yourself, the easier way would be to download xsd-3.3.0+dep.tar.bz from here: http://www.codesynthesis.com/download/xsd/3.3/ This package contains the XSD source code bundled with most of its prerequisites. Once unpacked, follow the instructions found in the README file. Note that besides Xerces-C++ you will also need to build the Boost regex and filesystem libraries (this is not necessary for option (1) above). Once the compiler is built, you can cd to xsd/examples/cxx/tree/xpath and run make from there. When asked about using installed XQilla, answer yes. You can also make a package similar to the one used for option (1) with the 'dist' make target (see README for details). Boris From howes at ll.mit.edu Thu May 20 10:30:00 2010 From: howes at ll.mit.edu (Brad Howes) Date: Thu May 20 10:30:11 2010 Subject: [xsd-users] start/end tags versus empty tag In-Reply-To: <4C5C799C-B4D9-4DA0-8B49-4588518CABE2@singularsoftware.com> References: <4C5C799C-B4D9-4DA0-8B49-4588518CABE2@singularsoftware.com> Message-ID: On May 17, 2010, at 7:04 PM, Barrie Kovish wrote: > I'm using XSD tree mapping. I would like to be able to force empty elements to be written out as start end tags instead of an empty tag, i.e. > start/end tags: > > > > instead of empty tag: > > > > Is there a way to do this? Just to answer the obvious question, why? We transform XML produced and consumed by a 3rd party application. It > turns out this application doesn't like . Seems like you could do a pattern match and substitution to achieve this: echo "" | sed -e "s@<\([^/]][^/]*\)/>@<\1>@g" gives I don't think there could be any false matches, but I'm not positive... Brad -- Brad Howes Group 42 MIT Lincoln Laboratory ? 244 Wood St. ? Lexington, MA 02173 Phone: 781.981.5292 ? Fax: 781.981.3495 ? Secretary: 781.981.7420 From barrie.kovish at singularsoftware.com Thu May 20 15:29:03 2010 From: barrie.kovish at singularsoftware.com (Barrie Kovish) Date: Thu May 20 15:29:33 2010 Subject: [xsd-users] Re: start/end tags versus empty tag (Brad Howes) Message-ID: Brad, Thanks for the suggestion. That is almost exactly what I did do. Barrie > On May 17, 2010, at 7:04 PM, Barrie Kovish wrote: > >> I'm using XSD tree mapping. I would like to be able to force empty elements to be written out as start end tags instead of an empty tag, i.e. >> start/end tags: >> >> >> >> instead of empty tag: >> >> >> >> Is there a way to do this? Just to answer the obvious question, why? We transform XML produced and consumed by a 3rd party application. It >> turns out this application doesn't like . > > > Seems like you could do a pattern match and substitution to achieve this: > > echo "" | sed -e "s@<\([^/]][^/]*\)/>@<\1>@g" > > gives > > > > I don't think there could be any false matches, but I'm not positive... > > Brad > > -- > Brad Howes > Group 42 > MIT Lincoln Laboratory ? 244 Wood St. ? Lexington, MA 02173 > Phone: 781.981.5292 ? Fax: 781.981.3495 ? Secretary: 781.981.7420 From eric at boostpro.com Thu May 20 21:04:46 2010 From: eric at boostpro.com (Eric Niebler) Date: Thu May 20 21:04:55 2010 Subject: [xsd-users] xsd exceptions again Message-ID: <4BF5DC2E.7060401@boostpro.com> Hi all, Why don't invalid_utf8_string and invalid_utf16_string inherit from ::xsd::cxx::tree::exception? Or anything? Sadly, we only found this problem after deploying in the field. I've asked before: is there a COMPLETE list of exceptions I need to catch when I call a serialize function? The list seems endless, and I can't find it documented anywhere. Apologies if it is documented and I've overlooked it. I'd like to make a feature request (again): *all* exceptions that propagate out of any xsd function are part of a single documented exception hierarchy, preferably rooted at a standard exception. -- Eric Niebler BoostPro Computing http://www.boostpro.com From boris at codesynthesis.com Fri May 21 11:00:36 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri May 21 10:51:27 2010 Subject: [xsd-users] xsd exceptions again In-Reply-To: <4BF5DC2E.7060401@boostpro.com> References: <4BF5DC2E.7060401@boostpro.com> Message-ID: Hi Eric, Eric Niebler writes: > Why don't invalid_utf8_string and invalid_utf16_string inherit from > ::xsd::cxx::tree::exception? Or anything? Sadly, we only found this > problem after deploying in the field. I've asked before: is there a > COMPLETE list of exceptions I need to catch when I call a serialize > function? The list seems endless, and I can't find it documented > anywhere. I have created a FAQ entry #1.3 that hopefully provides a complete coverage of this topic: http://wiki.codesynthesis.com/Tree/FAQ Let me know if you think I missed anything. > I'd like to make a feature request (again): *all* exceptions that > propagate out of any xsd function are part of a single documented > exception hierarchy, preferably rooted at a standard exception. Yes, this feature is already on the TODO list, along with the interception and translation of the Xerces-C++ exceptions. Boris From eric at boostpro.com Fri May 21 11:25:02 2010 From: eric at boostpro.com (Eric Niebler) Date: Fri May 21 11:25:10 2010 Subject: [xsd-users] xsd exceptions again In-Reply-To: References: <4BF5DC2E.7060401@boostpro.com> Message-ID: <4BF6A5CE.6020407@boostpro.com> On 5/21/2010 8:00 AM, Boris Kolpackov wrote: > Hi Eric, > > Eric Niebler writes: > >> Why don't invalid_utf8_string and invalid_utf16_string inherit from >> ::xsd::cxx::tree::exception? Or anything? Sadly, we only found this >> problem after deploying in the field. I've asked before: is there a >> COMPLETE list of exceptions I need to catch when I call a serialize >> function? The list seems endless, and I can't find it documented >> anywhere. > > I have created a FAQ entry #1.3 that hopefully provides a complete > coverage of this topic: > > http://wiki.codesynthesis.com/Tree/FAQ > > Let me know if you think I missed anything. Yes, this is something like what I was hoping for. Thanks, Boris. >> I'd like to make a feature request (again): *all* exceptions that >> propagate out of any xsd function are part of a single documented >> exception hierarchy, preferably rooted at a standard exception. > > Yes, this feature is already on the TODO list, along with the > interception and translation of the Xerces-C++ exceptions. Excellent. And apologies for the shrill tone of my last email. You're very good about fixing the issues we find, and we appreciate that. -- Eric Niebler BoostPro Computing http://www.boostpro.com From boris at codesynthesis.com Fri May 21 13:33:59 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri May 21 13:24:50 2010 Subject: [xsd-users] xsd exceptions again In-Reply-To: <4BF6A5CE.6020407@boostpro.com> References: <4BF5DC2E.7060401@boostpro.com> <4BF6A5CE.6020407@boostpro.com> Message-ID: Hi Eric, Eric Niebler writes: > And apologies for the shrill tone of my last email. No problem. We definitely dropped the ball here, especially since we planned to fix this for 3.3.0 but ran out of time. Luckily there is a simple (though not very elegant) work-around. Boris From abhijeet.thatte at gmail.com Fri May 21 13:35:53 2010 From: abhijeet.thatte at gmail.com (abhijeet thatte) Date: Fri May 21 17:05:17 2010 Subject: [xsd-users] DataBinding tool compilation on powerpc-QNX platform Message-ID: Hello, I am planning to use data binding tool on powerpc with QNX running on top of it. Can you please provide possible steps to compile it. Thanks, Abhijeet Thatte From boris at codesynthesis.com Fri May 21 17:24:59 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri May 21 17:15:53 2010 Subject: [xsd-users] DataBinding tool compilation on powerpc-QNX platform In-Reply-To: References: Message-ID: Hi Abhijeet, abhijeet thatte writes: > I am planning to use data binding tool on powerpc with QNX running on > top of it. Can you please provide possible steps to compile it. Have you considered using XSD/e which is targeted specifically at mobile and embedded systems and is known to work with QNX? http://www.codesynthesis.com/products/xsde/ While there is no native QNX binary for the XSD/e compiler, you can use it in the cross-compilation setup with either Linux or Windows development platforms. There is also a number of configuration files for various versions of QNX. See the etc/qnx/ directory in the XSD/e distribution. Boris From toby.ealden at gmail.com Mon May 24 06:37:27 2010 From: toby.ealden at gmail.com (Toby Ealden) Date: Mon May 24 06:37:59 2010 Subject: [xsd-users] building example code In-Reply-To: References: Message-ID: Excellent - that did the trick! (I opted for your first suggestion) Thanks Boris, you're a star. On 20 May 2010 14:58, Boris Kolpackov wrote: > Hi Toby, > > Toby Ealden writes: > > > This is the error I get when I try to build the xpath sample: > > > > eideteal@head:~/xpath-build/xsd/xsd-3.3.0.b1/examples/cxx/tree/xpath> > make > > ../../../../build/bootstrap.make:16: build-0.3/bootstrap.make: No such > file > > or directory > > make: *** No rule to make target `build-0.3/bootstrap.make'. Stop. > > You seem to be using the source distribution of the XSD compiler (plus > it is an outdated beta). To build the XSD compiler this way you will > need to build a substantial list of additional packages. There are, > however, easier ways to go about this: > > 1. Unless you have a good reason to want to build the XSD compiler > yourself, I suggest that you get a pre-compiled binary package > from the download page: > > http://www.codesynthesis.com/products/xsd/download.xhtml > > xsd-3.3.0-x86_64-linux-gnu.tar.bz2 will work for your OS. You can > also try the RPM package (xsd-3.3.0-1.x86_64.rpm). > > Once you unpack this, simply cd to examples/cxx/tree/xpath and > run make. Everything should build without problems provided > you have Xerces-C++ and XQilla installed. > > 2. If you do want to build the XSD compiler yourself, the easier > way would be to download xsd-3.3.0+dep.tar.bz from here: > > http://www.codesynthesis.com/download/xsd/3.3/ > > This package contains the XSD source code bundled with most of > its prerequisites. > > Once unpacked, follow the instructions found in the README file. > Note that besides Xerces-C++ you will also need to build the > Boost regex and filesystem libraries (this is not necessary > for option (1) above). Once the compiler is built, you can > cd to xsd/examples/cxx/tree/xpath and run make from there. > When asked about using installed XQilla, answer yes. You can > also make a package similar to the one used for option (1) > with the 'dist' make target (see README for details). > > Boris > From t.j.a.devries at gmail.com Sat May 22 09:06:21 2010 From: t.j.a.devries at gmail.com (Theo de Vries) Date: Mon May 24 09:56:16 2010 Subject: [xsd-users] xsde hello example: undefined references Message-ID: Hello Boris, list-users, I have been using xsde for some time now, with pleasure. For some reason, I get linker errors since recently. It may be due to the fact that I updated my archlinux system, which also implied an update to gcc 4.5.0 and boost 1.41. After that update, I rebuilt and reinstalled xsde as well. It might also be that I make a stupid mistake, for which I apologize in advance. Attached a cmake-based project of the hello example. Included is a FindXSDE.cmake script, inspired by the one on the xsd wiki. Any help is greatly appreciated. I get the following linker errors (a long list, sorry): Linking CXX executable hello /usr/bin/cmake -E cmake_link_script CMakeFiles/hello.dir/link.txt --verbose=1 /usr/bin/c++ -fmessage-length=0 -Wl -lpthread -lxsde CMakeFiles/hello.dir/src/driver.cxx.o CMakeFiles/hello.dir/generated/hello.cxx.o CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o CMakeFiles/hello.dir/generated/hello-pskel.cxx.o -o hello -rdynamic -L/home/vri/prog/xsde/workspace/hello/../lib -L/usr/lib/libxsde/xsde CMakeFiles/hello.dir/src/driver.cxx.o: In function `main': driver.cxx:(.text+0x41): undefined reference to `xsde::cxx::parser::expat::document_pimpl::document_pimpl(xsde::cxx::parser::parser_base&, char const*)' driver.cxx:(.text+0x68): undefined reference to `xsde::cxx::parser::expat::document_pimpl::parse(char const*)' driver.cxx:(.text+0x158): undefined reference to `xsde::cxx::parser::expat::document_pimpl::~document_pimpl()' driver.cxx:(.text+0x18b): undefined reference to `xsde::cxx::parser::expat::document_pimpl::~document_pimpl()' CMakeFiles/hello.dir/src/driver.cxx.o: In function `xsde::cxx::parser::validating::empty_content::~empty_content()': driver.cxx:(.text._ZN4xsde3cxx6parser10validating13empty_contentD2Ev[_ZN4xsde3cxx6parser10validating13empty_contentD5Ev]+0xb): undefined reference to `vtable for xsde::cxx::parser::validating::empty_content' driver.cxx:(.text._ZN4xsde3cxx6parser10validating13empty_contentD2Ev[_ZN4xsde3cxx6parser10validating13empty_contentD5Ev]+0x16): undefined reference to `xsde::cxx::parser::parser_base::~parser_base()' CMakeFiles/hello.dir/src/driver.cxx.o: In function `xsde::cxx::parser::validating::simple_content::~simple_content()': driver.cxx:(.text._ZN4xsde3cxx6parser10validating14simple_contentD2Ev[_ZN4xsde3cxx6parser10validating14simple_contentD5Ev]+0xb): undefined reference to `vtable for xsde::cxx::parser::validating::simple_content' CMakeFiles/hello.dir/src/driver.cxx.o: In function `xsde::cxx::parser::validating::string_pimpl::~string_pimpl()': driver.cxx:(.text._ZN4xsde3cxx6parser10validating12string_pimplD2Ev[_ZN4xsde3cxx6parser10validating12string_pimplD5Ev]+0xc): undefined reference to `vtable for xsde::cxx::parser::validating::string_pimpl' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x10): undefined reference to `xsde::cxx::parser::parser_base::pre()' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x14): undefined reference to `xsde::cxx::parser::parser_base::_pre()' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x18): undefined reference to `xsde::cxx::parser::validating::empty_content::_start_element(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x1c): undefined reference to `xsde::cxx::parser::validating::empty_content::_end_element(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x20): undefined reference to `xsde::cxx::parser::validating::simple_content::_attribute(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x24): undefined reference to `xsde::cxx::parser::validating::simple_content::_characters(xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x28): undefined reference to `xsde::cxx::parser::parser_base::_post()' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x2c): undefined reference to `xsde::cxx::parser::parser_base::_start_any_element(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x30): undefined reference to `xsde::cxx::parser::parser_base::_end_any_element(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x34): undefined reference to `xsde::cxx::parser::parser_base::_any_attribute(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x38): undefined reference to `xsde::cxx::parser::parser_base::_any_characters(xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x3c): undefined reference to `xsde::cxx::parser::validating::simple_content::_pre_impl(xsde::cxx::parser::context&)' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x40): undefined reference to `xsde::cxx::parser::validating::simple_content::_post_impl()' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x44): undefined reference to `xsde::cxx::parser::parser_base::_reset()' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x48): undefined reference to `xsde::cxx::parser::validating::empty_content::_start_element_impl(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x4c): undefined reference to `xsde::cxx::parser::validating::empty_content::_end_element_impl(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x50): undefined reference to `xsde::cxx::parser::validating::simple_content::_attribute_impl(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x54): undefined reference to `xsde::cxx::parser::validating::empty_content::_characters_impl(xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x58): undefined reference to `xsde::cxx::parser::validating::simple_content::_pre_a_validate()' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x5c): undefined reference to `xsde::cxx::parser::validating::simple_content::_post_a_validate()' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x60): undefined reference to `xsde::cxx::parser::validating::simple_content::_attribute_impl_phase_one(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTVN4xsde3cxx6parser10validating12string_pskelE[vtable for xsde::cxx::parser::validating::string_pskel]+0x64): undefined reference to `xsde::cxx::parser::validating::simple_content::_attribute_impl_phase_two(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/src/driver.cxx.o:(.rodata._ZTIN4xsde3cxx6parser10validating12string_pskelE[typeinfo for xsde::cxx::parser::validating::string_pskel]+0x8): undefined reference to `typeinfo for xsde::cxx::parser::validating::simple_content' CMakeFiles/hello.dir/generated/hello.cxx.o: In function `xsde::cxx::string_sequence::~string_sequence()': hello.cxx:(.text._ZN4xsde3cxx15string_sequenceD2Ev[_ZN4xsde3cxx15string_sequenceD5Ev]+0xe): undefined reference to `xsde::cxx::string_sequence::clear()' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o: In function `xsde::cxx::string_sequence::push_back(std::basic_string, std::allocator > const&)': hello-pimpl.cxx:(.text._ZN4xsde3cxx15string_sequence9push_backERKSs[xsde::cxx::string_sequence::push_back(std::basic_string, std::allocator > const&)]+0x23): undefined reference to `xsde::cxx::string_sequence::move_(void*, void*, unsigned int)' hello-pimpl.cxx:(.text._ZN4xsde3cxx15string_sequence9push_backERKSs[xsde::cxx::string_sequence::push_back(std::basic_string, std::allocator > const&)]+0x3b): undefined reference to `xsde::cxx::sequence_base::grow_(unsigned int, unsigned int, void (*)(void*, void*, unsigned int))' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o: In function `xsde::cxx::parser::parser_base::parser_base()': hello-pimpl.cxx:(.text._ZN4xsde3cxx6parser11parser_baseC2Ev[_ZN4xsde3cxx6parser11parser_baseC5Ev]+0xb): undefined reference to `vtable for xsde::cxx::parser::parser_base' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o: In function `xsde::cxx::parser::validating::empty_content::empty_content()': hello-pimpl.cxx:(.text._ZN4xsde3cxx6parser10validating13empty_contentC2Ev[_ZN4xsde3cxx6parser10validating13empty_contentC5Ev]+0x16): undefined reference to `vtable for xsde::cxx::parser::validating::empty_content' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o: In function `xsde::cxx::parser::validating::simple_content::simple_content()': hello-pimpl.cxx:(.text._ZN4xsde3cxx6parser10validating14simple_contentC2Ev[_ZN4xsde3cxx6parser10validating14simple_contentC5Ev]+0x16): undefined reference to `vtable for xsde::cxx::parser::validating::simple_content' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o: In function `xsde::cxx::parser::validating::complex_content::~complex_content()': hello-pimpl.cxx:(.text._ZN4xsde3cxx6parser10validating15complex_contentD2Ev[_ZN4xsde3cxx6parser10validating15complex_contentD5Ev]+0xb): undefined reference to `vtable for xsde::cxx::parser::validating::complex_content' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o: In function `xsde::cxx::parser::validating::string_pimpl::string_pimpl()': hello-pimpl.cxx:(.text._ZN4xsde3cxx6parser10validating12string_pimplC2Ev[_ZN4xsde3cxx6parser10validating12string_pimplC5Ev]+0x17): undefined reference to `vtable for xsde::cxx::parser::validating::string_pimpl' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o:(.rodata._ZTV11hello_pimpl[vtable for hello_pimpl]+0x14): undefined reference to `xsde::cxx::parser::parser_base::_pre()' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o:(.rodata._ZTV11hello_pimpl[vtable for hello_pimpl]+0x18): undefined reference to `xsde::cxx::parser::validating::complex_content::_start_element(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o:(.rodata._ZTV11hello_pimpl[vtable for hello_pimpl]+0x1c): undefined reference to `xsde::cxx::parser::validating::complex_content::_end_element(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o:(.rodata._ZTV11hello_pimpl[vtable for hello_pimpl]+0x20): undefined reference to `xsde::cxx::parser::validating::complex_content::_attribute(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o:(.rodata._ZTV11hello_pimpl[vtable for hello_pimpl]+0x24): undefined reference to `xsde::cxx::parser::validating::complex_content::_characters(xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o:(.rodata._ZTV11hello_pimpl[vtable for hello_pimpl]+0x28): undefined reference to `xsde::cxx::parser::parser_base::_post()' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o:(.rodata._ZTV11hello_pimpl[vtable for hello_pimpl]+0x2c): undefined reference to `xsde::cxx::parser::parser_base::_start_any_element(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o:(.rodata._ZTV11hello_pimpl[vtable for hello_pimpl]+0x30): undefined reference to `xsde::cxx::parser::parser_base::_end_any_element(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o:(.rodata._ZTV11hello_pimpl[vtable for hello_pimpl]+0x34): undefined reference to `xsde::cxx::parser::parser_base::_any_attribute(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o:(.rodata._ZTV11hello_pimpl[vtable for hello_pimpl]+0x38): undefined reference to `xsde::cxx::parser::parser_base::_any_characters(xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o:(.rodata._ZTV11hello_pimpl[vtable for hello_pimpl]+0x3c): undefined reference to `xsde::cxx::parser::validating::complex_content::_pre_impl(xsde::cxx::parser::context&)' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o:(.rodata._ZTV11hello_pimpl[vtable for hello_pimpl]+0x40): undefined reference to `xsde::cxx::parser::validating::complex_content::_post_impl()' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o:(.rodata._ZTV11hello_pimpl[vtable for hello_pimpl]+0x50): undefined reference to `xsde::cxx::parser::validating::complex_content::_attribute_impl(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o:(.rodata._ZTV11hello_pimpl[vtable for hello_pimpl]+0x54): undefined reference to `xsde::cxx::parser::validating::empty_content::_characters_impl(xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o:(.rodata._ZTV11hello_pimpl[vtable for hello_pimpl]+0x60): undefined reference to `xsde::cxx::parser::validating::complex_content::_pre_a_validate()' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o:(.rodata._ZTV11hello_pimpl[vtable for hello_pimpl]+0x64): undefined reference to `xsde::cxx::parser::validating::complex_content::_post_a_validate()' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o:(.rodata._ZTV11hello_pimpl[vtable for hello_pimpl]+0x68): undefined reference to `xsde::cxx::parser::validating::complex_content::_attribute_impl_phase_one(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pimpl.cxx.o:(.rodata._ZTV11hello_pimpl[vtable for hello_pimpl]+0x6c): undefined reference to `xsde::cxx::parser::validating::complex_content::_attribute_impl_phase_two(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o: In function `hello_pskel::_reset()': hello-pskel.cxx:(.text+0x172): undefined reference to `xsde::cxx::parser::validating::complex_content::_reset()' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o: In function `hello_pskel::_start_element_impl(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)': hello-pskel.cxx:(.text+0x249): undefined reference to `xsde::cxx::parser::validating::empty_content::_start_element_impl(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o: In function `hello_pskel::_end_element_impl(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)': hello-pskel.cxx:(.text+0x4e3): undefined reference to `xsde::cxx::parser::validating::empty_content::_end_element_impl(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o: In function `xsde::cxx::stack::push()': hello-pskel.cxx:(.text._ZN4xsde3cxx5stack4pushEv[xsde::cxx::stack::push()]+0x1d): undefined reference to `xsde::cxx::stack::grow()' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o: In function `xsde::cxx::parser::parser_base::parser_base(xsde::cxx::parser::parser_base*, void*)': hello-pskel.cxx:(.text._ZN4xsde3cxx6parser11parser_baseC2EPS2_Pv[_ZN4xsde3cxx6parser11parser_baseC5EPS2_Pv]+0xb): undefined reference to `vtable for xsde::cxx::parser::parser_base' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o: In function `xsde::cxx::parser::validating::empty_content::empty_content(xsde::cxx::parser::validating::empty_content*, void*)': hello-pskel.cxx:(.text._ZN4xsde3cxx6parser10validating13empty_contentC2EPS3_Pv[_ZN4xsde3cxx6parser10validating13empty_contentC5EPS3_Pv]+0x25): undefined reference to `vtable for xsde::cxx::parser::validating::empty_content' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o: In function `xsde::cxx::parser::validating::complex_content::complex_content()': hello-pskel.cxx:(.text._ZN4xsde3cxx6parser10validating15complex_contentC2Ev[_ZN4xsde3cxx6parser10validating15complex_contentC5Ev]+0x16): undefined reference to `vtable for xsde::cxx::parser::validating::complex_content' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o: In function `xsde::cxx::parser::validating::complex_content::complex_content(xsde::cxx::parser::validating::complex_content*, void*)': hello-pskel.cxx:(.text._ZN4xsde3cxx6parser10validating15complex_contentC2EPS3_Pv[_ZN4xsde3cxx6parser10validating15complex_contentC5EPS3_Pv]+0x25): undefined reference to `vtable for xsde::cxx::parser::validating::complex_content' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTV11hello_pskel[vtable for hello_pskel]+0x10): undefined reference to `xsde::cxx::parser::parser_base::pre()' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTV11hello_pskel[vtable for hello_pskel]+0x14): undefined reference to `xsde::cxx::parser::parser_base::_pre()' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTV11hello_pskel[vtable for hello_pskel]+0x18): undefined reference to `xsde::cxx::parser::validating::complex_content::_start_element(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTV11hello_pskel[vtable for hello_pskel]+0x1c): undefined reference to `xsde::cxx::parser::validating::complex_content::_end_element(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTV11hello_pskel[vtable for hello_pskel]+0x20): undefined reference to `xsde::cxx::parser::validating::complex_content::_attribute(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTV11hello_pskel[vtable for hello_pskel]+0x24): undefined reference to `xsde::cxx::parser::validating::complex_content::_characters(xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTV11hello_pskel[vtable for hello_pskel]+0x28): undefined reference to `xsde::cxx::parser::parser_base::_post()' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTV11hello_pskel[vtable for hello_pskel]+0x2c): undefined reference to `xsde::cxx::parser::parser_base::_start_any_element(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTV11hello_pskel[vtable for hello_pskel]+0x30): undefined reference to `xsde::cxx::parser::parser_base::_end_any_element(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTV11hello_pskel[vtable for hello_pskel]+0x34): undefined reference to `xsde::cxx::parser::parser_base::_any_attribute(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTV11hello_pskel[vtable for hello_pskel]+0x38): undefined reference to `xsde::cxx::parser::parser_base::_any_characters(xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTV11hello_pskel[vtable for hello_pskel]+0x3c): undefined reference to `xsde::cxx::parser::validating::complex_content::_pre_impl(xsde::cxx::parser::context&)' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTV11hello_pskel[vtable for hello_pskel]+0x40): undefined reference to `xsde::cxx::parser::validating::complex_content::_post_impl()' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTV11hello_pskel[vtable for hello_pskel]+0x50): undefined reference to `xsde::cxx::parser::validating::complex_content::_attribute_impl(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTV11hello_pskel[vtable for hello_pskel]+0x54): undefined reference to `xsde::cxx::parser::validating::empty_content::_characters_impl(xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTV11hello_pskel[vtable for hello_pskel]+0x60): undefined reference to `xsde::cxx::parser::validating::complex_content::_pre_a_validate()' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTV11hello_pskel[vtable for hello_pskel]+0x64): undefined reference to `xsde::cxx::parser::validating::complex_content::_post_a_validate()' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTV11hello_pskel[vtable for hello_pskel]+0x68): undefined reference to `xsde::cxx::parser::validating::complex_content::_attribute_impl_phase_one(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTV11hello_pskel[vtable for hello_pskel]+0x6c): undefined reference to `xsde::cxx::parser::validating::complex_content::_attribute_impl_phase_two(xsde::cxx::ro_string const&, xsde::cxx::ro_string const&, xsde::cxx::ro_string const&)' CMakeFiles/hello.dir/generated/hello-pskel.cxx.o:(.rodata._ZTI11hello_pskel[typeinfo for hello_pskel]+0x8): undefined reference to `typeinfo for xsde::cxx::parser::validating::complex_content' collect2: ld returned 1 exit status make[2]: *** [hello] Error 1 make[1]: *** [CMakeFiles/hello.dir/all] Error 2 make: *** [all] Error 2 make[2]: Leaving directory `/home/vri/prog/xsde/build/hello/qtcreator-build' make[1]: Leaving directory `/home/vri/prog/xsde/build/hello/qtcreator-build' Exited with code 2. Error while building project hello When executing build step 'Make' -------------- next part -------------- A non-text attachment was scrubbed... Name: helloworkspace.tar.gz Type: application/x-gzip Size: 9240 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20100522/c4591caa/helloworkspace.tar-0001.bin From erik.sjolund at gmail.com Tue May 25 08:07:21 2010 From: erik.sjolund at gmail.com (=?ISO-8859-1?Q?Erik_Sj=F6lund?=) Date: Tue May 25 08:07:29 2010 Subject: [xsd-users] streaming example: memory consumption increases over time Message-ID: I tried making very big ( 250 Mb ) version of examples/cxx/tree/streaming/position.xml I then ran ./driver position.xml 2> /dev/null and saw that the memory consumption of the "driver" process increases over time. Maybe there is some deallocation missing? cheers, Erik Sj?lund From boris at codesynthesis.com Tue May 25 09:15:04 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue May 25 09:06:46 2010 Subject: [xsd-users] Re: cxx-tree Hello example execution problem on AIX 5.3 using XL C++ v7 In-Reply-To: <001201cafb38$c6e24b60$54a6e220$@com> References: <001201cafb38$c6e24b60$54a6e220$@com> Message-ID: Hi, In the future please send technical questions like these to the xsd-users mailing list (which I've CC'ed) instead of to me directly. This way other developers who may have experienced a similar problem can provide you with a solution. Plus questions and answers will be archived and available to others with similar problems. Also see the posting guidelines for more information: http://www.codesynthesis.com/support/posting-guidelines.xhtml tjpark@ubivelox.com writes: > Dear Boris. > > I always appreciate your good binding tool. > > I downloaded code_synthesis_xsd on your web-site and used on HPUX(aCC) > very well. > > It is a great tool for me to bind xml file. > > But, It doesn't work on AIX (XLC v7). - I downloaded xsd-3.3.0-powerpc-aix. > tar.gz on your web site. - > > So, Could you kindly help for below issue? > > > I tried with : > > xsd cxx-tree hello.xsd > > xlC_r -+ -o hello.o -c hello.cxx -I$(HOME)/lib/xsd-3.3.0-powerpc-aix/libxsd > -I$(HOME)/lib/xerces-c/include > > xlC_r -+ -o driver.o -c driver.cxx -I$(HOME)/lib/xsd-3.3.0-powerpc- > aix/libxsd -I$(HOME)/lib/xerces-c/include > > xlC_r -o driver.a driver.o hello.o -L$(HOME)/lib/xerces-c/lib -lxerces-c > > - Location : $(HOME)/lib/xsd-3.3.0-powerpc-aix/examples/cxx/tree/hello > > It is compiled with no error. > > But, When I execute the binary file (driver.a), it failed with segmentation > fault(coredump). > > Is there anything wrong with the compile step? > > Is there any other process that I should do? We have tested XSD with IBM XL C++ 7.0 and everything worked fine. Can you try to build the examples using the supplied Makefile by running: $ gmake clean $ gmake test In the above directory? If the example built this way works fine, then you may want to check the make output for the xlC compiler options that we use to build the example. In particular, I see that we pass -qrtti which is absent from your command lines. Boris From boris at codesynthesis.com Tue May 25 11:01:34 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue May 25 10:53:20 2010 Subject: [xsd-users] streaming example: memory consumption increases over time In-Reply-To: References: Message-ID: Hi Erik, Erik Sj?lund writes: > I tried making very big ( 250 Mb ) version of > > examples/cxx/tree/streaming/position.xml > > I then ran > ./driver position.xml 2> /dev/null > > and saw that the memory consumption of the "driver" process increases > over time. > > Maybe there is some deallocation missing? This has to do with the way XML Schema validation is implemented in Xerces-C++. If you disable validation (pass false as the last argument to start() on line 63), then the memory used by the application stays constant. Some more background on the validation case: in Xerces-C++ the parser and validator are separate entities (there are actually two validator implementations: DTD and XML Schema). The parser collects information describing the document fragment and then, at certain points, calls the validator to validate the part of the document. Relevant to our case is the information describing the content model. In this case the parser creates a list of the nested elements seen and then passes this list to the validator when it sees the closing tag of the outer element. If an XML document contains a large sequence of elements, this list can grow pretty large. And that's exactly what happens in our case. Now the XML presented in the streaming example is quite extreme in that there are a lot of position elements with very little data. For example, I have created a 400Mb document and it needed 10M position elements to get to this size. Most real-world documents will have fewer elements and more data. On my 64-bit GNU/Linux box to parse this 400Mb document the example used about 80Mb of extra memory. This translates to about 8 bytes per element which is about right, since the element list mentioned above contains an index to the element pool and on 64-bit machines the index uses 8 bytes. There are also a number of ways this memory usage can be reduced. Something that we may do for the next release of Xerces-C++. Boris From erik.sjolund at gmail.com Tue May 25 10:59:14 2010 From: erik.sjolund at gmail.com (=?ISO-8859-1?Q?Erik_Sj=F6lund?=) Date: Tue May 25 10:59:18 2010 Subject: [xsd-users] streaming example: memory consumption increases over time In-Reply-To: References: Message-ID: Thanks, for the explanation! cheers, Erik From erik.sjolund at gmail.com Tue May 25 11:20:19 2010 From: erik.sjolund at gmail.com (=?ISO-8859-1?Q?Erik_Sj=F6lund?=) Date: Tue May 25 11:20:22 2010 Subject: [xsd-users] documentation typo bug fix Message-ID: I found a typo in the documentation: preset() should be present() cheers, Erik Sj?lund -------------- next part -------------- A non-text attachment was scrubbed... Name: fix_preset.patch Type: text/x-diff Size: 760 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20100525/a1c8cbef/fix_preset.bin From eric at boostpro.com Wed May 26 10:41:43 2010 From: eric at boostpro.com (Eric Niebler) Date: Wed May 26 10:41:50 2010 Subject: [xsd-users] relative paths and path lengths Message-ID: <4BFD3327.2040602@boostpro.com> Hi Boris, We recently ran into an interesting problem with the xsd compiler. It seems that when resolving relative paths in include and import directives, it keeps concatenating them. Given a rich enough set of schemata scattered around a deep directory hierarchy, this ginormous relative path exceeds some internal maxpath, causing relative paths to fail to resolve correctly. We end up with something like this: 1>xsd .\ZAViewFramework.xsd 1>..\..\..\Common\Views\ZAViewFramework\..\..\Framework\ZAFC\..\..\Math\Framework\ResultBroker\..\..\..\Math\Framework\CalUtil\..\..\..\Utility\ZAUtil\ZAAuxil.xsd:6:57: error: '../ZAAuxil/ZAAuxil.xsd' is not a valid filesystem path 1>..\..\..\Common\Views\ZAViewFramework\ZAViewFramework.xsd:196:72: error: unable to resolve namespace 'http://www.zephyrassociates.com/Zephyr/TeDevelopersKit/Schema' 1>Project : error PRJ0019: A tool returned an error code from "xsd .\ZAViewFramework.xsd" It complains that ../ZAAuxil/ZAAuxil.xsd is not a valid filesystem path, but it certainly is, and the file exists. We only discovered this problem when a new guy came on board and checked our project out into a directory that was already deeply nested. It builds for everyone but him. When he uses the 'subst' command to map his deeply nested directory to a drive letter, it works for him, too. Any help? FYI, we're using XSD 3.2.0. TIA, -- Eric Niebler BoostPro Computing http://www.boostpro.com From boris at codesynthesis.com Wed May 26 11:18:44 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed May 26 11:10:38 2010 Subject: [xsd-users] documentation typo bug fix In-Reply-To: References: Message-ID: Hi Erik, Erik Sj?lund writes: > I found a typo in the documentation: > > preset() > > should be > > present() Fixed, thanks. Boris From boris at codesynthesis.com Thu May 27 11:55:18 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu May 27 11:47:24 2010 Subject: [xsd-users] relative paths and path lengths In-Reply-To: <4BFD3327.2040602@boostpro.com> References: <4BFD3327.2040602@boostpro.com> Message-ID: Hi Eric, Eric Niebler writes: > We recently ran into an interesting problem with the xsd compiler. It > seems that when resolving relative paths in include and import > directives, it keeps concatenating them. Given a rich enough set of > schemata scattered around a deep directory hierarchy, this ginormous > relative path exceeds some internal maxpath, causing relative paths to > fail to resolve correctly. I checked and the oldish boost-filesystem version (1.33.1) that we use to build binaries uses MAX_PATH as a limit in its implementation of system_complete(). It also seems that newer versions of Boost have this function reimplemented without this limit. I built an XSD 3.2.0 binary using the latest version of Boost (1.43.0). Can you give it a try and see it helps: http://www.codesynthesis.com/~boris/tmp/xsd-3.2.0-i686-windows-boost-1.43.0.zip Boris From Alexey.Glotov at samtec.de Thu May 27 11:24:37 2010 From: Alexey.Glotov at samtec.de (Alexey Glotov) Date: Thu May 27 11:50:54 2010 Subject: [xsd-users] keep sequence order in C++ while using xs:choice in XSD Message-ID: <6073A4082F6CC548B21CB5D385F37B07A2971D@exchangeserver.samtec.de> Hello, i am using CodeSynthesis XSD 3.2 (3.3). I need to read xml file, which contains repeating sequence of elements. For example: If I am using a "xs:choice" to cover repeating elements (value and text), than the sequence order is lost in C++ instance. I have tried to create an abstract layer between root element and repeating elements to be able to use "xs:sequence" to keep an order of elements in C++ like this Unfortunately validation fails. Is this problem solvable? Regards, Alexey Glotov From boris at codesynthesis.com Thu May 27 12:01:57 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu May 27 11:54:03 2010 Subject: [xsd-users] keep sequence order in C++ while using xs:choice in XSD In-Reply-To: <6073A4082F6CC548B21CB5D385F37B07A2971D@exchangeserver.samtec.de> References: <6073A4082F6CC548B21CB5D385F37B07A2971D@exchangeserver.samtec.de> Message-ID: Hi Alexey, Alexey Glotov writes: > If I am using a "xs:choice" to cover repeating elements (value and > text), than the sequence order is lost in C++ instance. Please see the following post for an exhaustive list of options on how to deal with this situation: http://www.codesynthesis.com/pipermail/xsd-users/2010-March/002741.html Boris From dawhite32 at gmail.com Sun May 30 10:41:25 2010 From: dawhite32 at gmail.com (David White) Date: Mon May 31 07:10:13 2010 Subject: [xsd-users] cxx-parser: run time difficulties with KML21.xsd Message-ID: <4C027915.8030705@gmail.com> Hi all, As the subject suggests, I am having some difficulty with basic run-time usage of cxx-parser generated code and KML and would greatly value your suggestions as to where I am going wrong. I downloaded the kml 2.1 schema from here: http://code.google.com/apis/kml/schema/kml21.xsd Using cxx-parser, I ran: xsd cxx-parser --generate-print-impl --force-overwrite --generate-test-driver --generate-polymorphic --root-element kml --namespace-map http://earth.google.com/kml/2.1=kml kml21.xsd All generated c++ files compiled without errors. However, when I run any KML file (using the generated kml21-driver.cxx), I get error: Unknown element 'kml' I note that kml files have for the (root) kml element the following: [sample.kml] ... ... I have read different threads on similar problems (e.g. http://www.codesynthesis.com/pipermail/xsd-users/2007-June/001018.html) and note that this error is raised when the parser does not have or know the full path to the schema. My preference is to not disable the underlying parser, and so I added the following: kml21.xsd is in the same directory as sample.kml. But this didn't seem to work (I am not an XML expert). I added xml_schema::flags::dont_validate to the parse function call, however I got the following error: expected element 'http://earth.google.com/kml/2.1#kml' instead of 'kml' Any ideas where I am going wrong? Please forgive me if the error is blatantly obvious. OS: FC12, gcc. XSD: 3.2.0 Thanks in advance, David. From boris at codesynthesis.com Mon May 31 09:03:36 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon May 31 08:56:30 2010 Subject: [xsd-users] cxx-parser: run time difficulties with KML21.xsd In-Reply-To: <4C027915.8030705@gmail.com> References: <4C027915.8030705@gmail.com> Message-ID: Hi David, David White writes: > I note that kml files have for the (root) kml element the following: > > [sample.kml] > > The kml21.xsd schema from Google website has the following target namespace: targetNamespace="http://earth.google.com/kml/2.1" While your document uses "http://www.opengis.net/kml/2.1" as the XML vocabulary namespace. These two will need to be the same. As a side note, the KML schema uses polymorphism and you are using the --generate-print-impl option to generate the sample parser implementations. These implementations are not polymorphism-aware and will only print the data that is in the base type. For more information on how to handle polymorphic XML vocabularies with the C++/Parser mapping, see Section 5.4, "Support for Polymorphism" in the C++/Parser Mapping Getting Started Guide; http://www.codesynthesis.com/projects/xsd/documentation/cxx/parser/guide/#5.4 Boris