From jrs at jmsutton.co.uk Fri Oct 1 05:26:08 2010 From: jrs at jmsutton.co.uk (James Sutton) Date: Fri Oct 1 08:55:59 2010 Subject: [xsde-users] Unwanted validation Message-ID: <6F7024B4-9122-4AD5-8420-BA05A4EDC584@jmsutton.co.uk> Hi Codesynthesis, I would like to provide a list of titles of my (large) MusicXML files, which can be obtained by parsing just a few small elements. Currently it has to parse and validate each entire file just to get this information, and it is very slow. I tried switching off validation, but it gives an error when generating the code from the schema: error: complex type 'dynamics' contains choice compositor error: parser validation is required to handle this construct. also it seems that must be decided at build time, so, since I will need validation for reading the full files, I must also have validation when I don't want it. Why can't I decide at runtime ? I am struggling to hand-edit the generated code to remove all the unwanted parsers (for notes etc) for the titles-only version, after reading in the documentation that this is possible. Is this going to work or am I wasting my time? At the moment the validator is complaining and refusing to read the file at all, but this could be because I have made an error. I can't help feeling that if I remove parsers it's going to think that unparsed elements must be invalid, so this approach is doomed. regards James Sutton From jrs at jmsutton.co.uk Fri Oct 1 07:11:00 2010 From: jrs at jmsutton.co.uk (James Sutton) Date: Fri Oct 1 08:55:59 2010 Subject: [xsde-users] Fwd: Unwanted validation References: <6F7024B4-9122-4AD5-8420-BA05A4EDC584@jmsutton.co.uk> Message-ID: <44E7ED67-21CA-4B51-AA5A-43D82346E596@jmsutton.co.uk> - just a quick update.. The hand-edited code (removed parsers to read only the title) does work now and is 4X faster, which is a great help Thanks James Begin forwarded message: > From: James Sutton > Date: 1 October, 2010 10:26:08 GMT+01:00 > To: xsde-users@codesynthesis.com > Subject: Unwanted validation > > Hi Codesynthesis, > > > I would like to provide a list of titles of my (large) MusicXML files, which can be obtained by parsing just a few small elements. Currently it has to parse and validate each entire file just to get this information, and it is very slow. > > I tried switching off validation, but it gives an error when generating the code from the schema: > > error: complex type 'dynamics' contains choice compositor > error: parser validation is required to handle this construct. > > also it seems that must be decided at build time, so, since I will need validation for reading the full files, I must also have validation when I don't want it. Why can't I decide at runtime ? > I am struggling to hand-edit the generated code to remove all the unwanted parsers (for notes etc) for the titles-only version, after reading in the documentation that this is possible. Is this going to work or am I wasting my time? At the moment the validator is complaining and refusing to read the file at all, but this could be because I have made an error. I can't help feeling that if I remove parsers it's going to think that unparsed elements must be invalid, so this approach is doomed. > > > > regards > James Sutton > From boris at codesynthesis.com Mon Oct 4 07:46:25 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Oct 4 07:34:38 2010 Subject: [xsde-users] Unwanted validation In-Reply-To: <6F7024B4-9122-4AD5-8420-BA05A4EDC584@jmsutton.co.uk> References: <6F7024B4-9122-4AD5-8420-BA05A4EDC584@jmsutton.co.uk> Message-ID: Hi Jamesm James Sutton writes: > I would like to provide a list of titles of my (large) MusicXML files, > which can be obtained by parsing just a few small elements. Currently > it has to parse and validate each entire file just to get this information, > and it is very slow. Can you quantify the "vary slow" part? How big is the file, how long does it take to parse, and what kind of hardware are you using? > also it seems that must be decided at build time, so, since I will need > validation for reading the full files, I must also have validation when > I don't want it. Why can't I decide at runtime ? That would make parsing slower. > I am struggling to hand-edit the generated code to remove all the unwanted > parsers (for notes etc) for the titles-only version, after reading in the > documentation that this is possible. Is this going to work or am I wasting > my time? Yes, that's exactly how you should do it, except for the hand-editing the generated code part. Rather, you should copy the generated aggregate class and remove any parsers that you don't need. > I can't help feeling that if I remove parsers it's going to think that > unparsed elements must be invalid, so this approach is doomed. No, if you don't provide a parser, the corresponding XML fragment will be silently ignored, whether valid or not. Boris From boris at codesynthesis.com Thu Oct 7 08:54:16 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Oct 7 08:42:14 2010 Subject: [xsde-users] memory management of "variable length" elements In-Reply-To: References: <614640443.1482391283879986542.JavaMail.root@zimbra36-e6.priv.proxad.net> <833352866.1482611283880284116.JavaMail.root@zimbra36-e6.priv.proxad.net> Message-ID: Hi Ivan, Boris Kolpackov writes: > > 2) allow deep copy of some user-listed VL types. > > That's on the TODO for the next release. There will be an option to > request generating of copy constructors/clone functions for var-length > types. This functionality is ready. Let me know if you (or anyone else) would like to give it a try with a pre-release binary. Boris From boris at codesynthesis.com Tue Oct 19 10:24:30 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Oct 19 10:13:57 2010 Subject: [xsde-users] XSD/e 3.2.0 beta1 released Message-ID: Hi, We have released the first and hopefully the only beta for XSD/e 3.2.0. The final release is planned for the beginning of November. Besides the new major features described below, this release includes a large number of small improvements, bug fixes, and optimizations. I encourage everyone to test this beta, especially if you are planning to upgrade. The NEWS file entries for 3.2.0.b1 are as follows: * Support for ISO-8859-1 in addition to UTF-8 as application encoding. Note that this encoding is not the same as the XML document encoding that is being parsed or serialized. Rather, it is the encoding that is used inside the application. When an XML document is parsed, the character data is automatically converted to the application encoding. Similarly, when an XML document is serialized, the data in the application encoding is automatically converted to the resulting document encoding. To select a particular encoding, configure the XSD/e runtime library accordingly and pass the --char-encoding option to the XSD/e compiler when translating your schemas. * Support for custom allocators. This feature allows you to configure the XSD/e runtime and generated code to perform memory management using custom allocator functions provided by your application instead of the standard operator new/delete. For more information, see Section 3.8, "Custom Allocators" in the C++/Hybrid Mapping Getting Started Guide (equivalent documentation is provided for other mappings) as well as the 'allocator' example in the examples/cxx/hybrid/ directory. * When built with Xerces-C++ 3-series, enable handling of multiple imports for the same namespace. Before, all subsequent imports for a namespace were ignored which caused errors in some schemas. * Automatic mapping for the urn-style XML namespaces. The last component in the urn name is used to derive the C++ namespace name. * New option, --schema-file-regex, in combination with the existing --type-file-regex, can be used to place the generated files into subdirectories or to resolve file name conflicts in the file-per- type mode (--file-per-type). * Strings used to match regular expression supplied with the --namespace-regex and --anonymous-regex options now include the file component for the schema being compiled. C++/Hybrid * String-based types that use XML Schema restriction by enumeration are now mapped to C++ classes with semantics similar to C++ enum. You can suppress this new mapping and instead get the old behavior (plain inheritance) by specifying the --suppress-enum compiler option. See Section 4.3, "Enumerations" in the Getting Started Guide for more information. * New option, --generate-clone, triggers the generation of clone functions for variable-length types. These functions allow you to make dynamically- allocated copies of variable-length objects. * Support for schema evolution using substitution groups. The 'ignore' and 'passthrough' examples in the examples/cxx/hybrid/evolution/ directory show how the new mechanism work. The 'ignore' example shows how to ignore unknown elements. The 'passthrough' example shows how to pass the unknown content through parsing and serialization so that the output XML contains all the unknown elements. * The anySimpleType build-in type is now mapped to std::string or a C-string, depending on whether STL is enabled or not. * New mapping for anyType with support for polymorphism. For more information, see Section 5.14, "Mapping for anyType" in the Embedded C++/Hybrid Mapping Getting Started Guide. * The object model interface for optional members of variable-length types now omits the _present modifier function. This is done to help detect programming errors that result from a type becoming variable- length due to schema changes. To reset such optional members you can call the member modifier function with NULL as its argument. * New configuration parameter, XSDE_STL_ITERATOR, makes iterators provided by the mapping conform to the STL requirements. This feature requires working header and allows you to use the standard algorithms such as find_if, etc. * When the code is generated with the --generate-polymorphic or --runtime-polymorphic option, the resulting parser and serializer aggregate classes provide the static polymorphic() function which returns true if the object model corresponding to the root element or root type is polymorphic and false otherwise. This can be used together with the XSDE_POLYMORPHIC macro to implement generic parsing and serialization code that works with both polymorphic and non- polymorphic object models. * XML Schema union types with members that are enumeration types are automatically converted to equivalent enumeration types with a union of all the member's enumerators. C++/Parser * Support for the following XML Schema facets: String-based types: - length - minLength - maxLength - pattern - whiteSpace - enumeration Integer and floating-point types: - minExclusive - minInclusive - maxExclusive - maxInclusive For more information on the pattern facet validation, see the XSDE_REGEXP parameter in the configuration files. * The anySimpleType build-in type is now mapped to std::string or a C-string, depending on whether STL is enabled or not. C++/Serializer * Support for the following XML Schema facets: String-based types: - length - minLength - maxLength - pattern - enumeration Integer and floating-point types: - minExclusive - minInclusive - maxExclusive - maxInclusive For more information on the pattern facet validation, see the XSDE_REGEXP parameter in the configuration files. * The anySimpleType build-in type is now mapped to std::string or a C-string, depending on whether STL is enabled or not. Precompiled binary distributions for 3.2.0.b1 are available from the product's download page: http://www.codesynthesis.com/products/xsde/download.xhtml Source code for this release is available from the project's web page: http://www.codesynthesis.com/projects/xsde/ SHA1 checksums for the files: 64a0c7988a1c7c154964ba40c0e734c2ef071ec7 xsde-3.2.0.b1.tar.bz2 6c8c7f6a991e3a50098556ce8daf3ddcee1019fb xsde-3.2.0.b1+dep.tar.bz2 7ee412f680a8a439b00683155d3c48951d8db273 xsde-3.2.0.b1-i686-linux-gnu.tar.bz2 77b8c16ae0c0e4e95abde740e845a913de8853ec xsde-3.2.0.b1-x86_64-linux-gnu.tar.bz2 2e57d533adf05b102e812239ccf546ee6e1c051e xsde-3.2.0.b1-i686-macosx.tar.bz2 9fa4e25c06313afa0a8f93fffd365c511a0786fc xsde-3.2.0.b1-i686-windows.zip Enjoy, Boris