From boris at codesynthesis.com Tue Feb 2 04:14:40 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Feb 2 04:14:43 2010 Subject: [xsd-users] problem with xsd/tree and tag In-Reply-To: <4C076189EC0147C88DB0B812EF773B17@Portableben> References: <4C076189EC0147C88DB0B812EF773B17@Portableben> Message-ID: Hi Benjamin, Benjamin Guillemot writes: > I think you don't implement the option < fixed > of the tag fractionDigits. According to the XML Schema spec, the fractionDigits facet specifies the maximum number of fraction digits, not the exact number (i.e., 1, 1.1, 1.11 are all valid values for fractionDigits=2). The fixed=true attribute only specifies that the value of this facet cannot be changed in further derivation by restribtion. So I believe the current implementation is correct. > If I have 1.00 as value i have 1 in my xml file but I want 1.00. (My client > need this). > > Do you think you'll deliver a patch or is there a way to do this properly? Take a look at the 'double' example in the examples/cxx/tree/custom/ directory of XSD distribution. It describes a number of way to achieve what you want. Boris From boris at codesynthesis.com Tue Feb 2 07:19:32 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Feb 2 07:19:37 2010 Subject: [xsd-users] Xerces-C++ 3.1.0 released Message-ID: Hi, Xerces-C++ 3.1.0 was released yesterday. This version contains a number of new features, performance improvements and a large number of bug fixes, especially in the XML Schema spec conformance area, including: * Support for handling multiple XML Schema import declarations with the same target namespace. * Support for configuration of the parser buffer low water mark. * DOMLSParser::parseWithContext implementation. * Improved XML Schema performance and reduced memory footprint when validating with large maxOccurs values. If available, the SSE2 instructions are used to further speedup this case. * Improved scalability of the XML Schema identity checking (key, keyref, and unique). * More robust external library detection (libcurl and ICU). * Compilation of the ICU message loader resources no longer depends on the ICU implementation details. For a more detailed list of changes see the official announcement: http://marc.info/?l=xerces-c-dev&m=126502748921483&w=2 I have also written a blog post that describes some of the new features in greater detail: http://www.codesynthesis.com/~boris/blog/2010/02/02/xerces-cxx-3-1-0-released This release has been tested on all major platforms and comes with precompiled libraries (total 16) for various CPU architectures, operating systems, and C++ compilers. You can download them along with the source distributions from the Xerces-C++ Download page: http://xerces.apache.org/xerces-c/download.cgi The Xerces-C++ 3.1.0 release has also been successfully tested with XSD 3.2.0. Enjoy, Boris From benjamin.guillemot at free.fr Tue Feb 2 07:32:33 2010 From: benjamin.guillemot at free.fr (benjamin.guillemot@free.fr) Date: Tue Feb 2 07:32:44 2010 Subject: [xsd-users] problem with xsd/tree and tag In-Reply-To: References: <4C076189EC0147C88DB0B812EF773B17@Portableben> Message-ID: <1265113953.4b681b61aadfa@imp.free.fr> Hi, ok you're right, i'll check the custom type. thank you. Selon Boris Kolpackov : > Hi Benjamin, > > Benjamin Guillemot writes: > > > I think you don't implement the option < fixed > of the tag fractionDigits. > > According to the XML Schema spec, the fractionDigits facet specifies > the maximum number of fraction digits, not the exact number (i.e., 1, > 1.1, 1.11 are all valid values for fractionDigits=2). The fixed=true > attribute only specifies that the value of this facet cannot be changed > in further derivation by restribtion. So I believe the current > implementation is correct. > > > > If I have 1.00 as value i have 1 in my xml file but I want 1.00. (My client > > need this). > > > > Do you think you'll deliver a patch or is there a way to do this properly? > > Take a look at the 'double' example in the examples/cxx/tree/custom/ > directory of XSD distribution. It describes a number of way to achieve > what you want. > > Boris > From howes at ll.mit.edu Tue Feb 2 14:09:58 2010 From: howes at ll.mit.edu (Brad Howes) Date: Tue Feb 2 15:02:40 2010 Subject: [xsd-users] GML Processing Message-ID: <1116B71F-B6A8-48DB-8CE2-06E85F6A37C9@ll.mit.edu> All, First, a big thanks to the to Code Synthesis for their great tool, xsd. I'm working on an FAA project looking into next-generation controller displays and xsd has proved to be an incredibly useful tool for adapting a C++ program written for another project so that it can read and write XML messages from/to Apache's ActiveMQ messaging service. The project is using GML as a container and type foundation for its XML schemas, and getting the stock 3.1.1 to build properly with xsd was a major hurdle to overcome. Following the posts from Boris and others, I have a well-commented CMakeLists.txt file that generates a dynamic library of the GML C++ classes. I have attached it for posterity and to help others out who may have to solve the same problem I did. Also attached is a FindXSD.cmake file that follows the conventions of other CMake packages to properly setup some CMake variables when working with xsd. Of course, all of this only works when using CMake. Regards, 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: FindXSD.cmake Type: application/octet-stream Size: 2865 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20100202/a497c544/FindXSD.obj -------------- next part -------------- # -*- Mode: CMake -*- # # CMake build file for the OpenGIS GML 3.1.1 schemas. # # # Add directories to use for finding C++ include files # INCLUDE_DIRECTORIES( ${XSD_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) # # Point to the OpenGIS GML schema directory -- files are in subdirectories # (base, smil, etc.) # SET( GML_DIR "${OGC_BINDINGS_DIR}/schemas/net/opengis/gml/3.1.1" ) # # Set common XSD options # SET( XSD_OPTS --generate-polymorphic --generate-serialization --generate-inline --root-element-none --disable-warning F001 --disable-warning B002 # # Flatten the generated GML directory includes so that everything # is found in this directory. NOTE: could cause problems if names # collide, but so far so good... # --include-regex "'@.*/xlinks[.](.+)@xlinks.$$1'@" --include-regex "'@.*/smil20[.](.+)@smil20.$$1'@" --namespace-map ${GMLNS} ) # # Build the SMIL schema files. Due to a circular-dependency in the schema # definitions, we use the --file-per-type XSD option to generate files for each # type found in the schema files. # FILE( GLOB FILES ${GML_DIR}/smil/*.xsd ) IF( NOT FILES ) MESSAGE( FATAL "No SMIL schema files to process" ) ENDIF( NOT FILES ) FOREACH( FILE ${FILES} ) XSD_SCHEMA( GML_SCHEMA_SRCS ${FILE} ${XSD_OPTS} --file-per-type ) ENDFOREACH( FILE ) # # The following is a list of C++ source files generated by the XSD command # using the --file-per-type option. If we were working in a temporary # directory, we could use the FILE( GLOB ... ) CMake command to identify the # generated files... # SET( SMIL_CXX accumulate.cxx additive.cxx animateColorPrototype.cxx animateColorType.cxx animateMotionPrototype.cxx animateMotionType.cxx animatePrototype.cxx animateType.cxx attributeType.cxx calcMode.cxx fillDefaultType.cxx fillTimingAttrsType.cxx nonNegativeDecimalType.cxx restartDefaultType.cxx restartTimingType.cxx setPrototype.cxx setType.cxx space.cxx syncBehaviorDefaultType.cxx syncBehaviorType.cxx ) # # Generate list of header and inline include files from the list of source # files. # STRING( REPLACE "cxx" "hxx" SMIL_HXX ${SMIL_CXX} ) STRING( REPLACE "cxx" "ixx" SMIL_IXX ${SMIL_CXX} ) # # Tell CMake that these are generated files, and that to clean this build # directory, it must remove all of them. # SET( SMIL_FILES ${SMIL_CXX} ${SMIL_HXX} ${SMIL_IXX} ) SET_SOURCE_FILES_PROPERTIES( ${SMIL_FILES} PROPERTIES GENERATED TRUE ) SET_DIRECTORY_PROPERTIES( PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${SMIL_FILES}" ) # # Make the SMIL C++ files part of the GML library build # LIST( APPEND GML_SCHEMA_SRCS ${SMIL_CXX} ) # # Obtain the list of schema files for XLINK package, generate C++ files for # them, and build. FILE( GLOB FILES ${OGC_BINDINGS_DIR}/schemas/net/opengis/xlink/1.0.0/*.xsd ) IF( NOT FILES ) MESSAGE( FATAL "No XLINK schema files to process" ) ENDIF( NOT FILES ) FOREACH( FILE ${FILES} ) XSD_SCHEMA( GML_SCHEMA_SRCS ${FILE} ${XSD_OPTS} ) ENDFOREACH( FILE ) # # Obtain the list of schema files for GML base directory, generate C++ files # for them, and build. # FILE( GLOB FILES ${GML_DIR}/base/*.xsd ) IF( NOT FILES ) MESSAGE( FATAL "No GML schema files to process" ) ENDIF( NOT FILES ) FOREACH( FILE ${FILES} ) XSD_SCHEMA( GML_SCHEMA_SRCS ${FILE} ${XSD_OPTS} ) ENDFOREACH( FILE ) # # Generate the libGML shared library # ADD_LIBRARY( GML SHARED ${GML_SCHEMA_SRCS} ) # # Add the Xerces C libraries to the link stage # TARGET_LINK_LIBRARIES( GML ${XERCESC_LIBRARIES} ) # # Set the installation location for the GML library. Install also performs a # link edit with the installation location for the RPATH. # INSTALL( TARGETS GML LIBRARY DESTINATION lib ) From boris at codesynthesis.com Wed Feb 3 08:24:48 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Feb 3 08:25:07 2010 Subject: [xsd-users] GML Processing In-Reply-To: <1116B71F-B6A8-48DB-8CE2-06E85F6A37C9@ll.mit.edu> References: <1116B71F-B6A8-48DB-8CE2-06E85F6A37C9@ll.mit.edu> Message-ID: Hi Brad, Brad Howes writes: > First, a big thanks to the to Code Synthesis for their great tool, > xsd. I'm working on an FAA project looking into next-generation > controller displays and xsd has proved to be an incredibly useful > tool for adapting a C++ program written for another project so that > it can read and write XML messages from/to Apache's ActiveMQ messaging > service. Thanks for the kind words. I am glad you find the compiler useful. > Following the posts from Boris and others, I have a well-commented > CMakeLists.txt file that generates a dynamic library of the GML C++ > classes. I have attached it for posterity and to help others out who > may have to solve the same problem I did. Also attached is a > FindXSD.cmake file that follows the conventions of other CMake > packages to properly setup some CMake variables when working with xsd. > Of course, all of this only works when using CMake. Thanks for sharing this. I have uploaded both of these files to the wiki and setup the "Using XSD with CMake" page based on your comments: http://wiki.codesynthesis.com/Using_XSD_with_CMake I have also added a note to the GML schema page: http://wiki.codesynthesis.com/Schemas/GML Boris From howard.kidd at bt.com Tue Feb 9 04:16:19 2010 From: howard.kidd at bt.com (howard.kidd@bt.com) Date: Tue Feb 9 04:34:30 2010 Subject: [xsd-users] XML C++ Data Binding Message-ID: <1BC51B1F07F6BA49BB6154E06849EAE30835C3C9@E03MVZ2-UKDY.domain1.systemhost.net> I have recently been evaluating your cxx-parser and cxx-tree implementations I have everything working with the cxx-tree generated code however am I correct in thinking that the cxx-parser generated code does not support serialization ? From boris at codesynthesis.com Tue Feb 9 04:41:28 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Feb 9 04:40:47 2010 Subject: [xsd-users] XML C++ Data Binding In-Reply-To: <1BC51B1F07F6BA49BB6154E06849EAE30835C3C9@E03MVZ2-UKDY.domain1.systemhost.net> References: <1BC51B1F07F6BA49BB6154E06849EAE30835C3C9@E03MVZ2-UKDY.domain1.systemhost.net> Message-ID: Hi Howard, howard.kidd@bt.com writes: > I have everything working with the cxx-tree generated code however > am I correct in thinking that the cxx-parser generated code does not > support serialization ? That's correct, C++/Parser only supports parsing. If you are looking for a similar mapping (i.e., event-driven, object model-less) for XML serialization, take a look at C++/Serializer[1] in XSD/e[2]. While it was designed primarily for mobile/embedded systems, if configured to use STL, etc., it can also be used in general-purpose applications. [1] http://www.codesynthesis.com/products/xsde/c++/serializer/ [2] http://www.codesynthesis.com/products/xsde/ Boris From smithatwork65 at gmail.com Tue Feb 9 08:40:18 2010 From: smithatwork65 at gmail.com (Michael Smith) Date: Tue Feb 9 10:52:28 2010 Subject: [xsd-users] S2S protocol with XSD. Message-ID: <934266f71002090540i57ac297agb4d87c539b7e6bf7@mail.gmail.com> Hello, I'm trying to generate a parser for Gaming Standards Association's S2S protocol (the schemas can be downloaded at http://gamingstandards.com/index.php?page=standards/free_downloads_standards). I've encountered the following problems. I wonder if they are problems with XSD or S2S schemas. Any help would be appreciated. xsd cxx-tree --namespace-map ' http://www.gamingstandards.com/s2s/schemas/v1.2.6/'='s2s' --root-element s2sMessage s2sMessage.xsd s2sFillCreditExt1.xsd:13:80: error: type ' http://www.gamingstandards.com/s2s/schemas/v1.2.6/:fillCreditInfo' not found s2sFillCreditExt1.xsd:13:80: error: referenced element 's2s:fillCreditInfo' not found s2sHandpayExt1.xsd:20:52: error: attributeGroup ' http://www.gamingstandards.com/s2s/schemas/v1.2.6/:requestParameters' not found s2sHandpayExt1.xsd:30:52: error: attributeGroup ' http://www.gamingstandards.com/s2s/schemas/v1.2.6/:requestParameters' not found s2sJackpotExt1.xsd:13:77: error: type ' http://www.gamingstandards.com/s2s/schemas/v1.2.6/:jackpotInfo' not found s2sJackpotExt1.xsd:13:77: error: referenced element 's2s:jackpotInfo' not found s2sMarkerExt1.xsd:13:76: error: type ' http://www.gamingstandards.com/s2s/schemas/v1.2.6/:markerInfo' not found s2sMarkerExt1.xsd:13:76: error: referenced element 's2s:markerInfo' not found s2sMarkerExt1.xsd:25:77: error: type ' http://www.gamingstandards.com/s2s/schemas/v1.2.6/:voucherInfo' not found s2sMarkerExt1.xsd:25:77: error: referenced element 's2s:voucherInfo' not found s2sMarkerExt1.xsd:37:78: error: type ' http://www.gamingstandards.com/s2s/schemas/v1.2.6/:transferInfo' not found s2sMarkerExt1.xsd:37:78: error: referenced element 's2s:transferInfo' not found s2sMeterExt1.xsd:17:75: error: type ' http://www.gamingstandards.com/s2s/schemas/v1.2.6/:s2sMeterType' not found s2sMeterExt1.xsd:17:75: error: simpleType ' http://www.gamingstandards.com/s2s/schemas/v1.2.6/:s2sMeterType' for attribute 'meterType' not found s2sOpenCloseExt1.xsd:13:75: error: type ' http://www.gamingstandards.com/s2s/schemas/v1.2.6/:tableInfo' not found s2sOpenCloseExt1.xsd:13:75: error: referenced element 's2s:tableInfo' not found s2sRatingExt1.xsd:29:76: error: type ' http://www.gamingstandards.com/s2s/schemas/v1.2.6/:ratingInfo' not found s2sRatingExt1.xsd:29:76: error: referenced element 's2s:ratingInfo' not found From sutambe at dre.vanderbilt.edu Tue Feb 9 11:34:50 2010 From: sutambe at dre.vanderbilt.edu (Sumant Tambe) Date: Tue Feb 9 11:34:55 2010 Subject: [xsd-users] XML C++ Data Binding In-Reply-To: References: <1BC51B1F07F6BA49BB6154E06849EAE30835C3C9@E03MVZ2-UKDY.domain1.systemhost.net> Message-ID: <4B718EAA.1000906@dre.vanderbilt.edu> Hi Boris, > was designed primarily for mobile/embedded systems, if configured to > use STL, etc., it can also be used in general-purpose applications. Is it possible to configure cxx-tree to use STL containers instead of xsd::cxx::tree::sequence? If yes, how? Thanks, Sumant. From boris at codesynthesis.com Tue Feb 9 15:36:16 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Feb 9 15:35:38 2010 Subject: [xsd-users] S2S protocol with XSD. In-Reply-To: <934266f71002090540i57ac297agb4d87c539b7e6bf7@mail.gmail.com> References: <934266f71002090540i57ac297agb4d87c539b7e6bf7@mail.gmail.com> Message-ID: Hi Michael, Michael Smith writes: > I've encountered the following problems. I wonder if they are problems with > XSD or S2S schemas. S2S schemas rely on the so-called multi-import technique where the same namespace is imported via different schema files. The XML Schema spec says that conforming processors are free to ignore any subsequent imports or they can try to process subsequent imports and accumulate the grammar. For more background on this issue see this blog post: http://codesynthesis.com/~boris/blog/2010/02/02/xerces-cxx-3-1-0-released/ XSD 3.2.0 uses the "ignore" approach. For the upcoming XSD 3.3.0 we have implemented the "accumulate" approach. The first beta for XSD 3.3.0 will be released tomorrow. I have tried it on the S2S schemas (v1.3.1) and was able to get past these errors (with 3.2.0 I got errors similar to yours) but there are still a few issues that need to be worked out (automatic anonymous type naming leads to unstable conflicts). I will work some more on this schema tomorrow after the beta is released and will send more information then. Boris From boris at codesynthesis.com Tue Feb 9 15:48:05 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Feb 9 15:47:29 2010 Subject: [xsd-users] XML C++ Data Binding In-Reply-To: <4B718EAA.1000906@dre.vanderbilt.edu> References: <1BC51B1F07F6BA49BB6154E06849EAE30835C3C9@E03MVZ2-UKDY.domain1.systemhost.net> <4B718EAA.1000906@dre.vanderbilt.edu> Message-ID: Hi Sumant, Sumant Tambe writes: > Is it possible to configure cxx-tree to use STL containers instead of > xsd::cxx::tree::sequence? No, this is not possible. STL containers store elements by value which would be too inefficient for C++/Tree. Instead, the tree::sequence container (which, BTW, conforms fully to the STL sequence interface and therefore can be used anywhere std::vector can) stores simple types by value and more complex -- as pointers to dynamically-allocated objects. The iterator provided by tree::sequence hides all this and allows you to access all the objects uniformly as references (i.e., when you have *i, you get T& regardless of whether T is simple or complex). The simple type specialization of tree::sequence simply derives from std::vector. The complex type specialization uses std::vector in its implementation. Boris From boris at codesynthesis.com Wed Feb 10 03:26:41 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Feb 10 03:25:53 2010 Subject: [xsd-users] XSD 3.3.0 beta1 released Message-ID: Hi, We have released the first and hopefully the only beta for XSD 3.3.0. The final release is planned for the middle of March. Besides the new major features described below, this release includes a large number of small improvements, bug fixes, and optimizations. In particular, the compiler is now much faster, especially on large and complex schemas, and generates smaller and simpler code. The NEWS file entries for 3.3.0.b1 are as follows: * New option, --char-encoding, allows to specify the character encoding that should be used in the generated code. Valid values for the 'char' character type are 'utf8' (default), 'iso8859-1' (new), 'lcp' (Xerces-C++ local code page), and 'custom' (provides support for custom encodings). Note that if you use a non-default character encoding and include some libxsd headers (e.g., xsd/cxx/xml/string.hxx) directly, then you will need to fist include the correct xsd/cxx/xml/char-.hxx header, where is iso8859-1, lcp, etc. This mechanism replaces the XSD_USE_LCP macro. For the wchar_t character type the only valid value for this option is 'auto' and the encoding is automatically selected between UTF-16 and UTF-32, depending on the wchar_t type size. * When the XSD compiler is built with Xerces-C++ 3.1.0 or later, the handling of multiple imports for the same namespace is enabled. Before, all subsequent imports for a namespace were ignored which caused errors in some schemas. Note that if your application has XML Schema validation enabled, then you will also need to build it with Xerces-C++ 3.1.0 or later to take advantage of this feature. * Automatic mapping for the urn-style XML namespaces. The last component in the urn name is used to derive the C++ namespace name. * Warning id's have changed to start with a letter identifying the component issuing the warning. F - compiler frontend, D - compiler driver, P - C++/Parser mapping, T - C++/Tree mapping. * Strings used to match regular expressions supplied with the --namespace-regex and --anonymous-regex options now include the file component for the schema being compiled. C++/Tree * New option, --generate-element-type, triggers the generation of types instead of parsing/serialization functions for root elements. This is primarily useful to distinguish object models with the same root type but with different root elements. For more information, refer to the messaging example and Section 2.9.1, "Element Types" in the C++/Tree Mapping User Manual. To support the customization of the element type naming the --element-type-regex option has been added. See the NAMING CONVENTION section in the compiler command line manual (man pages) for details. * New option, --generate-element-map, triggers the generation of a root element map. The element map allows uniform parsing and serialization of multiple root elements. This option can only be used together with --generate-element-type. For more information, refer to the messaging example and Section 2.9.2, "Element Map" in the C++/Tree Mapping User Manual. * Prior to this version, if the --generate-polymorphic option is specified the compiler treats all types as potentially polymorphic. Now by default only type hierarchies used in substitution groups and those explicitly declared polymorphic with the new --polymorphic-type option are treated as polymorphic. This results in smaller and faster generated code. If you would like to continue using the old behavior, you will need to specify --polymorphic-type-all. For more information, on this change see Section 2.11, "Mapping for xsi:type and Substitution Groups" in the C++/Tree Mapping User Manual. * New option, --generate-detach, triggers the generation of detach functions for required elements and attributes. For optional and sequence cardinalities the detach functions are now provided by the respective containers even without this option. These functions, for example, allow one to move sub-trees in the object model either within the same tree or between different trees without copying. For more information, refer to Section 2.8 "Mapping for Local Elements and Attributes" in the C++/Tree Mapping User Manual. * New option, --export-xml-schema, causes the compiler to export/import types in the XML Schema namespace using the export symbol provided with the --export-symbol option. * New example, embedded, shows how to embed the binary representation of the schema grammar into an application and then use it to parse and validate XML documents. * New example, compression, shows how to compress an XML document during serialization and decompress it during parsing using the zlib library. * New example, custom/mixed, shows how to use type customization to parse and serialize mixed content. * The streaming example has been extended to show how to perform stream- oriented, partially in-memory XML processing using the C++/Tree mapping. With the partially in-memory parsing and serialization only a part of the object model is in memory at any given time. With this approach one can process parts of the document as they become available as well as handle documents that are too large to fit into memory. * New default/fixed value initialization code. Now the default/fixed values are parsed by the XSD compiler at compile time instead of the standard parsing code at runtime. This will allow the compilation of schemas that use the default/fixed values without support for XML parsing (--suppress-parsing option). * Empty XML Schema enumeration values are now mapped to the 'empty' C++ enumerator name instead of 'cxx'. This release has been tested with the recently published Xerces-C++ 3.1.0 and all the precompiled binary distributions have been built with this version. The only known issue with this release and Xerces-C++ 3.1.0 is a bug in the DOM importing code in Xerces-C++ that manifests itself in the custom/mixed example mentioned above. This bug will be fixed in the Xerces-C++ 3.1.1 bugfix release and a patch is available for 3.1.0: http://www.codesynthesis.com/~boris/tmp/xerces-c-3.1.0-dom-import.patch Precompiled binary distributions for 3.3.0.b1 are available from the product's download page. Let me know if you need a binary for any other platform: http://www.codesynthesis.com/products/xsd/download.xhtml Source code for this release is available from the project's web page: http://www.codesynthesis.com/projects/xsd/ SHA1 checksums for the files: e2ece57780b575dd28832f2e70dd14a98f0dd9e7 xsd-3.3.0.b1.tar.bz2 064279491ed6e5c49660c21a0c38d735c7d19cdf xsd-3.3.0.b1+dep.tar.bz2 69726a0a10618b07982ed26f3517d9cb66a8939d xsd-3.3.0.b1-i686-windows.zip 0b1cbbe106da3b089c164bb28055d615b1490481 xsd-3.3.0.b1-i686-linux-gnu.tar.bz2 a09f3a71dffed9b890932ef429bebd44cee354b9 xsd-3.3.0.b1-x86_64-linux-gnu.tar.bz2 4645d909c3c6f1fcf3bef629767e4d2aa5dbb7b3 xsd-3.3.0.b1-i686-macosx.tar.bz2 0084352a1d7191ecae0ef10375c5a38c46c76c50 xsd-3.3.0.b1-sparc-solaris.tar.gz Enjoy, Boris From boris at codesynthesis.com Wed Feb 10 12:20:31 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Feb 10 12:19:41 2010 Subject: [xsd-users] S2S protocol with XSD. In-Reply-To: References: <934266f71002090540i57ac297agb4d87c539b7e6bf7@mail.gmail.com> Message-ID: Hi Michael, Boris Kolpackov writes: > I will work some more on this schema tomorrow after the beta is > released and will send more information then. I finally got around to compiling this schema. Similar to the other standard by this association (G2S), the schema files in S2S do cyclic inclusion/importing which makes it impossible to generate compilable C++ code in the default file-per-schema mode (i.e., where a set of C++ source files is generated for each schema file). So we have to use the file-per-type mode to with this schema. For some background on this mode see this blog post: http://codesynthesis.com/~boris/blog/2008/02/13/codesynthesis-xsd-3-1-0-released/ I have create a small test driver for S2S which also includes Makefile (I assume you are on Linux/UNIX; otherwise the README file provides the XSD compiler command lines for manually compiling the S2S schema): http://www.codesynthesis.com/~boris/tmp/s2s-1.3.1.tar.gz I couldn't find any sample S2S documents so I created a simple XML file (ack.xml) which can be used to test the result. To successfully build the test driver you will need XSD 3.3.0.b1 and Xerces-C++ 3.1.0 (or later). Let me know how it goes. Boris From barrie.kovish at singularsoftware.com Wed Feb 10 19:22:56 2010 From: barrie.kovish at singularsoftware.com (Barrie Kovish) Date: Wed Feb 10 19:23:26 2010 Subject: [xsd-users] Preserving XML element order Message-ID: <02AEE30D-03FC-4BA0-AE3D-82A9F2D740E9@singularsoftware.com> I had a look at the archive but couldn't find a definitive answer to this question. I am reading an XML file in and writing it out using classes generated by XSD. In general I need to make a few simple modifications to the XML file. But even if I don't modify the XML file the order of the elements is not preserved. i.e. if the XSD classes read in ... 1 2 The XSD classes might write out ... 2 1 This is a big problem for me because the program which uses these XML files is sensitive to the order of the elements. Note that the schema does note impose an order on the elements and the program which generates the XML files does not order the elements in a specific way. However it is important for a specific document that the order not change. In addition to using the XSD classes to serialize out the XML I tried using the Xerces XML parser. However it appears that changes I make via the XSD classes do not get propagated to the Xerces DOM. Is there a solution to this? Thanks, Barrie From bidski at bigpond.net.au Thu Feb 11 04:45:42 2010 From: bidski at bigpond.net.au (Bidski) Date: Thu Feb 11 04:51:55 2010 Subject: [xsd-users] VStudio 2010 Message-ID: <4EE69948F9854A04A00C8E64989A6BA0@Panda> Hello all, Is there a version of xsd that is compatible with Visual Studio 2010 Beta 2 and Windows 7 32- and 64- bit? I have attempted to use it but all i have gotten is about 50 unresolved externals. I have added the include directory to my projects "Include Directories" and the lib directory to my projects "Library Directories" but beyond that im not sure what else to do. Here is a list of the unresolved externals if that helps anyone Error 54 error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl xercesc_3_0::XMLPlatformUtils::Initialize(char const * const,char const * const,class xercesc_3_0::PanicHandler * const,class xercesc_3_0::MemoryManager * const)" (__imp_?Initialize@XMLPlatformUtils@xercesc_3_0@@SAXQBD0QAVPanicHandler@2@QAVMemoryManager@2@@Z) referenced in function "void __cdecl xsd::cxx::xml::initialize(void)" (?initialize@xml@cxx@xsd@@YAXXZ) Inventory.obj Error 55 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static char const * const xercesc_3_0::XMLUni::fgXercescDefaultLocale" (__imp_?fgXercescDefaultLocale@XMLUni@xercesc_3_0@@2QBDB) Inventory.obj Error 56 error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl xercesc_3_0::XMLPlatformUtils::Terminate(void)" (__imp_?Terminate@XMLPlatformUtils@xercesc_3_0@@SAXXZ) referenced in function "void __cdecl xsd::cxx::xml::terminate(void)" (?terminate@xml@cxx@xsd@@YAXXZ) Inventory.obj Error 57 error LNK2019: unresolved external symbol "__declspec(dllimport) protected: __thiscall xercesc_3_0::InputSource::InputSource(class xercesc_3_0::MemoryManager * const)" (__imp_??0InputSource@xercesc_3_0@@IAE@QAVMemoryManager@1@@Z) referenced in function "public: __thiscall xsd::cxx::xml::sax::std_input_source::std_input_source(class std::basic_istream > &)" (??0std_input_source@sax@xml@cxx@xsd@@QAE@AAV?$basic_istream@DU?$char_traits@D@std@@@std@@@Z) Inventory.obj Error 58 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class xercesc_3_0::MemoryManager * xercesc_3_0::XMLPlatformUtils::fgMemoryManager" (__imp_?fgMemoryManager@XMLPlatformUtils@xercesc_3_0@@2PAVMemoryManager@2@A) Inventory.obj Error 59 error LNK2001: unresolved external symbol "public: virtual wchar_t const * __thiscall xercesc_3_0::InputSource::getEncoding(void)const " (?getEncoding@InputSource@xercesc_3_0@@UBEPB_WXZ) Inventory.obj Error 60 error LNK2001: unresolved external symbol "public: virtual wchar_t const * __thiscall xercesc_3_0::InputSource::getPublicId(void)const " (?getPublicId@InputSource@xercesc_3_0@@UBEPB_WXZ) Inventory.obj Error 61 error LNK2001: unresolved external symbol "public: virtual wchar_t const * __thiscall xercesc_3_0::InputSource::getSystemId(void)const " (?getSystemId@InputSource@xercesc_3_0@@UBEPB_WXZ) Inventory.obj Error 62 error LNK2001: unresolved external symbol "public: virtual bool __thiscall xercesc_3_0::InputSource::getIssueFatalErrorIfNotFound(void)const " (?getIssueFatalErrorIfNotFound@InputSource@xercesc_3_0@@UBE_NXZ) Inventory.obj Error 63 error LNK2001: unresolved external symbol "public: virtual void __thiscall xercesc_3_0::InputSource::setEncoding(wchar_t const * const)" (?setEncoding@InputSource@xercesc_3_0@@UAEXQB_W@Z) Inventory.obj Error 64 error LNK2001: unresolved external symbol "public: virtual void __thiscall xercesc_3_0::InputSource::setPublicId(wchar_t const * const)" (?setPublicId@InputSource@xercesc_3_0@@UAEXQB_W@Z) Inventory.obj Error 65 error LNK2001: unresolved external symbol "public: virtual void __thiscall xercesc_3_0::InputSource::setSystemId(wchar_t const * const)" (?setSystemId@InputSource@xercesc_3_0@@UAEXQB_W@Z) Inventory.obj Error 66 error LNK2001: unresolved external symbol "public: virtual void __thiscall xercesc_3_0::InputSource::setIssueFatalErrorIfNotFound(bool)" (?setIssueFatalErrorIfNotFound@InputSource@xercesc_3_0@@UAEX_N@Z) Inventory.obj Error 67 error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl xercesc_3_0::XMemory::operator delete(void *)" (__imp_??3XMemory@xercesc_3_0@@SAXPAX@Z) referenced in function __unwindfunclet$?makeStream@std_input_source@sax@xml@cxx@xsd@@UBEPAVBinInputStream@xercesc_3_0@@XZ$0 Inventory.obj Error 68 error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void * __cdecl xercesc_3_0::XMemory::operator new(unsigned int)" (__imp_??2XMemory@xercesc_3_0@@SAPAXI@Z) referenced in function "public: virtual class xercesc_3_0::BinInputStream * __thiscall xsd::cxx::xml::sax::std_input_source::makeStream(void)const " (?makeStream@std_input_source@sax@xml@cxx@xsd@@UBEPAVBinInputStream@xercesc_3_0@@XZ) Inventory.obj Error 69 error LNK2019: unresolved external symbol "__declspec(dllimport) protected: __thiscall xercesc_3_0::BinInputStream::BinInputStream(void)" (__imp_??0BinInputStream@xercesc_3_0@@IAE@XZ) referenced in function "public: __thiscall xsd::cxx::xml::sax::std_input_stream::std_input_stream(class std::basic_istream > &)" (??0std_input_stream@sax@xml@cxx@xsd@@QAE@AAV?$basic_istream@DU?$char_traits@D@std@@@std@@@Z) Inventory.obj Error 70 error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall xercesc_3_0::BinInputStream::~BinInputStream(void)" (__imp_??1BinInputStream@xercesc_3_0@@UAE@XZ) referenced in function "public: virtual __thiscall xsd::cxx::xml::sax::std_input_stream::~std_input_stream(void)" (??1std_input_stream@sax@xml@cxx@xsd@@UAE@XZ) Inventory.obj Error 71 error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall xercesc_3_0::InputSource::~InputSource(void)" (__imp_??1InputSource@xercesc_3_0@@UAE@XZ) referenced in function "public: virtual __thiscall xsd::cxx::xml::sax::std_input_source::~std_input_source(void)" (??1std_input_source@sax@xml@cxx@xsd@@UAE@XZ) Inventory.obj Error 72 error LNK2019: unresolved external symbol "__declspec(dllimport) protected: __thiscall xercesc_3_0::XMLFormatTarget::XMLFormatTarget(void)" (__imp_??0XMLFormatTarget@xercesc_3_0@@IAE@XZ) referenced in function "public: __thiscall xsd::cxx::xml::dom::ostream_format_target::ostream_format_target(class std::basic_ostream > &)" (??0ostream_format_target@dom@xml@cxx@xsd@@QAE@AAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z) Inventory.obj Error 73 error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall xercesc_3_0::XMLFormatTarget::~XMLFormatTarget(void)" (__imp_??1XMLFormatTarget@xercesc_3_0@@UAE@XZ) referenced in function "public: virtual __thiscall xsd::cxx::xml::dom::ostream_format_target::~ostream_format_target(void)" (??1ostream_format_target@dom@xml@cxx@xsd@@UAE@XZ) Inventory.obj Error 74 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_0::SchemaSymbols::fgXSI_NONAMESPACESCHEMALOCACTION" (__imp_?fgXSI_NONAMESPACESCHEMALOCACTION@SchemaSymbols@xercesc_3_0@@2QB_WB) Inventory.obj Error 75 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_0::SchemaSymbols::fgXSI_SCHEMALOCACTION" (__imp_?fgXSI_SCHEMALOCACTION@SchemaSymbols@xercesc_3_0@@2QB_WB) Inventory.obj Error 76 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_0::SchemaSymbols::fgURI_XSI" (__imp_?fgURI_XSI@SchemaSymbols@xercesc_3_0@@2QB_WB) Inventory.obj Error 77 error LNK2019: unresolved external symbol "__declspec(dllimport) public: static bool __cdecl xercesc_3_0::XMLString::equals(wchar_t const *,wchar_t const *)" (__imp_?equals@XMLString@xercesc_3_0@@SA_NPB_W0@Z) referenced in function "void __cdecl xsd::cxx::xml::dom::clear(class xercesc_3_0::DOMElement &)" (??$clear@D@dom@xml@cxx@xsd@@YAXAAVDOMElement@xercesc_3_0@@@Z) Inventory.obj Error 78 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_0::XMLUni::fgXMLNSURIName" (__imp_?fgXMLNSURIName@XMLUni@xercesc_3_0@@2QB_WB) Inventory.obj Error 79 error LNK2019: unresolved external symbol "__declspec(dllimport) public: static unsigned long __cdecl xercesc_3_0::XMLString::stringLen(wchar_t const * const)" (__imp_?stringLen@XMLString@xercesc_3_0@@SAKQB_W@Z) referenced in function "class std::basic_string,class std::allocator > __cdecl xsd::cxx::xml::transcode(wchar_t const *)" (??$transcode@D@xml@cxx@xsd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PB_W@Z) Inventory.obj Error 80 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_0::XMLUni::fgDOMErrorHandler" (__imp_?fgDOMErrorHandler@XMLUni@xercesc_3_0@@2QB_WB) Inventory.obj Error 81 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_0::XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation" (__imp_?fgXercesSchemaExternalNoNameSpaceSchemaLocation@XMLUni@xercesc_3_0@@2QB_WB) Inventory.obj Error 82 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_0::XMLUni::fgXercesSchemaExternalSchemaLocation" (__imp_?fgXercesSchemaExternalSchemaLocation@XMLUni@xercesc_3_0@@2QB_WB) Inventory.obj Error 83 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_0::XMLUni::fgXercesUserAdoptsDOMDocument" (__imp_?fgXercesUserAdoptsDOMDocument@XMLUni@xercesc_3_0@@2QB_WB) Inventory.obj Error 84 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_0::XMLUni::fgXercesSchemaFullChecking" (__imp_?fgXercesSchemaFullChecking@XMLUni@xercesc_3_0@@2QB_WB) Inventory.obj Error 85 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_0::XMLUni::fgXercesSchema" (__imp_?fgXercesSchema@XMLUni@xercesc_3_0@@2QB_WB) Inventory.obj Error 86 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_0::XMLUni::fgDOMValidate" (__imp_?fgDOMValidate@XMLUni@xercesc_3_0@@2QB_WB) Inventory.obj Error 87 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_0::XMLUni::fgDOMElementContentWhitespace" (__imp_?fgDOMElementContentWhitespace@XMLUni@xercesc_3_0@@2QB_WB) Inventory.obj Error 88 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_0::XMLUni::fgDOMNamespaces" (__imp_?fgDOMNamespaces@XMLUni@xercesc_3_0@@2QB_WB) Inventory.obj Error 89 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_0::XMLUni::fgDOMEntities" (__imp_?fgDOMEntities@XMLUni@xercesc_3_0@@2QB_WB) Inventory.obj Error 90 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_0::XMLUni::fgDOMDatatypeNormalization" (__imp_?fgDOMDatatypeNormalization@XMLUni@xercesc_3_0@@2QB_WB) Inventory.obj Error 91 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_0::XMLUni::fgDOMComments" (__imp_?fgDOMComments@XMLUni@xercesc_3_0@@2QB_WB) Inventory.obj Error 92 error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class xercesc_3_0::DOMImplementation * __cdecl xercesc_3_0::DOMImplementationRegistry::getDOMImplementation(wchar_t const *)" (__imp_?getDOMImplementation@DOMImplementationRegistry@xercesc_3_0@@SAPAVDOMImplementation@2@PB_W@Z) referenced in function "struct xsd::cxx::xml::dom::auto_ptr __cdecl xsd::cxx::xml::dom::parse(class std::basic_string,class std::allocator > const &,class xercesc_3_0::DOMErrorHandler &,class xsd::cxx::xml::properties const &,unsigned long)" (??$parse@D@dom@xml@cxx@xsd@@YA?AU?$auto_ptr@VDOMDocument@xercesc_3_0@@@0123@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAVDOMErrorHandler@xercesc_3_0@@ABV?$properties@D@123@K@Z) Inventory.obj Error 93 error LNK2019: unresolved external symbol "__declspec(dllimport) protected: __thiscall xercesc_3_0::InputSource::InputSource(wchar_t const * const,class xercesc_3_0::MemoryManager * const)" (__imp_??0InputSource@xercesc_3_0@@IAE@QB_WQAVMemoryManager@1@@Z) referenced in function "public: __thiscall xsd::cxx::xml::sax::std_input_source::std_input_source(class std::basic_istream > &,class std::basic_string,class std::allocator > const &)" (??$?0D@std_input_source@sax@xml@cxx@xsd@@QAE@AAV?$basic_istream@DU?$char_traits@D@std@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@6@@Z) Inventory.obj Error 94 error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall xercesc_3_0::Wrapper4InputSource::~Wrapper4InputSource(void)" (__imp_??1Wrapper4InputSource@xercesc_3_0@@UAE@XZ) referenced in function "struct xsd::cxx::xml::dom::auto_ptr __cdecl xsd::cxx::xml::dom::parse(class xercesc_3_0::InputSource &,class xercesc_3_0::DOMErrorHandler &,class xsd::cxx::xml::properties const &,unsigned long)" (??$parse@D@dom@xml@cxx@xsd@@YA?AU?$auto_ptr@VDOMDocument@xercesc_3_0@@@0123@AAVInputSource@xercesc_3_0@@AAVDOMErrorHandler@6@ABV?$properties@D@123@K@Z) Inventory.obj Error 95 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall xercesc_3_0::Wrapper4InputSource::Wrapper4InputSource(class xercesc_3_0::InputSource * const,bool,class xercesc_3_0::MemoryManager * const)" (__imp_??0Wrapper4InputSource@xercesc_3_0@@QAE@QAVInputSource@1@_NQAVMemoryManager@1@@Z) referenced in function "struct xsd::cxx::xml::dom::auto_ptr __cdecl xsd::cxx::xml::dom::parse(class xercesc_3_0::InputSource &,class xercesc_3_0::DOMErrorHandler &,class xsd::cxx::xml::properties const &,unsigned long)" (??$parse@D@dom@xml@cxx@xsd@@YA?AU?$auto_ptr@VDOMDocument@xercesc_3_0@@@0123@AAVInputSource@xercesc_3_0@@AAVDOMErrorHandler@6@ABV?$properties@D@123@K@Z) Inventory.obj Error 96 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_0::XMLUni::fgDOMXMLDeclaration" (__imp_?fgDOMXMLDeclaration@XMLUni@xercesc_3_0@@2QB_WB) Inventory.obj Error 97 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_0::XMLUni::fgDOMWRTFormatPrettyPrint" (__imp_?fgDOMWRTFormatPrettyPrint@XMLUni@xercesc_3_0@@2QB_WB) Inventory.obj Error 98 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static wchar_t const * const xercesc_3_0::XMLUni::fgDOMWRTDiscardDefaultContent" (__imp_?fgDOMWRTDiscardDefaultContent@XMLUni@xercesc_3_0@@2QB_WB) Inventory.obj Error 99 error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall xercesc_3_0::DOMErrorHandler::~DOMErrorHandler(void)" (__imp_??1DOMErrorHandler@xercesc_3_0@@UAE@XZ) referenced in function "public: virtual __thiscall xsd::cxx::xml::dom::bits::error_handler_proxy::~error_handler_proxy(void)" (??1?$error_handler_proxy@D@bits@dom@xml@cxx@xsd@@UAE@XZ) Inventory.obj Error 100 error LNK2019: unresolved external symbol "__declspec(dllimport) protected: __thiscall xercesc_3_0::DOMErrorHandler::DOMErrorHandler(void)" (__imp_??0DOMErrorHandler@xercesc_3_0@@IAE@XZ) referenced in function "public: __thiscall xsd::cxx::xml::dom::bits::error_handler_proxy::error_handler_proxy(class xsd::cxx::xml::error_handler &)" (??0?$error_handler_proxy@D@bits@dom@xml@cxx@xsd@@QAE@AAV?$error_handler@D@345@@Z) Inventory.obj Thank all for your help Bidski From boris at codesynthesis.com Thu Feb 11 04:59:15 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Feb 11 04:58:29 2010 Subject: [xsd-users] VStudio 2010 In-Reply-To: <4EE69948F9854A04A00C8E64989A6BA0@Panda> References: <4EE69948F9854A04A00C8E64989A6BA0@Panda> Message-ID: Bidski writes: > I have attempted to use it but all i have gotten is about 50 unresolved > externals. I have added the include directory to my projects "Include > Directories" and the lib directory to my projects "Library Directories" > but beyond that im not sure what else to do. All the unresolved symbols are from the Xerces-C++ library. Are you linking it to your project? To check, go to "Project Properties"-> "Linker"->"Input" and in the "Additional Dependencies" field you should have xerces-c_3D.lib for Debug and xerces-c_3.lib for Release. Boris From boris at codesynthesis.com Thu Feb 11 07:12:31 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Feb 11 07:11:35 2010 Subject: [xsd-users] Preserving XML element order In-Reply-To: <02AEE30D-03FC-4BA0-AE3D-82A9F2D740E9@singularsoftware.com> References: <02AEE30D-03FC-4BA0-AE3D-82A9F2D740E9@singularsoftware.com> Message-ID: Hi Barrie, Barrie Kovish writes: > I am reading an XML file in and writing it out using classes generated > by XSD. In general I need to make a few simple modifications to the XML > file. But even if I don't modify the XML file the order of the elements > is not preserved. i.e. if the XSD classes read in > ... > 1 > 2 > > The XSD classes might write out > ... > 2 > 1 There are certain XML Schema use-cases where this can happen due to the flattening of the compositor structure in the C++/Tree mapping. For previous discussions of this issue see: http://www.codesynthesis.com/pipermail/xsd-users/2008-May/001697.html http://www.codesynthesis.com/pipermail/xsd-users/2008-June/001739.html > This is a big problem for me because the program which uses these XML > files is sensitive to the order of the elements. Note that the schema > does note impose an order on the elements and the program which > generates the XML files does not order the elements in a specific way. > However it is important for a specific document that the order not > change. Can you show the relevant schema fragments? > Is there a solution to this? There are several ways in which this can be worked around. But I will need to see the schema to be able to make a suggestion. There is also the C++/Hybrid[1] mapping in XSD/e[2] which recreates the compositor structure precisely and preserves the element order in all cases. While XSD/e was designed primarily for mobile/embedded systems, if configured to use STL, etc., it can also be used in general-purpose applications. [1] http://www.codesynthesis.com/products/xsde/c++/hybrid/ [2] http://www.codesynthesis.com/products/xsde/ Boris From barrie.kovish at singularsoftware.com Thu Feb 11 08:14:28 2010 From: barrie.kovish at singularsoftware.com (Barrie Kovish) Date: Thu Feb 11 08:15:02 2010 Subject: [xsd-users] Preserving XML element order In-Reply-To: References: <02AEE30D-03FC-4BA0-AE3D-82A9F2D740E9@singularsoftware.com> Message-ID: Hi Boris, Thanks very much for your quick reply. Here is a sample schema fragment. I have changed the element names to be something generic: I would say that 90% of the schema is structure like this. There are probably 50-100 choice elements in the schema and another 100-200 string and integer elements. thanks, Barrie On 2010-02-11, at 4:12 AM, Boris Kolpackov wrote: > Hi Barrie, > > Barrie Kovish writes: > >> I am reading an XML file in and writing it out using classes generated >> by XSD. In general I need to make a few simple modifications to the XML >> file. But even if I don't modify the XML file the order of the elements >> is not preserved. i.e. if the XSD classes read in >> ... >> 1 >> 2 >> >> The XSD classes might write out >> ... >> 2 >> 1 > > There are certain XML Schema use-cases where this can happen due to the > flattening of the compositor structure in the C++/Tree mapping. For > previous discussions of this issue see: > > http://www.codesynthesis.com/pipermail/xsd-users/2008-May/001697.html > http://www.codesynthesis.com/pipermail/xsd-users/2008-June/001739.html > > >> This is a big problem for me because the program which uses these XML >> files is sensitive to the order of the elements. Note that the schema >> does note impose an order on the elements and the program which >> generates the XML files does not order the elements in a specific way. >> However it is important for a specific document that the order not >> change. > > Can you show the relevant schema fragments? > > >> Is there a solution to this? > > There are several ways in which this can be worked around. But I will > need to see the schema to be able to make a suggestion. > > There is also the C++/Hybrid[1] mapping in XSD/e[2] which recreates the > compositor structure precisely and preserves the element order in all > cases. While XSD/e was designed primarily for mobile/embedded systems, > if configured to use STL, etc., it can also be used in general-purpose > applications. > > [1] http://www.codesynthesis.com/products/xsde/c++/hybrid/ > [2] http://www.codesynthesis.com/products/xsde/ > > Boris From barrie.kovish at singularsoftware.com Thu Feb 11 11:01:03 2010 From: barrie.kovish at singularsoftware.com (Barrie Kovish) Date: Thu Feb 11 11:01:34 2010 Subject: [xsd-users] Preserving XML element order In-Reply-To: References: <02AEE30D-03FC-4BA0-AE3D-82A9F2D740E9@singularsoftware.com> Message-ID: Boris, There is probably another aspect of the schema I should mention. The various element types are shared. By this I mean the following: So elements named A are shared between elements named X and W. This sort of thing is used a lot in this schema. Barrie On 2010-02-11, at 4:12 AM, Boris Kolpackov wrote: > Hi Barrie, > > Barrie Kovish writes: > >> I am reading an XML file in and writing it out using classes generated >> by XSD. In general I need to make a few simple modifications to the XML >> file. But even if I don't modify the XML file the order of the elements >> is not preserved. i.e. if the XSD classes read in >> ... >> 1 >> 2 >> >> The XSD classes might write out >> ... >> 2 >> 1 > > There are certain XML Schema use-cases where this can happen due to the > flattening of the compositor structure in the C++/Tree mapping. For > previous discussions of this issue see: > > http://www.codesynthesis.com/pipermail/xsd-users/2008-May/001697.html > http://www.codesynthesis.com/pipermail/xsd-users/2008-June/001739.html > > >> This is a big problem for me because the program which uses these XML >> files is sensitive to the order of the elements. Note that the schema >> does note impose an order on the elements and the program which >> generates the XML files does not order the elements in a specific way. >> However it is important for a specific document that the order not >> change. > > Can you show the relevant schema fragments? > > >> Is there a solution to this? > > There are several ways in which this can be worked around. But I will > need to see the schema to be able to make a suggestion. > > There is also the C++/Hybrid[1] mapping in XSD/e[2] which recreates the > compositor structure precisely and preserves the element order in all > cases. While XSD/e was designed primarily for mobile/embedded systems, > if configured to use STL, etc., it can also be used in general-purpose > applications. > > [1] http://www.codesynthesis.com/products/xsde/c++/hybrid/ > [2] http://www.codesynthesis.com/products/xsde/ > > Boris From boris at codesynthesis.com Thu Feb 11 14:11:43 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Feb 11 14:10:53 2010 Subject: [xsd-users] Preserving XML element order In-Reply-To: References: <02AEE30D-03FC-4BA0-AE3D-82A9F2D740E9@singularsoftware.com> Message-ID: Hi Barrie, Barrie Kovish writes: > > > > > > > > > > > > > > > > > > > > > > I would say that 90% of the schema is structure like this. There > are probably 50-100 choice elements in the schema and another 100-200 > string and integer elements. Barrie Kovish writes: > There is probably another aspect of the schema I should mention. The > various element types are shared. By this I mean the following: > > > > > > > > > > > > > > > > > > > > > > So elements named A are shared between elements named X and W. In such cases C++/Tree just makes two separate sequences, one for element A, another for element B. If you only had a handful of types that used such a choice construct then this could have been handled by customizing the corresponding types and proving order- sensitive storage as well as parsing and serialization. But if you have a hundred of them then this approach won't scale. So I would suggest that you take a look at C++/Hybrid in XSD/e. This mapping will preserve ordering without any extra work from your side. If you really want to stick to C++/Tree and XSD then there might be a way to still work around this situation if you don't add/remove any elements. I.e., the only modification that you make is the change of values of attributes and simple type elements (e.g., A in the schema above). In a nutshell, the idea is to use the original DOM document for structure and then re-set the elements and attributes with simple types from the object model. Because we can only get an object model node from a DOM node as xml_schema::type&, we will need to use the polymorphic type map to call the serializer function in a polymorphic way. This add another limitation to this approach namely that none of the simple type elements/attributes can have anonymous types since those are not registered in the maps. Let me know if you think this might work for your situation and I will provide you with a more detailed outline. Boris From barrie.kovish at singularsoftware.com Thu Feb 11 19:51:40 2010 From: barrie.kovish at singularsoftware.com (Barrie Kovish) Date: Thu Feb 11 19:51:48 2010 Subject: [xsd-users] Preserving XML element order In-Reply-To: References: <02AEE30D-03FC-4BA0-AE3D-82A9F2D740E9@singularsoftware.com> Message-ID: <5D139A45-84BE-40D7-BDF9-CBBCF09DE52C@singularsoftware.com> Boris, We do need to add nodes to the tree so the last option appears to be out. I had a look at XSD/e and it looks like it won't support XPATH queries which is also a significant limitation for us. Currently I am investigating using Xerxes. This presents a much more complex programming model so is not appealing! Barrie On 2010-02-11, at 11:11 AM, Boris Kolpackov wrote: > Hi Barrie, > > Barrie Kovish writes: > >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> I would say that 90% of the schema is structure like this. There >> are probably 50-100 choice elements in the schema and another 100-200 >> string and integer elements. > > Barrie Kovish writes: > >> There is probably another aspect of the schema I should mention. The >> various element types are shared. By this I mean the following: >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> So elements named A are shared between elements named X and W. > > In such cases C++/Tree just makes two separate sequences, one for > element A, another for element B. If you only had a handful of > types that used such a choice construct then this could have been > handled by customizing the corresponding types and proving order- > sensitive storage as well as parsing and serialization. But if you > have a hundred of them then this approach won't scale. So I would > suggest that you take a look at C++/Hybrid in XSD/e. This mapping > will preserve ordering without any extra work from your side. > > If you really want to stick to C++/Tree and XSD then there might be > a way to still work around this situation if you don't add/remove any > elements. I.e., the only modification that you make is the change of > values of attributes and simple type elements (e.g., A in the schema > above). In a nutshell, the idea is to use the original DOM document > for structure and then re-set the elements and attributes with simple > types from the object model. Because we can only get an object model > node from a DOM node as xml_schema::type&, we will need to use the > polymorphic type map to call the serializer function in a polymorphic > way. This add another limitation to this approach namely that none > of the simple type elements/attributes can have anonymous types since > those are not registered in the maps. Let me know if you think this > might work for your situation and I will provide you with a more > detailed outline. > > Boris From boris at codesynthesis.com Fri Feb 12 12:48:56 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Feb 12 12:48:45 2010 Subject: [xsd-users] Preserving XML element order In-Reply-To: <5D139A45-84BE-40D7-BDF9-CBBCF09DE52C@singularsoftware.com> References: <02AEE30D-03FC-4BA0-AE3D-82A9F2D740E9@singularsoftware.com> <5D139A45-84BE-40D7-BDF9-CBBCF09DE52C@singularsoftware.com> Message-ID: Hi Barrie, Barrie Kovish writes: > We do need to add nodes to the tree so the last option appears to be > out. Yes, that complicates things. What kind of node insertion would you need to perform? Just appending them at the end of the existing nodes or inserting them at specific positions? Also, will it be possible for you to send me your schema (in a private email) so that I could take a closer look? > I had a look at XSD/e and it looks like it won't support XPATH queries > which is also a significant limitation for us. No, there is no XPath support in XSD/e. > Currently I am investigating using Xerxes. This presents a much more > complex programming model so is not appealing! Yes, using raw DOM is always an option though not a very convenient one. Let's see if we can figure out a way. Boris From bidski at bigpond.net.au Sat Feb 13 02:29:17 2010 From: bidski at bigpond.net.au (Bidski) Date: Sat Feb 13 02:29:27 2010 Subject: [xsd-users] Parser error Message-ID: <613D75181A85463B8E4C8A78058BBE5D@Panda> Can anyone explain what this means? - std::vector,std::allocator > > [99139]({severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=2 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=3 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=4 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=5 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=6 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=7 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=8 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=9 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=10 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=11 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=12 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=13 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=14 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=15 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=16 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=17 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=18 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=19 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=20 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=21 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=22 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=23 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=24 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=25 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=26 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Debug\\Inventory.xml" line_=27 ...},{severity_={...} id_="G:\PC\VC++2010\MRP\Deb l,...) std::vector,std::allocator > > It is the error thrown by the following line ::xml_schema::dom::auto_ptr< ::xercesc::DOMDocument > d (::xsd::cxx::xml::dom::parse< char > (u, h, p, f)); where u is the "URI" h is the error handler (::xsd::cxx::tree::error_handler< char >) p are the properties (::xml_schema::properties) and f are the flags (::xml_schema::flags) all values are the defaults that are provided by xsd cxx-tree, except of course for the URI which is the local XML file that i am using. Thanks in advance Bidski From barrie.kovish at singularsoftware.com Sat Feb 13 13:31:30 2010 From: barrie.kovish at singularsoftware.com (Barrie Kovish) Date: Sat Feb 13 13:32:01 2010 Subject: [xsd-users] Preserving XML element order In-Reply-To: References: <02AEE30D-03FC-4BA0-AE3D-82A9F2D740E9@singularsoftware.com> <5D139A45-84BE-40D7-BDF9-CBBCF09DE52C@singularsoftware.com> Message-ID: Boris, At this point I don't know all the details related to the insertions. I know that in one case we need to insert complex elements to a series of similar elements. Likely in the future we would need to do the same plus perform some sort of fix up of other elements which were dependent upon the element order. For example Starting XML: x y z Changed XML: x y u z Other elements in the file will contain the 1, 2, and 3. We will need to fix them up to have the new and correct indices. The contents x,y,z, u can also be complex or simple elements. Barrie On 2010-02-12, at 9:48 AM, Boris Kolpackov wrote: > Hi Barrie, > > Barrie Kovish writes: > >> We do need to add nodes to the tree so the last option appears to be >> out. > > Yes, that complicates things. What kind of node insertion would you > need to perform? Just appending them at the end of the existing nodes > or inserting them at specific positions? > > Also, will it be possible for you to send me your schema (in a private > email) so that I could take a closer look? > > >> I had a look at XSD/e and it looks like it won't support XPATH queries >> which is also a significant limitation for us. > > No, there is no XPath support in XSD/e. > > >> Currently I am investigating using Xerxes. This presents a much more >> complex programming model so is not appealing! > > Yes, using raw DOM is always an option though not a very convenient one. > Let's see if we can figure out a way. > > Boris From boris at codesynthesis.com Mon Feb 15 02:31:02 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Feb 15 02:29:41 2010 Subject: [xsd-users] S2S protocol with XSD. In-Reply-To: <934266f71002140721ta269eacuac9e53c109459737@mail.gmail.com> References: <934266f71002090540i57ac297agb4d87c539b7e6bf7@mail.gmail.com> <934266f71002140721ta269eacuac9e53c109459737@mail.gmail.com> Message-ID: Hi Michael, In the future please keep your replies CC'ed to the xsd-users mailing list as discussed in the posting guidelines: http://www.codesynthesis.com/support/posting-guidelines.xhtml Michael Smith writes: > It helped. Thanks a lot. However the example schemas from the S2S > documentation doesn't parse unless I add xmlns:xsi=" > http://www.w3.org/2001/XMLSchema-instance" attribute to s2s:s2sMessage > element. Is it possible to add this implicitly from the code? Yes, there are several ways to this which are covered in Section 5.1, "XML Schema Validation and Searching" in the C++/Tree Mapping Getting Started Guide: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/#5.1 Boris From boris at codesynthesis.com Mon Feb 15 02:49:02 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Feb 15 02:47:40 2010 Subject: [xsd-users] Parser error In-Reply-To: <613D75181A85463B8E4C8A78058BBE5D@Panda> References: <613D75181A85463B8E4C8A78058BBE5D@Panda> Message-ID: Hi Bidski, Bidski writes: > Can anyone explain what this means? This is a parsing error. You can get more detailed information by catching xml_schema::exception and printing it, as shown in all the examples. You probably get these errors because the parser could not find the schema to validate your document against (XML Schema validation is enabled by default). For ways to resolve this, see Section 5.1, "XML Schema Validation and Searching" in the C++/Tree Mapping Getting Started Guide: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/#5.1 Boris From bidski at bigpond.net.au Fri Feb 12 05:52:58 2010 From: bidski at bigpond.net.au (Bidski) Date: Mon Feb 15 08:31:03 2010 Subject: [xsd-users] Which library? Message-ID: Hi all, Can anyone tell me what library these unresolved externals are from? Error 1 error LNK2019: unresolved external symbol "char const * __cdecl xsd::cxx::tree::bits::nan(void)" (??$nan@D@bits@tree@cxx@xsd@@YAPBDXZ) referenced in function "class std::basic_string,class std::allocator > __cdecl xsd::cxx::tree::bits::insert(struct xsd::cxx::tree::as_double const &)" (??$insert@D@bits@tree@cxx@xsd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABU?$as_double@N@123@@Z) Inventory.obj Error 2 error LNK2019: unresolved external symbol "char const * __cdecl xsd::cxx::tree::bits::negative_inf(void)" (??$negative_inf@D@bits@tree@cxx@xsd@@YAPBDXZ) referenced in function "class std::basic_string,class std::allocator > __cdecl xsd::cxx::tree::bits::insert(struct xsd::cxx::tree::as_double const &)" (??$insert@D@bits@tree@cxx@xsd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABU?$as_double@N@123@@Z) Inventory.obj Error 3 error LNK2019: unresolved external symbol "char const * __cdecl xsd::cxx::tree::bits::positive_inf(void)" (??$positive_inf@D@bits@tree@cxx@xsd@@YAPBDXZ) referenced in function "class std::basic_string,class std::allocator > __cdecl xsd::cxx::tree::bits::insert(struct xsd::cxx::tree::as_double const &)" (??$insert@D@bits@tree@cxx@xsd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABU?$as_double@N@123@@Z) Inventory.obj Bidski From bidski at bigpond.net.au Fri Feb 12 06:08:42 2010 From: bidski at bigpond.net.au (Bidski) Date: Mon Feb 15 08:31:19 2010 Subject: [xsd-users] Which library? Message-ID: <7198A4244CDC46CEBC66133A8A9A6F64@Panda> ok, the definitions for the three unresolved externals that i mentioned are in #include but including it in my project doesnt remove the errors, any thoughts on this? i compiled my XML xchema file as follows xsd cxx-tree --char-type wchar_t --hxx-suffix .h --cxx-suffix .cpp --generate-serialization inventory.xsd the rest of my project is running in unicode so i figured i should follow suit with this part as well. Bidski From: Bidski Sent: Friday, February 12, 2010 9:52 PM To: CodeSynthesis XSD Subject: Which library? Hi all, Can anyone tell me what library these unresolved externals are from? Error 1 error LNK2019: unresolved external symbol "char const * __cdecl xsd::cxx::tree::bits::nan(void)" (??$nan@D@bits@tree@cxx@xsd@@YAPBDXZ) referenced in function "class std::basic_string,class std::allocator > __cdecl xsd::cxx::tree::bits::insert(struct xsd::cxx::tree::as_double const &)" (??$insert@D@bits@tree@cxx@xsd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABU?$as_double@N@123@@Z) Inventory.obj Error 2 error LNK2019: unresolved external symbol "char const * __cdecl xsd::cxx::tree::bits::negative_inf(void)" (??$negative_inf@D@bits@tree@cxx@xsd@@YAPBDXZ) referenced in function "class std::basic_string,class std::allocator > __cdecl xsd::cxx::tree::bits::insert(struct xsd::cxx::tree::as_double const &)" (??$insert@D@bits@tree@cxx@xsd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABU?$as_double@N@123@@Z) Inventory.obj Error 3 error LNK2019: unresolved external symbol "char const * __cdecl xsd::cxx::tree::bits::positive_inf(void)" (??$positive_inf@D@bits@tree@cxx@xsd@@YAPBDXZ) referenced in function "class std::basic_string,class std::allocator > __cdecl xsd::cxx::tree::bits::insert(struct xsd::cxx::tree::as_double const &)" (??$insert@D@bits@tree@cxx@xsd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABU?$as_double@N@123@@Z) Inventory.obj Bidski From bidski at bigpond.net.au Fri Feb 12 18:53:13 2010 From: bidski at bigpond.net.au (Bidski) Date: Mon Feb 15 08:31:39 2010 Subject: [xsd-users] Fw: Which library? Message-ID: <8C94F2507B4343D883DD7AADFC387562@Panda> can anyone tell me why i am getting these errors? i recompiled my XML xshema file using the standard char-type (char) and these errors disappear, if i revert to the wchar_t version the errors return. also, on a side note, is xerces-c_3D.lib not the debug version of the library? i ask because i am compiling my program in debug mobe and when linking with that library i receive the error "The application failed to initialize properly (0xc0150002). Click on OK to terminate the application." but linking to xerces-c_3.lib resolves that issue. If you need to know, i am using MS Visual Studio 2010 Beta 2 on Windows 7 64-bit. Bidski From: Bidski Sent: Friday, February 12, 2010 10:08 PM To: CodeSynthesis XSD Subject: Which library? ok, the definitions for the three unresolved externals that i mentioned are in #include but including it in my project doesnt remove the errors, any thoughts on this? i compiled my XML xchema file as follows xsd cxx-tree --char-type wchar_t --hxx-suffix .h --cxx-suffix .cpp --generate-serialization inventory.xsd the rest of my project is running in unicode so i figured i should follow suit with this part as well. Bidski From: Bidski Sent: Friday, February 12, 2010 9:52 PM To: CodeSynthesis XSD Subject: Which library? Hi all, Can anyone tell me what library these unresolved externals are from? Error 1 error LNK2019: unresolved external symbol "char const * __cdecl xsd::cxx::tree::bits::nan(void)" (??$nan@D@bits@tree@cxx@xsd@@YAPBDXZ) referenced in function "class std::basic_string,class std::allocator > __cdecl xsd::cxx::tree::bits::insert(struct xsd::cxx::tree::as_double const &)" (??$insert@D@bits@tree@cxx@xsd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABU?$as_double@N@123@@Z) Inventory.obj Error 2 error LNK2019: unresolved external symbol "char const * __cdecl xsd::cxx::tree::bits::negative_inf(void)" (??$negative_inf@D@bits@tree@cxx@xsd@@YAPBDXZ) referenced in function "class std::basic_string,class std::allocator > __cdecl xsd::cxx::tree::bits::insert(struct xsd::cxx::tree::as_double const &)" (??$insert@D@bits@tree@cxx@xsd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABU?$as_double@N@123@@Z) Inventory.obj Error 3 error LNK2019: unresolved external symbol "char const * __cdecl xsd::cxx::tree::bits::positive_inf(void)" (??$positive_inf@D@bits@tree@cxx@xsd@@YAPBDXZ) referenced in function "class std::basic_string,class std::allocator > __cdecl xsd::cxx::tree::bits::insert(struct xsd::cxx::tree::as_double const &)" (??$insert@D@bits@tree@cxx@xsd@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABU?$as_double@N@123@@Z) Inventory.obj Bidski From boris at codesynthesis.com Mon Feb 15 08:58:24 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Feb 15 08:57:07 2010 Subject: [xsd-users] Which library? In-Reply-To: <8C94F2507B4343D883DD7AADFC387562@Panda> References: <8C94F2507B4343D883DD7AADFC387562@Panda> Message-ID: Hi Bidski, Bidski writes: > can anyone tell me why i am getting these errors? This is a known bug in XSD 3.2.0 which has been fixed for the upcoming 3.3.0 release. Can you upgrade to the 3.3.0 beta and see if it helps: http://www.codesynthesis.com/products/xsd/download.xhtml Alternatively, you can just copy libxsd/xsd/cxx/tree/bits/literals.txx from 3.3.0.b1 to your 3.2.0 installation. > also, on a side note, is xerces-c_3D.lib not the debug version of the > library? i ask because i am compiling my program in debug mobe and when > linking with that library i receive the error "The application failed > to initialize properly (0xc0150002). Click on OK to terminate the > application." but linking to xerces-c_3.lib resolves that issue. > > If you need to know, i am using MS Visual Studio 2010 Beta 2 on Windows 7 > 64-bit. Yes, xerces-c_3D.lib is the variant with debug information. However, if you are using the version supplied with the .MSI package or if you downloaded it from the Xerces-C++ website, then that library was built with the previous version of VC++. It is possible that the debug information in VC++ 2010 is incompatible with that in 2008. So I suggest that you download the source code for Xerces-C++ and build it with VC++ 2010 (you should be able to convert the 2008 solution to 2010). Boris From boris at codesynthesis.com Mon Feb 15 11:02:37 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Feb 15 11:01:17 2010 Subject: [xsd-users] Preserving XML element order In-Reply-To: References: <02AEE30D-03FC-4BA0-AE3D-82A9F2D740E9@singularsoftware.com> <5D139A45-84BE-40D7-BDF9-CBBCF09DE52C@singularsoftware.com> Message-ID: Barrie, Barrie Kovish writes: > I know that in one case we need to insert complex elements to a series > of similar elements. Likely in the future we would need to do the same > plus perform some sort of fix up of other elements which were dependent > upon the element order. For example > > Starting XML: > x > y > z > > Changed XML: > x > y > u > z > > Other elements in the file will contain the 1, 2, and 3. We will need to > fix them up to have the new and correct indices. The contents x,y,z, u > can also be complex or simple elements. I see several ways how this can be done fairly easily with the substitution group approach[1]. For example, you could customize the object model to maintain a map of "first complex element" (i.e., the element with actual content) to all the "referencing elements" (i.e., the elements with just the id). This map would be stored in the root of the object model. The complex elements would then automatically add themselves to this map. Once you need to adjust the id of some element and all its references, you can use this map to quickly find all the places that need changing. [1] http://www.codesynthesis.com/pipermail/xsd-users/2008-May/001697.html Boris From bidski at bigpond.net.au Tue Feb 16 03:56:55 2010 From: bidski at bigpond.net.au (Bidski) Date: Tue Feb 16 11:20:05 2010 Subject: [xsd-users] Returning data by criteria Message-ID: <2006DFD341D34B998157BCA52B56058E@Panda> Hello all, I was wondering if it is possible to selectively return certain data from a xml file, the same as you would if you were using SQL statements with a database. As an example, say this is our xml file. John Doe male 32 Jane Doe female 28 Is it possible to just get the data pertaining to John Doe's record? Or to return, say, the age of every male that is listed in the xml file (assuming that we had more records). I know that with the cxx/parser you can retrieve the data of specific fields (i.e. age and gender only) but from what I can tell you still have to get that information for every record. Am I wrong here? Is it possible to return only the information pertaining to 1 (or less than all) records? My problem is that each record in my xml file has a minimum of 39 fields (with an extra 4 fields being able to occur anywhere from 0-????? times) and, currently, I have about 1,800 records. I originally tried using the cxx/tree method, just to see how it worked, with the results being slow and very memory consuming (this file in particular took up about 25MB memory) and caused me to re-shuffle some of my variables to avoid stack overflows. Now I am using the cxx/parser method, which has reduced memory consumption down to about 3MB or so, but the parsing is still sluggish (takes roughly 4-7 seconds to parse the file, depending on how many fields I am interested in). So is it possible to just return singular records, or parts of singular records? Thanks in advance Bidski From greg at permedia.ca Tue Feb 16 13:17:53 2010 From: greg at permedia.ca (Greg Carter) Date: Tue Feb 16 13:17:57 2010 Subject: [xsd-users] Run xsd on platform X, compile on platform Y? Message-ID: Hi, Is it possible to use the code generated on one platform across all others? In my case I have about 35 .xsd files, which I build using the custom build events in my MSVC projects. It would be a bit of a pain to migrate that if I don't need to. Thanks. Greg. From PaquetP at navcanada.ca Tue Feb 16 14:05:16 2010 From: PaquetP at navcanada.ca (Paquette, Patrick) Date: Tue Feb 16 14:05:30 2010 Subject: [xsd-users] Run xsd on platform X, compile on platform Y? Message-ID: <474534909BE4064E853161350C47578E09C56D11@ncrmail1.corp.navcan.ca> Hi Greg, I'm doing it, and it works fine. However, I'm using Makefiles from gnu make, integrated in VS via GnuWin32 and custom build rules. A build from either IDE will regenerate the code, as it's the only common denominator between my two systems. -----Original Message----- From: xsd-users-bounces@codesynthesis.com [mailto:xsd-users-bounces@codesynthesis.com] On Behalf Of Greg Carter Sent: February 16, 2010 01:18 PM To: xsd-users@codesynthesis.com Subject: [xsd-users] Run xsd on platform X, compile on platform Y? Hi, Is it possible to use the code generated on one platform across all others? In my case I have about 35 .xsd files, which I build using the custom build events in my MSVC projects. It would be a bit of a pain to migrate that if I don't need to. Thanks. Greg. From boris at codesynthesis.com Wed Feb 17 08:30:31 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Feb 17 08:29:00 2010 Subject: [xsd-users] Run xsd on platform X, compile on platform Y? In-Reply-To: References: Message-ID: Hi Greg, Greg Carter writes: > Is it possible to use the code generated on one platform across all > others? Yes, the code generated with a specific set of options is identical across all the platforms. Boris From boris at codesynthesis.com Wed Feb 17 08:50:57 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Feb 17 08:49:25 2010 Subject: [xsd-users] Returning data by criteria In-Reply-To: <2006DFD341D34B998157BCA52B56058E@Panda> References: <2006DFD341D34B998157BCA52B56058E@Panda> Message-ID: Hi Bidski, Bidski writes: > I was wondering if it is possible to selectively return certain data > from a xml file, the same as you would if you were using SQL statements > with a database. As an example, say this is our xml file. > > > > > John > Doe > male > 32 > > > > Jane > Doe > female > 28 > > > > Is it possible to just get the data pertaining to John Doe's record? > Or to return, say, the age of every male that is listed in the xml > file (assuming that we had more records). I know that with the > cxx/parser you can retrieve the data of specific fields (i.e. age > and gender only) but from what I can tell you still have to get > that information for every record. Am I wrong here? Is it possible > to return only the information pertaining to 1 (or less than all) > records? With the C++/Parser you can do some selective parsing though the XML will still need to be parsed completely since there is no way to only parse records that contain certain data. In essence, with C++/Parser two operations are performed: (1) the XML is parsed to a stream of "raw" events (element, attribute, text), and (2) these raw events are then converted to vocabulary-specific types (e.g., age string "28" is converted to the 28 int) and this data is dispatched to the callbacks. So there is no way to get rid of the first step but you can avoid doing the second step for data that you don't need by not providing the parser for the corresponding elements and attributes. To use your example about getting the age of every male, you would only provide parsers for the age and gender elements, and leave first-name and last-name without the parsers. > My problem is that each record in my xml file has a minimum of 39 > fields (with an extra 4 fields being able to occur anywhere from > 0-????? times) and, currently, I have about 1,800 records. I > originally tried using the cxx/tree method, just to see how it > worked, with the results being slow and very memory consuming > (this file in particular took up about 25MB memory) and caused > me to re-shuffle some of my variables to avoid stack overflows. > Now I am using the cxx/parser method, which has reduced memory > consumption down to about 3MB or so, but the parsing is still > sluggish (takes roughly 4-7 seconds to parse the file, depending > on how many fields I am interested in). That's unusually slow, assuming the document is about 25MB. There are several things you can do to improve this: 1. Compile both Xerces-C++ and your application with optimization turned on (I assume you are already doing this, but just to make sure). 2. Disable XML Schema validation. 3. If you cannot disable validation and you plan to parse more than one document, consider pre-loading the schemas. For a guide on how to do this see the 'performance' example in the examples/cxx/parser/ directory. 4. Consider using Expat instead of Xerces-C++ as the underlying XML parser. Expat is a bit faster than Xerces-C++ though note that there is no support for wchar_t as the character type. Let us know if this helps. Boris From greg at permedia.ca Wed Feb 17 17:21:06 2010 From: greg at permedia.ca (Greg Carter) Date: Wed Feb 17 17:21:11 2010 Subject: [xsd-users] Compiling to multiple DLLs, duplicate symbols problem In-Reply-To: References: Message-ID: Hi Boris, I missed this when you first posted it, I will give it a try on Windows. However I am having a problem when I try to compile on Linux which I think is related to this, or at least to the exporting of XSD base template symbols. I'm trying to build the equivalent of my geocosmxmllibbasecpp.dll on Linux as a shared lib. When I try to build I get this error explicit instantiation of ?class xsd::cxx::tree::simple_type? in namespace ?xml_schema? (which does not enclose namespace ?xsd::cxx::tree?) At each point in my XSDBaseXmlSchema.hxx where a line like: template class GEOCOSMXMLBASE_SYMBOL_DECL ::xsd::cxx::tree::simple_type< type >; occurs. For my linux build GEOCOSMXMLBASE_SYMBOL_DECL is defined as nothing: #define GEOCOSMXMLBASE_SYMBOL_DECL I'm on centos 5.4, g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46) xsd version xsd-3.3.0.b1-i686-linux-gnu, although the files were generated (including XSDBaseXmlSchema.hxx) on Windows using xsd version xsd-3.3.0.b1-i686-windows. I'm using Eclipse to build, the exact command is: make all Building file: ../xmlschema/gencode/cpp/DistributionCorrelationSchema.cxx Invoking: GCC C++ Compiler g++ -DGEOCOSMXMLLIBBASECPP_EXPORTS=1 -I"/opt/xsd-3.3.0.b1-i686-linux-gnu/libxsd" -I"/opt/xerces-c-3.1.0-x86-linux-gcc-3.4/include" -I"/mnt/src/geocosm/geocosmxmllibbasecpp" -I"/mnt/src/geocosm/xmlschema/gencode/cpp" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"xmlschema/gencode/cpp/DistributionCorrelationSchema.d" -MT"xmlschema/gencode/cpp/DistributionCorrelationSchema.d" -o"xmlschema/gencode/cpp/DistributionCorrelationSchema.o" "../xmlschema/gencode/cpp/DistributionCorrelationSchema.cxx" ../xmlschema/gencode/cpp/XSDBaseXmlSchema.hxx:82: error: explicit instantiation of ?class xsd::cxx::tree::simple_type? in namespace ?xml_schema? (which does not enclose namespace ?xsd::cxx::tree?) ../xmlschema/gencode/cpp/XSDBaseXmlSchema.hxx:126: error: explicit instantiation of ?class xsd::cxx::tree::string >? in namespace ?xml_schema? (which does not enclose namespace ?xsd::cxx::tree?) <48 more errors all in XSDBaseXmlSchema.hxx> Any ideas? Boris Kolpackov wrote: > Hi Greg, > > > Based on this understanding I was able to work around the problem > in your case by adding the following code at the end of exportxml.h: > > #include > > namespace xsd > { > namespace cxx > { > namespace tree > { > template class __declspec(dllimport) sequence; > } > } > } > > From barrie.kovish at singularsoftware.com Wed Feb 17 19:08:24 2010 From: barrie.kovish at singularsoftware.com (Barrie Kovish) Date: Wed Feb 17 19:08:34 2010 Subject: [xsd-users] Preserving XML element order In-Reply-To: References: <02AEE30D-03FC-4BA0-AE3D-82A9F2D740E9@singularsoftware.com> <5D139A45-84BE-40D7-BDF9-CBBCF09DE52C@singularsoftware.com> Message-ID: <7E995914-4E62-4D1B-817A-B36C3C434D3B@singularsoftware.com> Boris, How do I customize the object model? I had actually wanted to do something like the following: class angle: public ::xml_schema::type, public MyClass Then I can use class template specialization to add specific methods to various Code Synthesis generated classes. I tried using some of the command line regex options but couldn't figure out how to do it (or if it can be done). It would be a problem to modify the Code Synthesis generated classes by hand because we may still update the schema. Thanks, Barrie Thanks. On 2010-02-15, at 8:02 AM, Boris Kolpackov wrote: > Barrie, > > Barrie Kovish writes: > >> I know that in one case we need to insert complex elements to a series >> of similar elements. Likely in the future we would need to do the same >> plus perform some sort of fix up of other elements which were dependent >> upon the element order. For example >> >> Starting XML: >> x >> y >> z >> >> Changed XML: >> x >> y >> u >> z >> >> Other elements in the file will contain the 1, 2, and 3. We will need to >> fix them up to have the new and correct indices. The contents x,y,z, u >> can also be complex or simple elements. > > I see several ways how this can be done fairly easily with the > substitution group approach[1]. For example, you could customize > the object model to maintain a map of "first complex element" > (i.e., the element with actual content) to all the "referencing > elements" (i.e., the elements with just the id). This map would > be stored in the root of the object model. The complex elements > would then automatically add themselves to this map. Once you > need to adjust the id of some element and all its references, > you can use this map to quickly find all the places that need > changing. > > [1] http://www.codesynthesis.com/pipermail/xsd-users/2008-May/001697.html > > Boris From greg at permedia.ca Thu Feb 18 15:06:29 2010 From: greg at permedia.ca (Greg Carter) Date: Thu Feb 18 15:06:31 2010 Subject: [xsd-users] Compiling to multiple DLLs, duplicate symbols problem In-Reply-To: References: Message-ID: I think the problem is with generated code like: namespace xml_schema { template class GEOCOSMXMLBASE_SYMBOL_DECL ::xsd::cxx::tree::simple_type< type >; } This seems to be in violation of C++ standard (section 14.7.3 para 2). See http://gcc.gnu.org/ml/gcc-help/2006-03/msg00195.html and follow the "follow-up" links. I think this is related to the --export-maps/--import-maps option. Do you see any way around this? If I remove the --export-maps/--import-maps options and regenerate my code for a Linux build, will I still be able to separate the generated code into multiple shared libs (Linux)? Thanks Greg. Greg Carter wrote: > Hi Boris, > > I missed this when you first posted it, I will give it a try on > Windows. However I am having a problem when I try to compile on Linux > which I think is related to this, or at least to the exporting of XSD > base template symbols. > > I'm trying to build the equivalent of my geocosmxmllibbasecpp.dll on > Linux as a shared lib. When I try to build I get this error > explicit instantiation of ?class > xsd::cxx::tree::simple_type? in namespace > ?xml_schema? (which does not enclose namespace ?xsd::cxx::tree?) > > At each point in my XSDBaseXmlSchema.hxx where a line like: > > template class GEOCOSMXMLBASE_SYMBOL_DECL > ::xsd::cxx::tree::simple_type< type >; > > occurs. > > For my linux build GEOCOSMXMLBASE_SYMBOL_DECL is defined as nothing: > #define GEOCOSMXMLBASE_SYMBOL_DECL > > I'm on centos 5.4, > g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46) > xsd version xsd-3.3.0.b1-i686-linux-gnu, although the files were > generated (including XSDBaseXmlSchema.hxx) on Windows using xsd > version xsd-3.3.0.b1-i686-windows. > > I'm using Eclipse to build, the exact command is: > make all > Building file: ../xmlschema/gencode/cpp/DistributionCorrelationSchema.cxx > Invoking: GCC C++ Compiler > g++ -DGEOCOSMXMLLIBBASECPP_EXPORTS=1 > -I"/opt/xsd-3.3.0.b1-i686-linux-gnu/libxsd" > -I"/opt/xerces-c-3.1.0-x86-linux-gcc-3.4/include" > -I"/mnt/src/geocosm/geocosmxmllibbasecpp" > -I"/mnt/src/geocosm/xmlschema/gencode/cpp" -O0 -g3 -Wall -c > -fmessage-length=0 -MMD -MP > -MF"xmlschema/gencode/cpp/DistributionCorrelationSchema.d" > -MT"xmlschema/gencode/cpp/DistributionCorrelationSchema.d" > -o"xmlschema/gencode/cpp/DistributionCorrelationSchema.o" > "../xmlschema/gencode/cpp/DistributionCorrelationSchema.cxx" > > ../xmlschema/gencode/cpp/XSDBaseXmlSchema.hxx:82: error: explicit > instantiation of ?class > xsd::cxx::tree::simple_type? in namespace > ?xml_schema? (which does not enclose namespace ?xsd::cxx::tree?) > ../xmlschema/gencode/cpp/XSDBaseXmlSchema.hxx:126: error: explicit > instantiation of ?class xsd::cxx::tree::string xsd::cxx::tree::simple_type >? in namespace > ?xml_schema? (which does not enclose namespace ?xsd::cxx::tree?) > <48 more errors all in XSDBaseXmlSchema.hxx> > > Any ideas? > > Boris Kolpackov wrote: >> Hi Greg, >> >> Based on this understanding I was able to work around the problem >> in your case by adding the following code at the end of exportxml.h: >> >> #include >> >> namespace xsd >> { >> namespace cxx >> { >> namespace tree >> { >> template class __declspec(dllimport) sequence; >> } >> } >> } >> >> > From boris at codesynthesis.com Thu Feb 18 15:20:48 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Feb 18 15:19:17 2010 Subject: [xsd-users] Compiling to multiple DLLs, duplicate symbols problem In-Reply-To: References: Message-ID: Hi Greg, Greg Carter writes: > I think the problem is with generated code like: > > namespace xml_schema > { > template class GEOCOSMXMLBASE_SYMBOL_DECL > ::xsd::cxx::tree::simple_type< type >; > } > > This seems to be in violation of C++ standard (section 14.7.3 para 2). Yes, this is a Microsoft-specific extension (which may or may not work with the symbol visibility feature in GCC). I was too quick to say that the same generated code can be used across all the platforms; there are currently some options (such as --export-xml-schema) that result in platform-specific code. I will think of a way to work around this (probably wrap it in #ifndef NO_EXPORT_XML_SCHEMA so that the code can be used on other platforms with just a simple define). > I think this is related to the --export-maps/--import-maps option. Do > you see any way around this? I think this particular case is caused by --export-xml-schema but these two options are also MS (and starting from 3.3.0, GCC) -specific. > If I remove the --export-maps/--import-maps options and regenerate > my code for a Linux build, will I still be able to separate the > generated code into multiple shared libs (Linux)? Yes, sure. On Linux everything will work out of the box without any extra effort from your side. Boris From boris at codesynthesis.com Thu Feb 18 15:30:47 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Feb 18 15:29:01 2010 Subject: [xsd-users] Preserving XML element order In-Reply-To: <7E995914-4E62-4D1B-817A-B36C3C434D3B@singularsoftware.com> References: <02AEE30D-03FC-4BA0-AE3D-82A9F2D740E9@singularsoftware.com> <5D139A45-84BE-40D7-BDF9-CBBCF09DE52C@singularsoftware.com> <7E995914-4E62-4D1B-817A-B36C3C434D3B@singularsoftware.com> Message-ID: Hi Barrie, Barrie Kovish writes: > How do I customize the object model? Take a look at the C++/Tree Mapping Customization Guide: http://wiki.codesynthesis.com/Tree/Customization_guide There is also a bunch of examples in the examples/cxx/tree/custom/ directory. > I had actually wanted to do something like the following: > > class angle: public ::xml_schema::type, public MyClass > > Then I can use class template specialization to add specific > methods to various Code Synthesis generated classes. The best approach would be to request the generation of the 'base' type and make the actual type a typedef to a template instantiation, for example: --custom-type angle=MyClass/angle_base This way you will get something like this in the generated code: class angle_base: ... { // Standard mapping }; typedef MyClass angle; The MyClass class template would normally look like this: template class MyClass: public X { ... }; Boris From greg at permedia.ca Thu Feb 18 17:06:43 2010 From: greg at permedia.ca (Greg Carter) Date: Thu Feb 18 17:06:45 2010 Subject: [xsd-users] Compiling to multiple DLLs, duplicate symbols problem In-Reply-To: References: Message-ID: Hi Boris, I just tried the manual work around of removing the --extern-xml-schema option then regenerating the code (regen on Windows FWIW), then compiled on Linux. I'm running into another problem with a symbol that is getting defined in both the base header file (the one produced by --generate-xml-schema) and in the headers of the generated code. First the section of XSDBaseXmlSchema.hxx (generated by the --generate-xml-schema) // DOM interaction. // namespace dom { // Automatic pointer for DOMDocument. // using ::xsd::cxx::xml::dom::auto_ptr; // DOM user data key for back pointers to tree nodes. // const XMLCh* const tree_node_key = ::xsd::cxx::tree::user_data_keys::node; <--- this line here } now the section from one of my code files generated from my schema: // DOM interaction. // namespace dom { // Automatic pointer for DOMDocument. // using ::xsd::cxx::xml::dom::auto_ptr; #ifndef XSD_CXX_TREE_TREE_NODE_KEY__XML_SCHEMA #define XSD_CXX_TREE_TREE_NODE_KEY__XML_SCHEMA // DOM user data key for back pointers to tree nodes. // const XMLCh* const tree_node_key = ::xsd::cxx::tree::user_data_keys::node; <--- this line #endif } The tree_node_key ends up defined multiple times. Note FWIW I only run into this when attempting to compile one of my "child" libs. The base lib compiles fine. So for some reason when I ran xsd across my XSD files that are in the child lib this bit of code got added. I got past this by putting a similar ifdef in the XSDBaseXmlSchema.hxx as found in the child lib headers and was able to build both the base/child libs on linux. Still a way off from using them... but hopefully they are built OK now. Ideally I'll end up applying your fix, as removing the --extern-xml-schema option is a manual process (I have to put it back in to get a proper build for Windows)... when you have a fix let me know and I'll try it out. Thanks Greg. Boris Kolpackov wrote: > Yes, this is a Microsoft-specific extension (which may or may not work > with the symbol visibility feature in GCC). I was too quick to say that > the same generated code can be used across all the platforms; there are > currently some options (such as --export-xml-schema) that result in > platform-specific code. I will think of a way to work around this > (probably wrap it in #ifndef NO_EXPORT_XML_SCHEMA so that the code > can be used on other platforms with just a simple define). > > >> I think this is related to the --export-maps/--import-maps option. Do >> you see any way around this? >> > > I think this particular case is caused by --export-xml-schema but these > two options are also MS (and starting from 3.3.0, GCC) -specific. > > > >> If I remove the --export-maps/--import-maps options and regenerate >> my code for a Linux build, will I still be able to separate the >> generated code into multiple shared libs (Linux)? >> > > Yes, sure. On Linux everything will work out of the box without any > extra effort from your side. > > Boris > > From boris at codesynthesis.com Fri Feb 19 10:32:00 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Feb 19 10:30:22 2010 Subject: [xsd-users] Compiling to multiple DLLs, duplicate symbols problem In-Reply-To: References: Message-ID: Hi Greg, Greg Carter writes: > I just tried the manual work around of removing the --extern-xml-schema > option then regenerating the code (regen on Windows FWIW), then compiled > on Linux. I'm running into another problem with a symbol that is > getting defined in both the base header file (the one produced by > --generate-xml-schema) and in the headers of the generated code. You need to remove --export-xml-schema, not --extern-xml-schema. > Ideally I'll end up applying your fix, as removing the > --extern-xml-schema option is a manual process (I have to put it back in > to get a proper build for Windows)... when you have a fix let me know > and I'll try it out. Will do, probably early next week. Boris From boris at codesynthesis.com Fri Feb 19 10:48:23 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Feb 19 10:46:34 2010 Subject: [xsd-users] Returning data by criteria In-Reply-To: <730BD747870C4ADC829D799CDF8A710A@Panda> References: <2006DFD341D34B998157BCA52B56058E@Panda> <730BD747870C4ADC829D799CDF8A710A@Panda> Message-ID: Hi Bidski, In the future please keep your replies CC'ed to the xsd-users mailing list as discussed in the posting guidelines: http://www.codesynthesis.com/support/posting-guidelines.xhtml Bidski writes: > Hi, > > Thank you for the reply Boris. > > I recompiled Xerces-C++ and my project making sure that optimizations > were turned (set to Full Optimization) and that has decreased the loading > time to about 3 secs. > > I added the following lines to try and per-load my schema but I got some > weird errors (seemingly unrelated and to do with other parts of the > program, but they disappear upon removal of the following code) > > ::std::auto_ptr<::xercesc::SAX2XMLReader> parser > (::xercesc::XMLReaderFactory::createXMLReader ()); // errors are > generated on this line > > parser->setFeature (::xercesc::XMLUni::fgSAX2CoreNameSpaces, true); > parser->setFeature (::xercesc::XMLUni::fgSAX2CoreNameSpacePrefixes, > true); > parser->setFeature > (::xercesc::XMLUni::fgXercesValidationErrorAsFatal, true); > > parser->setFeature (::xercesc::XMLUni::fgSAX2CoreValidation, true); > parser->setFeature (::xercesc::XMLUni::fgXercesSchema, true); > parser->setFeature (::xercesc::XMLUni::fgXercesSchemaFullChecking, > false); > > wchar_t tmp[MAX_PATH]; > swprintf_s(tmp, MAX_PATH, _T("%sData\\Inventory.xsd"), > theApp.szAppDirectory); > parser->loadGrammar (tmp, ::xercesc::Grammar::SchemaGrammarType, > true); > parser->setFeature > (::xercesc::XMLUni::fgXercesUseCachedGrammarInParse, true); > > Am I missing something here? I don't see anything wrong with the above line. You may want to double check that you have included all the necessary headers (you can copy them from the performance example). > I am planning to add other documents to this part of the program once I > am satisfied with the operation of this part. These will be smaller > documents. The validation is doing some form of type-checking on my xml > document isnt it? If this is the case then I would prefer not to turn it > off. As I intend to use this as a database, extra type checking is always > a good thing in my opinion. Schema validation makes sure that your documents conform to the constraints defined in XML Schema. > I am yet to try expat, would like to exhaust all possible avenues within > xerces before i try something new. > > During recompilation of the xerces library under visual studio 2010 I > encountered a load of warnings that I would like to check with you. You can ignore all of them, they are harmless. Boris [The rest of the email foolows for context]. > First off, within XSValueTest there were some lines like these > > #if SIZEOF_LONG == 8 > XSValue::XSValue_Data act_v_ran64_v_1; act_v_ran64_v_1.fValue.f_long = > (long)+9223372036854775807; > XSValue::XSValue_Data act_v_ran64_v_2; act_v_ran64_v_2.fValue.f_long = > (long)-9223372036854775808; > #endif > XSValue::XSValue_Data act_v_ran32_v_1; act_v_ran32_v_1.fValue.f_long = > (long)+2147483647; > XSValue::XSValue_Data act_v_ran32_v_2; act_v_ran32_v_2.fValue.f_long = > (long)-2147483648; > > The compiler was giving warnings about the unary minus operator being > used on a unsigned type ((long)-2147483648). I changed these lines to the > following > > #if SIZEOF_LONG == 8 > XSValue::XSValue_Data act_v_ran64_v_1; act_v_ran64_v_1.fValue.f_long = > _I64_MAX; > XSValue::XSValue_Data act_v_ran64_v_2; act_v_ran64_v_2.fValue.f_long = > _I64_MIN; > #endif > XSValue::XSValue_Data act_v_ran32_v_1; act_v_ran32_v_1.fValue.f_long = > LONG_MAX; > XSValue::XSValue_Data act_v_ran32_v_2; act_v_ran32_v_2.fValue.f_long = > LONG_MIN; > > The values of LONG_MAX/MIN and _I64_MAX are still the same as the > hard-coded values originally there. > > The other warning was about " 'this' : used in base member initializer > list " after a little research on the matter it looked as though the > behaviour would be ok as long as the 'this' pointer wasnt derefenced > until after all construction had been completed. I added a > > #pragma warning(disable:4355) > > to disable that warning. Here is an example of this warning > > DOMDocumentImpl::DOMDocumentImpl(DOMImplementation* domImpl, > MemoryManager* const manager) > : fNode(this), // These two lines > fParent(this), // generate this warning > fNodeIDMap(0), > fInputEncoding(0), > fXmlEncoding(0), > fXmlStandalone(false), > fXmlVersion(0), > fDocumentURI(0), > fDOMConfiguration(0), > fUserDataTableKeys(17, manager), > fUserDataTable(0), > fCurrentBlock(0), > fFreePtr(0), > fFreeBytesRemaining(0), > fHeapAllocSize(kInitialHeapAllocSize), > fRecycleNodePtr(0), > fRecycleBufferPtr(0), > fNodeListPool(0), > fDocType(0), > fDocElement(0), > fNameTableSize(257), > fNormalizer(0), > fRanges(0), > fNodeIterators(0), > fMemoryManager(manager), > fDOMImplementation(domImpl), > fChanges(0), > errorChecking(true) > { > fNameTable = (DOMStringPoolEntry**)allocate ( > sizeof (DOMStringPoolEntry*) * fNameTableSize); > for (XMLSize_t i = 0; i < fNameTableSize; i++) > fNameTable[i] = 0; > } > > Are those actions in line with what should be happening within the program? > From bidski at bigpond.net.au Sat Feb 20 18:53:47 2010 From: bidski at bigpond.net.au (Bidski) Date: Sat Feb 20 18:53:58 2010 Subject: [xsd-users] Returning data by criteria In-Reply-To: References: <2006DFD341D34B998157BCA52B56058E@Panda> <730BD747870C4ADC829D799CDF8A710A@Panda> Message-ID: Hi Boris, What I was missing in the code to pre-load the schema file was a call to ::xercesc::XMLPlatformUtils::Initialize();. Apparently this is needed for the calls to SAX2XMLReader. Loading time is still hovering at the 3 second mark, even with the addition of my other schema/xml files (6 schema/xml files total). The problem I have now are memory leaks. Looks to be as though I have 1 memory leak for each for schema/xml file. Can you point me in the direction of any specific clean-up calls that I need to make to the xerces library? I found that I was getting a fairly substantial memory leak from the SAX2XMLReader which was resolved with a call to ~SAX2XMLReader();, but I am at a loss to what is causing these other memory leaks and Visual Studio is not giving me much to go on. Following is an example of one of the memory leaks I am getting. Detected memory leaks! Dumping objects -> {7541} normal block at 0x00727CA0, 148 bytes long. Data: 48 DC 6B 00 CD CD CD CD 84 7A 1E 12 90 7E 1E 12 Any thoughts? Bidski -------------------------------------------------- From: "Boris Kolpackov" Sent: Saturday, February 20, 2010 2:48 AM To: "Bidski" Cc: Subject: Re: [xsd-users] Returning data by criteria > Hi Bidski, > > In the future please keep your replies CC'ed to the xsd-users mailing > list as discussed in the posting guidelines: > > http://www.codesynthesis.com/support/posting-guidelines.xhtml > > > Bidski writes: > >> Hi, >> >> Thank you for the reply Boris. >> >> I recompiled Xerces-C++ and my project making sure that optimizations >> were turned (set to Full Optimization) and that has decreased the loading >> time to about 3 secs. >> >> I added the following lines to try and per-load my schema but I got some >> weird errors (seemingly unrelated and to do with other parts of the >> program, but they disappear upon removal of the following code) >> >> ::std::auto_ptr<::xercesc::SAX2XMLReader> parser >> (::xercesc::XMLReaderFactory::createXMLReader ()); // errors are >> generated on this line >> >> parser->setFeature (::xercesc::XMLUni::fgSAX2CoreNameSpaces, true); >> parser->setFeature (::xercesc::XMLUni::fgSAX2CoreNameSpacePrefixes, >> true); >> parser->setFeature >> (::xercesc::XMLUni::fgXercesValidationErrorAsFatal, true); >> >> parser->setFeature (::xercesc::XMLUni::fgSAX2CoreValidation, true); >> parser->setFeature (::xercesc::XMLUni::fgXercesSchema, true); >> parser->setFeature (::xercesc::XMLUni::fgXercesSchemaFullChecking, >> false); >> >> wchar_t tmp[MAX_PATH]; >> swprintf_s(tmp, MAX_PATH, _T("%sData\\Inventory.xsd"), >> theApp.szAppDirectory); >> parser->loadGrammar (tmp, ::xercesc::Grammar::SchemaGrammarType, >> true); >> parser->setFeature >> (::xercesc::XMLUni::fgXercesUseCachedGrammarInParse, true); >> >> Am I missing something here? > > I don't see anything wrong with the above line. You may want to double > check that you have included all the necessary headers (you can copy > them from the performance example). > > >> I am planning to add other documents to this part of the program once I >> am satisfied with the operation of this part. These will be smaller >> documents. The validation is doing some form of type-checking on my xml >> document isnt it? If this is the case then I would prefer not to turn it >> off. As I intend to use this as a database, extra type checking is always >> a good thing in my opinion. > > Schema validation makes sure that your documents conform to the > constraints > defined in XML Schema. > > >> I am yet to try expat, would like to exhaust all possible avenues within >> xerces before i try something new. >> >> During recompilation of the xerces library under visual studio 2010 I >> encountered a load of warnings that I would like to check with you. > > You can ignore all of them, they are harmless. > > Boris > > > [The rest of the email foolows for context]. > >> First off, within XSValueTest there were some lines like these >> >> #if SIZEOF_LONG == 8 >> XSValue::XSValue_Data act_v_ran64_v_1; act_v_ran64_v_1.fValue.f_long = >> (long)+9223372036854775807; >> XSValue::XSValue_Data act_v_ran64_v_2; act_v_ran64_v_2.fValue.f_long = >> (long)-9223372036854775808; >> #endif >> XSValue::XSValue_Data act_v_ran32_v_1; act_v_ran32_v_1.fValue.f_long = >> (long)+2147483647; >> XSValue::XSValue_Data act_v_ran32_v_2; act_v_ran32_v_2.fValue.f_long = >> (long)-2147483648; >> >> The compiler was giving warnings about the unary minus operator being >> used on a unsigned type ((long)-2147483648). I changed these lines to the >> following >> >> #if SIZEOF_LONG == 8 >> XSValue::XSValue_Data act_v_ran64_v_1; act_v_ran64_v_1.fValue.f_long = >> _I64_MAX; >> XSValue::XSValue_Data act_v_ran64_v_2; act_v_ran64_v_2.fValue.f_long = >> _I64_MIN; >> #endif >> XSValue::XSValue_Data act_v_ran32_v_1; act_v_ran32_v_1.fValue.f_long = >> LONG_MAX; >> XSValue::XSValue_Data act_v_ran32_v_2; act_v_ran32_v_2.fValue.f_long = >> LONG_MIN; >> >> The values of LONG_MAX/MIN and _I64_MAX are still the same as the >> hard-coded values originally there. >> >> The other warning was about " 'this' : used in base member initializer >> list " after a little research on the matter it looked as though the >> behaviour would be ok as long as the 'this' pointer wasnt derefenced >> until after all construction had been completed. I added a >> >> #pragma warning(disable:4355) >> >> to disable that warning. Here is an example of this warning >> >> DOMDocumentImpl::DOMDocumentImpl(DOMImplementation* domImpl, >> MemoryManager* const manager) >> : fNode(this), // These two lines >> fParent(this), // generate this warning >> fNodeIDMap(0), >> fInputEncoding(0), >> fXmlEncoding(0), >> fXmlStandalone(false), >> fXmlVersion(0), >> fDocumentURI(0), >> fDOMConfiguration(0), >> fUserDataTableKeys(17, manager), >> fUserDataTable(0), >> fCurrentBlock(0), >> fFreePtr(0), >> fFreeBytesRemaining(0), >> fHeapAllocSize(kInitialHeapAllocSize), >> fRecycleNodePtr(0), >> fRecycleBufferPtr(0), >> fNodeListPool(0), >> fDocType(0), >> fDocElement(0), >> fNameTableSize(257), >> fNormalizer(0), >> fRanges(0), >> fNodeIterators(0), >> fMemoryManager(manager), >> fDOMImplementation(domImpl), >> fChanges(0), >> errorChecking(true) >> { >> fNameTable = (DOMStringPoolEntry**)allocate ( >> sizeof (DOMStringPoolEntry*) * fNameTableSize); >> for (XMLSize_t i = 0; i < fNameTableSize; i++) >> fNameTable[i] = 0; >> } >> >> Are those actions in line with what should be happening within the >> program? >> > From fengtr at gmail.com Fri Feb 19 23:43:09 2010 From: fengtr at gmail.com (Feng Tony) Date: Mon Feb 22 01:52:28 2010 Subject: [xsd-users] Problem with parsing xml documents containing Chinese characters Message-ID: Hi, How can I use xsd to parse xml documents containing Chinese characters? I use "char" char type. If wchar_t was used, the element "" in xml schema will be generated as L"\xB0""C" and the compiler complains: 1>.\SCL_Enums.cxx(5246) : error C2308: concatenating mismatched strings 1> Concatenating wide "?" with narrow "C" My project is to parse xml documents conform to IEC61850-6 standard, and my environment is vs9.0, win7 x64 English version with Chinese supported,xcerse3.0.1, xsd3.2.0. Thanks in advance T.J.Feng From boris at codesynthesis.com Mon Feb 22 09:31:04 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Feb 22 09:21:52 2010 Subject: [xsd-users] Compiling to multiple DLLs, duplicate symbols problem In-Reply-To: References: Message-ID: Hi Greg, Greg Carter writes: > Ideally I'll end up applying your fix, as removing the > --extern-xml-schema option is a manual process (I have to put it back in > to get a proper build for Windows)... when you have a fix let me know > and I'll try it out. Here is the binary for you to try: http://www.codesynthesis.com/~boris/tmp/xsd-3.3.0.b2-i686-windows.zip You can enable all the export options again and when compiling on Linux define the XSD_NO_EXPORT macro. To support this feature I had to do some reorganization in the way --export-xml-schema is handled. It would be great if you could give it a try on your schemas to make sure everything is working on both Windows and Linux. Let me know how it goes. Boris From boris at codesynthesis.com Mon Feb 22 09:37:27 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Feb 22 09:28:09 2010 Subject: [xsd-users] Problem with parsing xml documents containing Chinese characters In-Reply-To: References: Message-ID: Hi Tony, Feng Tony writes: > How can I use xsd to parse xml documents containing Chinese characters? > I use "char" char type. In this case Chinese characters will be encoded in UTF-8. > If wchar_t was used, the element "" in xml > schema will be generated as L"\xB0""C" and the compiler complains: > 1>.\SCL_Enums.cxx(5246) : error C2308: concatenating mismatched strings > 1> Concatenating wide "?" with narrow "C" Hm, that's a bug in XSD. Thanks for reporting it. I have fixed it for the upcoming 3.3.0 release. Can you download this pre-release binary and see if it helps: http://www.codesynthesis.com/~boris/tmp/xsd-3.3.0.b2-i686-windows.zip > My project is to parse xml documents conform to IEC61850-6 standard We have tested this schema with XSD (with --char-type char) and everything appears to be working fine. Boris From boris at codesynthesis.com Mon Feb 22 09:45:40 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Feb 22 09:36:24 2010 Subject: [xsd-users] Returning data by criteria In-Reply-To: References: <2006DFD341D34B998157BCA52B56058E@Panda> <730BD747870C4ADC829D799CDF8A710A@Panda> Message-ID: Hi Bidski, Bidski writes: > Hi Boris, > > What I was missing in the code to pre-load the schema file was a call to > ::xercesc::XMLPlatformUtils::Initialize();. Apparently this is needed for > the calls to SAX2XMLReader. Yes, also don't forget to call xercesc::XMLPlatformUtils::Terminate(); at the end of your main(). > The problem I have now are memory leaks. Looks to be as though I have 1 > memory leak for each for schema/xml file. Can you point me in the > direction of any specific clean-up calls that I need to make to the > xerces library? I found that I was getting a fairly substantial memory > leak from the SAX2XMLReader which was resolved with a call to > ~SAX2XMLReader();, but I am at a loss to what is causing these other > memory leaks and Visual Studio is not giving me much to go on. Following > is an example of one of the memory leaks I am getting. > > Detected memory leaks! > Dumping objects -> > {7541} normal block at 0x00727CA0, 148 bytes long. > Data: 48 DC 6B 00 CD CD CD CD 84 7A 1E 12 90 7E 1E 12 > > Any thoughts? It is hard to say specifically what might be the cause since this dump is not very helpful. I suggest that you try one of the following: 1. Get a proper memory profiling tool. I am not sure what would be a good choice for Windows. On Linux/UNIX, valgrind works very well. 2. Try to model your code after the 'performance' example. This example does pretty much the same thing as your application when it comes to XML parsing and, as far as I know, doesn't have any memory leaks (you can actually double-check this and if you see a leak there too then the problem must be Windows-specific and is probably in Xerces-C++). Boris From bidski at bigpond.net.au Tue Feb 23 04:28:36 2010 From: bidski at bigpond.net.au (Bidski) Date: Tue Feb 23 04:28:42 2010 Subject: [xsd-users] Returning data by criteria In-Reply-To: References: <2006DFD341D34B998157BCA52B56058E@Panda> <730BD747870C4ADC829D799CDF8A710A@Panda> Message-ID: <4A0A521986714C6F8E9DBF71F193C30D@Panda> Hi Boris, I cant even compile the performance example on my pc, for a number of reasons. 1) Cant open the file with ios_base::failbit); set. 2) Apparently 4,294,967,295 bytes is an invalid allocation size, so therefore I am unable to allocate the memory for the char pointer. (using file test5k.xml) Still looking for a memory profiling tool..... Bidski -------------------------------------------------- From: "Boris Kolpackov" Sent: Tuesday, February 23, 2010 1:45 AM To: "Bidski" Cc: Subject: Re: [xsd-users] Returning data by criteria > Hi Bidski, > > Bidski writes: > >> Hi Boris, >> >> What I was missing in the code to pre-load the schema file was a call to >> ::xercesc::XMLPlatformUtils::Initialize();. Apparently this is needed for >> the calls to SAX2XMLReader. > > Yes, also don't forget to call xercesc::XMLPlatformUtils::Terminate(); > at the end of your main(). > > >> The problem I have now are memory leaks. Looks to be as though I have 1 >> memory leak for each for schema/xml file. Can you point me in the >> direction of any specific clean-up calls that I need to make to the >> xerces library? I found that I was getting a fairly substantial memory >> leak from the SAX2XMLReader which was resolved with a call to >> ~SAX2XMLReader();, but I am at a loss to what is causing these other >> memory leaks and Visual Studio is not giving me much to go on. Following >> is an example of one of the memory leaks I am getting. >> >> Detected memory leaks! >> Dumping objects -> >> {7541} normal block at 0x00727CA0, 148 bytes long. >> Data: 48 DC 6B 00 CD CD CD CD 84 7A 1E 12 90 7E 1E 12 >> >> Any thoughts? > > It is hard to say specifically what might be the cause since this dump > is not very helpful. I suggest that you try one of the following: > > 1. Get a proper memory profiling tool. I am not sure what would be a > good choice for Windows. On Linux/UNIX, valgrind works very well. > > 2. Try to model your code after the 'performance' example. This example > does pretty much the same thing as your application when it comes > to XML parsing and, as far as I know, doesn't have any memory leaks > (you can actually double-check this and if you see a leak there too > then the problem must be Windows-specific and is probably in > Xerces-C++). > > Boris > From boris at codesynthesis.com Tue Feb 23 06:08:23 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Feb 23 05:58:57 2010 Subject: [xsd-users] Removal of support for outdated compilers/libraries in XSD 4.0.0 Message-ID: Hi, In the next major release of XSD (XSD 4.0.0) we are planning to remove support for the following outdated C++ compilers and libraries: * Xerces-C++ 2.8.0 and earlier. * VC++ 7.1 (.NET 2003) on Windows. * HP aCC A.03.x on HP-UX/PA-RISC. * Lack of support for reset() and proper return semantics in std::auto_ptr (affects some older IBM XL C++ compiler versions). * Boost versions earlier than 1.40.0. * Oracle/Berkeley DB XML integration (currently XSD is not working with newer versions of DB XML and there is no easy way to fix this). If you have any concerns about any of the above items, please let us know. Boris From julienkhong at yahoo.fr Thu Feb 25 10:20:34 2010 From: julienkhong at yahoo.fr (Julien KHONG) Date: Thu Feb 25 10:20:45 2010 Subject: [xsd-users] Serialization and accent Message-ID: <253605.48636.qm@web23108.mail.ird.yahoo.com> Hi all When i try to serialize the value "syst?me" to a file, i get an exception CharsetTest ct("syst?me"); std::ostringstream oss; CharsetTest_ (oss, ct, ::xml_schema::NamespaceInfomap (), "UTF-8", xml_schema::Flags::dont_validate); // exception raised here all is ok when i load a file with the value std::auto_ptr pCharset (CharsetTest_("CharsetTest.xml", ::xml_schema::Flags::dont_validate)); here is the xsd ? ??? ????? ??????? ????? ??? ? and options to generate cpp files cxx-tree --generate-serialization --generate-polymorphic --type-naming ucc --namespace-map =DataFiles --hxx-suffix .h --cxx-suffix .cpp From boris at codesynthesis.com Fri Feb 26 03:01:40 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Feb 26 02:52:17 2010 Subject: [xsd-users] Serialization and accent In-Reply-To: <253605.48636.qm@web23108.mail.ird.yahoo.com> References: <253605.48636.qm@web23108.mail.ird.yahoo.com> Message-ID: Hi Julien, Julien KHONG writes: > When i try to serialize the value "syst?me" to a file, i get an exception > > CharsetTest ct("syst?me"); By default the character data in the object model is encoded in UTF-8. That is, when an XML file is parsed into the object model, all the text data is converted to UTF-8. Similarly, when the object model is serialized to XML, the text data is expected to be in UTF-8. So the '?' letter has to be represented as a two-byte pair: CharsetTest ct("syst\xC3\xA8me"); Alternatively, you cat upgrade to XSD 3.3.0.b1 (see the download page[1], the final release should be out mid-March) which not provides the --char-encoding option. If you specify: --char-encoding iso8859-1 Then your code should work without any modifications. [1] http://www.codesynthesis.com/products/xsd/download.xhtml Boris From bschindler at inf.ethz.ch Fri Feb 26 09:19:16 2010 From: bschindler at inf.ethz.ch (Benjamin Schindler) Date: Fri Feb 26 09:19:24 2010 Subject: [xsd-users] default value xsd and parsing Message-ID: <4B87D864.9090603@inf.ethz.ch> Hi I have the following thing I'd like to achieve: (I tried the same with xs:all instead of sequence) When I get an xml that doesn't have the port attribute, validating the xml fails. But I'd expect that I get an object without the xsd::Optional template which has the default value 5454 if the xml does not have it. Is this somehow possible? Benjamin From boris at codesynthesis.com Fri Feb 26 10:06:42 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Feb 26 09:57:19 2010 Subject: [xsd-users] default value xsd and parsing In-Reply-To: <4B87D864.9090603@inf.ethz.ch> References: <4B87D864.9090603@inf.ethz.ch> Message-ID: Hi Benjamin, Benjamin Schindler writes: > I have the following thing I'd like to achieve: > > > > > > > > (I tried the same with xs:all instead of sequence) > > When I get an xml that doesn't have the port attribute, validating the > xml fails. But I'd expect that I get an object without the xsd::Optional > template which has the default value 5454 if the xml does not have it. While you say "port attribute", in the schema you have an element and that makes all the difference. The XML Schema spec says that for an element to get a default value, an empty element should be present in XML, as in: In other words, omitting an element from the XML completely doesn't result in it having a default value. Rather, if this element is optional, it is treated as no being present and if it is required, as in your case, then you will get a validation error. This behavior makes attributes with default value an odd construct which is not used much. On the other hands, for attributes, the default value is used if the attribute is not present, and this is used a lot in schemas. There is a table in Appendix A, in the C++/Tree Mapping User Manual which summarizes the differences between default values for elements and attributes: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#A Boris From boris at codesynthesis.com Fri Feb 26 10:25:43 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Feb 26 10:16:23 2010 Subject: [xsd-users] Problem with parsing xml documents containing Chinese characters In-Reply-To: References: Message-ID: Hi Tony, In the future please keep your replies CC'ed to the xsd-users mailing list as discussed in the posting guidelines: http://www.codesynthesis.com/support/posting-guidelines.xhtml Feng Tony writes: > Hi Boris, > Thanks for your excellent work.The xsd-3.3.0.b2-i686-windows version works > fine with wchar_t option. Glad to hear that. > But I still have some questions: > 1. "In this case Chinese characters will be encoded in UTF-8." > Did you mean that the Chinese characters will be encoded in UTF-8 when I > used MBCS character set in my project? That's correct. The character encoding used in the object model is independent of the operating system code page (except for one case, see below). > Then if I want to assign the string to variables of char* type and display > them in screen,how can I do it perfectly? There are several ways to do this. 1. You can use WideCharToMultiByte/MultiByteToWideChar with CP_UTF8 to manually convert between UTF-8 and the current code page (this is Windows-specific). 2. You can try to use the Xerces-C++ "local code page" encoding for the object model. Chances are everything will work out of the box automatically. To do this, I suggest that you download XSD 3.3.0.b1 (see the download page[1]) and pass '--char-encoding lcp' option when compiling your schemas. Then you should be able to simply do: const char* s = foo->name ().c_str (); > 2.What is the correct method to extract a name or a desc string and assign > it to a string instance or a char* variable? > Is the following code correct? > if (it->desc().present()) > { > tc.InsertItem(it->desc().get().c_str(), m_hIED); > } Yes, looks about right, if you are using the second (lcp) approach. > I thank if there is one overload member function like this(pseudo code): > tDescType & operator=( const TCHAR* ) {} > then it will be perfect, doesn't it? :) I am not sure I understand this part. Where do you expect such an operator to be define? [1] http://www.codesynthesis.com/products/xsd/download.xhtml Boris > > I am sorry for my poor expressions! > > Best regards > > Tony From bschindler at inf.ethz.ch Fri Feb 26 10:17:36 2010 From: bschindler at inf.ethz.ch (Benjamin Schindler) Date: Fri Feb 26 10:17:23 2010 Subject: [xsd-users] default value xsd and parsing In-Reply-To: References: <4B87D864.9090603@inf.ethz.ch> Message-ID: <4B87E610.5030401@inf.ethz.ch> Thank you a lot for the thorough answer. This cleared everything up Benjamin On 02/26/2010 04:06 PM, Boris Kolpackov wrote: > Hi Benjamin, > > Benjamin Schindler writes: > >> I have the following thing I'd like to achieve: >> >> >> >> >> >> >> >> (I tried the same with xs:all instead of sequence) >> >> When I get an xml that doesn't have the port attribute, validating the >> xml fails. But I'd expect that I get an object without the xsd::Optional >> template which has the default value 5454 if the xml does not have it. > > While you say "port attribute", in the schema you have an element and > that makes all the difference. The XML Schema spec says that for an > element to get a default value, an empty element should be present > in XML, as in: > > > > In other words, omitting an element from the XML completely doesn't > result in it having a default value. Rather, if this element is > optional, it is treated as no being present and if it is required, > as in your case, then you will get a validation error. This behavior > makes attributes with default value an odd construct which is not > used much. > > On the other hands, for attributes, the default value is used if the > attribute is not present, and this is used a lot in schemas. > > There is a table in Appendix A, in the C++/Tree Mapping User Manual > which summarizes the differences between default values for elements > and attributes: > > http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#A > > Boris From boris at codesynthesis.com Fri Feb 26 11:42:04 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Feb 26 11:32:40 2010 Subject: [xsd-users] Returning data by criteria In-Reply-To: <4A0A521986714C6F8E9DBF71F193C30D@Panda> References: <2006DFD341D34B998157BCA52B56058E@Panda> <730BD747870C4ADC829D799CDF8A710A@Panda> <4A0A521986714C6F8E9DBF71F193C30D@Panda> Message-ID: Hi Bidski, Bidski writes: > I cant even compile the performance example on my pc, for a number of > reasons. > > 1) Cant open the file with ios_base::failbit); set. > > 2) Apparently 4,294,967,295 bytes is an invalid allocation size, so > therefore I am unable to allocate the memory for the char pointer. (using > file test5k.xml) Those don't sound like compilation errors, rather the runtime ones (if they were indeed compilation errors, can you should the compiler diagnostics). I also tried to build and run this example using VC++ 2010 RC1 with Xerces-C++ 3.1.0 and XSD 3.3.0.b1. Everything builds and runs without any problems. Boris