From boris at codesynthesis.com Tue Aug 3 09:31:20 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Aug 3 09:23:41 2010 Subject: [xsd-users] Free proprietary license for small XML vocabularies Message-ID: Hi, We have introduced a free proprietary license for XSD. The new license allows you to use the generated code to handle small XML vocabularies in proprietary (closed-source) applications free of charge and without having to publish your source code. The license allows you to target any number of platforms and upgrade to any future releases of XSD. It comes with best-effort, community support via the xsd-users mailing list. For more information as well as for answers to common questions about the new license visit the Free Proprietary License page: http://www.codesynthesis.com/products/xsd/free-license.xhtml Enjoy, Boris From rc.mail.dev at gmail.com Fri Aug 6 00:19:36 2010 From: rc.mail.dev at gmail.com (Romain) Date: Fri Aug 6 00:19:40 2010 Subject: [xsd-users] Parsing and validation from CDR stream In-Reply-To: References: Message-ID: Hi, Sorry for the late reply. The scenario you have described is correct. One part of my application serializes C++ data to CDR. For what I understand, there is no validation at this stage. The other part of my application receives the CDR data, deserializes the CDR to C++ data (also no validation at that stage correct?). That's why I need the validation, because there might be some invalid data (boundaries errors, etc.). Any other suggestions on how I could handle this case? Thank you. Regards, Romain On Fri, Jul 23, 2010 at 9:46 PM, Boris Kolpackov wrote: > Hi Romain, > > Romain writes: > > > std::auto_ptr r = root ("root.xml"); > > > > // Save to a CDR stream. > > // > > ACE_OutputCDR ace_ocdr; > > xml_schema::ostream ocdr (ace_ocdr); > > > > ocdr << *r; > > > > // Load from a CDR stream. > > // > > ACE_InputCDR ace_icdr (buf, size); > > xml_schema::istream icdr (ace_icdr); > > > > std::auto_ptr copy (new object (icdr)); > > > > Is it possible to parse and validate the XML message after loading > > from the CDR stream? > > I am not sure what you mean by parse and validate in this context. > The object model extracted from CDR ('copy' in this case), is > already parsed (in XML sense). That is, it is equivalent to 'r' > in the above example. You also don't normally need to validate > this object model since, unlike XML, the CDR representation is > constructed by the generated code and is valid provided you have > serialized a valid object model in the first place. > > The only scenario that I can think of that may make you want to > validate the object model after extraction from CDR is if you are > not sure the original object model that was saved to CDR was valid > (for example, it was created by the application or you disabled > validation during XML parsing). In this case the only way to validate > the data is to serialize it in XML into an in-memory buffer and > then re-parse it with validation. Something along these lines: > > std::stringstream buf; > root (buf, *copy, map); // map specified schema > copy = root (buf, "tmp.xml"); // tmp.xml name for diagnostics > > Boris > From boris at codesynthesis.com Fri Aug 6 09:24:16 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Aug 6 09:15:58 2010 Subject: [xsd-users] Parsing and validation from CDR stream In-Reply-To: References: Message-ID: Hi Romain, Romain writes: > One part of my application serializes C++ data to CDR. For what I > understand, there is no validation at this stage. That's correct. > The other part of my application receives the CDR data, deserializes the CDR > to C++ data (also no validation at that stage correct?). Also correct. > That's why I need the validation, because there might be some invalid data > (boundaries errors, etc.). Just to clarify, there cannot be CDR-related errors (that's what I assume you refer to by "boundaries errors") since the CDR insertion/extraction code is auto-generated from a valid schema. If you detect such errors then that means there is a bug in the XSD compiler. You can get an invalid object model after extracting it from CDR only if the object model that was saved to CDR on the other end was already invalid (e.g., an invalid XML file was parsed with validation disabled or an invalid object model was created programmatically). > Any other suggestions on how I could handle this case? If you still need to validate the result of the CDR extraction then the only way is to serialize the object model to XML and then re- parse it with validation, as outlined in my previous email. If this doesn't work for you then you can take a look at the C++/Hybrid mapping in XSD/e[1]. It also supports CDR streams and you can validate the object model during parsing and serialization. The idea is to run a validating serializer on the object model with no-op writer implementation. [1] http://www.codesynthesis.com/products/xsde/ Boris From tom.richard.evensen at kongsberg.com Mon Aug 9 05:59:03 2010 From: tom.richard.evensen at kongsberg.com (Tom Richard Evensen) Date: Mon Aug 9 06:19:13 2010 Subject: [xsd-users] Evaluating XSD - XML format question Message-ID: Hi, We are currently evaluating XSD. While playing with the XSD-generated code in a test project, I came across an issue that I'm sure you can answer easily. I have a schema like this The generated code is able read XML-files with this content but not with this content 1000 15 12345678 123456 When trying to read the second version, I get two errors for each line telling me that "no character data is allowed by content model", and "no declaration found for element p?" (substitute ? with 1..4). In addition it tells me that "element p1 is not allowed for content model EMPTY". Shouldn't these to data representations be the same? What am I missing, or what am I doing wrong? I'm using the xsd-tree customization build in VS2010, and setting the property no_namespace_schema_location to the xsd-file above. Kind regards, Tom R. Evensen From bwvb at xs4all.nl Mon Aug 9 07:26:05 2010 From: bwvb at xs4all.nl (B.W.H. van Beest) Date: Mon Aug 9 07:26:09 2010 Subject: [xsd-users] Evaluating XSD - XML format question In-Reply-To: References: Message-ID: <4C5FE5CD.2020000@xs4all.nl> Your are confusing the concept of an attribute (of the element (p1="1000" etc)) with that of a (sub)element. In your xsd-schema, only has attributes. There are no xsd:elements defined in the complexType "MyMessageType" Bertwim Tom Richard Evensen wrote: > Hi, > > We are currently evaluating XSD. > While playing with the XSD-generated code in a test project, I came across an issue that I'm sure > you can answer easily. > > I have a schema like this > > > > > > > > > > > > > > The generated code is able read XML-files with this content > > > > > > but not with this content > > > > 1000 > 15 > 12345678 > 123456 > > > > > When trying to read the second version, I get two errors for each line telling me that "no character > data is allowed by content model", and "no declaration found for element p?" (substitute ? with > 1..4). > In addition it tells me that "element p1 is not allowed for content model EMPTY". > > Shouldn't these to data representations be the same? > What am I missing, or what am I doing wrong? > > I'm using the xsd-tree customization build in VS2010, and setting the property > no_namespace_schema_location to the xsd-file above. > > > Kind regards, > Tom R. Evensen > > From boris at codesynthesis.com Mon Aug 9 09:52:59 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Aug 9 09:44:03 2010 Subject: [xsd-users] Evaluating XSD - XML format question In-Reply-To: References: Message-ID: Hi Tom, To add to Bertwim's reply, if you want to allow both attributes and elements in your MyMessage element, then your schema would have to look like this: Boris From ivan.lelann at free.fr Tue Aug 10 03:09:30 2010 From: ivan.lelann at free.fr (Ivan Le Lann) Date: Tue Aug 10 03:09:39 2010 Subject: [xsd-users] Using a SAX parser in cxx-tree In-Reply-To: <720266908.242101281424014863.JavaMail.root@zimbra36-e6.priv.proxad.net> Message-ID: <1003244316.242151281424170442.JavaMail.root@zimbra36-e6.priv.proxad.net> Hi, Unless I'm missing something, there is no way to dump an XML document into a "xsd cxx-tree" generated class without first creating a Xerces DOM document. It seemed to me that cxx-tree users are paying at least twice their memory payload at object creation time. And that cpu cycles could also be spared here. After a quick look a XSD source code, I'm willing to try and implement a SAX constructor for cxx-tree classes. Before starting, I'd like to know if this attempt is : 1) useless because already present in xsd 2) useless because it won't improve memory or speed for a reason I'm missing 3) long-awaited and welcome ! :) Regards, Ivan. From boris at codesynthesis.com Tue Aug 10 08:51:12 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Aug 10 08:42:02 2010 Subject: [xsd-users] Using a SAX parser in cxx-tree In-Reply-To: <1003244316.242151281424170442.JavaMail.root@zimbra36-e6.priv.proxad.net> References: <720266908.242101281424014863.JavaMail.root@zimbra36-e6.priv.proxad.net> <1003244316.242151281424170442.JavaMail.root@zimbra36-e6.priv.proxad.net> Message-ID: Hi Ivan, Ivan Le Lann writes: > Unless I'm missing something, there is no way to dump an XML document > into a "xsd cxx-tree" generated class without first creating a Xerces > DOM document. Yes, that's correct though the generated parsing functions do this automatically. > It seemed to me that cxx-tree users are paying at least twice their > memory payload at object creation time. Yes, that's true, during parsing there is a short period of time when both the DOM document and the object model are in memory. The memory requirements, however, can be alleviated by only parsing/serializing a fragment of the object model at a time. For details, see the 'streaming' example in the examples/cxx/tree/ directory. > And that cpu cycles could also be spared here. Yes, some CPU resources are spent constructing the DOM document. While there are drawbacks to first creating the DOM document, there are also a number of features that are made possible due to this choice. In particular: 1. It is possible to (optionally) maintain bi-directional association between DOM nodes and object model nodes. This allows you to have both statically-types and "untyped" view of the document with the later being useful, for example, for generic traversal. 2. XPath support currently depends on the DOM association. 3. XML Schema wildcard (xs:any and xs:anyAttribute) content is represented as DOM fragments. 4. The DOM representation can be used to determine the root element of the document being parsed. 5. It is sometimes required to "touch up" the XML document being parsed before passing it on to the object model as well as the DOM document being serialized before saving it to XML. For example, often legacy systems produce XML without the required XML namespace declarations. One can use the intermediate DOM representation to easily fix this. > After a quick look a XSD source code, > I'm willing to try and implement a SAX constructor for cxx-tree classes. > > Before starting, I'd like to know if this attempt is : > > 1) useless because already present in xsd No, there is no support for SAX-based parsing in C++/Tree. However, there is the C++/Hybrid mapping in XSD/e[1] which is, roughly speaking, a light-weight version of C++/Tree and is based on SAX. You may want to consider this first. > 2) useless because it won't improve memory or speed for a reason I'm missing I think it will improve both memory usage and speed. > 3) long-awaited and welcome ! :) You are definitely welcome to try to implement this. However, I think an easier approach would be to first implement an "XML Reader" API on top of Xerces-C++ SAX2 using the progressive mode feature (see the 'streaming' example mention above for some ideas on how this might work). It will be much easier to use compared to the callback-based SAX since you can use it in a way very similar to how it is done now with DOM. [1] http://www.codesynthesis.com/products/xsde/ Boris From ivan.lelann at free.fr Tue Aug 10 18:38:20 2010 From: ivan.lelann at free.fr (Ivan Le Lann) Date: Tue Aug 10 18:38:29 2010 Subject: [xsd-users] Using a SAX parser in cxx-tree In-Reply-To: <178847429.272511281479531974.JavaMail.root@zimbra36-e6.priv.proxad.net> Message-ID: <174261555.272551281479900585.JavaMail.root@zimbra36-e6.priv.proxad.net> Hi Boris, Thanks for the reply. > No, there is no support for SAX-based parsing in C++/Tree. However, > there is the C++/Hybrid mapping in XSD/e[1] which is, roughly speaking, > a light-weight version of C++/Tree and is based on SAX. You may want > to consider this first. It seems I overlooked C++/Hybrid. I toyed with it, and it looks very promising. Thanks again, Ivan. From erik.sjolund at gmail.com Wed Aug 11 05:07:27 2010 From: erik.sjolund at gmail.com (=?ISO-8859-1?Q?Erik_Sj=F6lund?=) Date: Wed Aug 11 05:07:34 2010 Subject: [xsd-users] XQuery on object model Message-ID: From: http://www.codesynthesis.com/pipermail/xsd-users/2009-October/002483.html "Also, we are working on a feature for the next release of XSD which will allow you to run XPath/XQuery queries natively on the object model." It would be cool to combine these functionalities: * "hybrid" functionality ( as provided by xsd-e ). This would be for increasing the read speed. * XQuery on object model Option 1: using XSD ------------------------ It does not seem possible because "hybrid" functionality and "XQuery on object model" functionality is missing. Option 2: using XSD-E ( GPL v2 ) --------------------------- It does not seem possible because "XQuery on object model" functionality is missing. And trying to implement "XQuery on object model" functionality myself with Xqilla or Zorba ( Apache license v2 ) is not possible due to license incompatibilities. gnu.org states this regarding Apache license version 2: "Please note that this license is not compatible with GPL version 2, because it has some requirements that are not in the older version. These include certain patent termination and indemnification provisions." http://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses By the way, is it a correct analysis that it is not possible to link XSD with software licensed under GPL version 3? (The FLOSS exception is not enough I guess) Linking with XSD with software licensed under GPL version 2 should be fine, because then you don't need to use the FLOSS exception. You just use the fact that XSD is also licensed under the GPL version 2. cheers, Erik Sj?lund From boris at codesynthesis.com Wed Aug 11 09:53:57 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Aug 11 09:44:34 2010 Subject: [xsd-users] XQuery on object model In-Reply-To: References: Message-ID: Hi Erik, Erik Sj?lund writes: > It would be cool to combine these functionalities: > > * "hybrid" functionality ( as provided by xsd-e ). This would be for > increasing the read speed. The hybrid part in the C++/Hybrid mapping in XSD/e allures to the fact that this mapping can be used in a hybrid, partially in-memory, partially event-driven mode. It also happens to be fater than C++/Tree but that's not why it was called C++/Hybrid. > * XQuery on object model > > Option 1: using XSD > ------------------------ > It does not seem possible because "hybrid" functionality and "XQuery > on object model" functionality is missing. The "hybrid" use is possible with a bit of work. See the 'streaming' example in XSD 3.3.0 for more information. The XQuery part is still planned for the next major release. > Option 2: using XSD-E ( GPL v2 ) > --------------------------- > It does not seem possible because "XQuery on object model" > functionality is missing. Correct. There are also no plans to provide this functionality since XQuery is probably too heavy-weight for most mobile/embedded systems. > And trying to implement "XQuery on object model" functionality myself > with Xqilla or Zorba ( Apache license v2 ) is not possible due to > license incompatibilities. We can make an exception to the license, similar to what we have done for Xerces-C++ in XSD. > By the way, is it a correct analysis that it is not possible to link > XSD with software licensed under GPL version 3? Appears to be the case according to the GNU website. The FLOSS exception would cover this but we should probably add an explicit exception to allow linking with software licensed under any "open source" license. Boris From erik.sjolund at gmail.com Wed Aug 11 13:13:39 2010 From: erik.sjolund at gmail.com (=?ISO-8859-1?Q?Erik_Sj=F6lund?=) Date: Wed Aug 11 13:13:48 2010 Subject: [xsd-users] XQuery on object model In-Reply-To: References: Message-ID: On Wed, Aug 11, 2010 at 3:53 PM, Boris Kolpackov wrote: > The "hybrid" use is possible with a bit of work. See the 'streaming' > example in XSD 3.3.0 for more information. I was more thinking of avoiding DOM altogether. The streaming example is about creating smaller DOM trees that get translated to the object model. I guess going directly to the object model would increase the read speed. Another advantage with the XSD/e hybrid approach is that it is easier to cut out an element of a certain schema type. With the "XSD streaming example" approach it might be more difficult, especially if an element name could occur at different places in the xml tree but have different schema types. > The XQuery part is still > planned for the next major release. Great > >> And trying to implement ?"XQuery on object model" functionality myself >> with Xqilla or Zorba ( Apache license v2 ) is not possible due to >> license incompatibilities. > > We can make an exception to the license, similar to what we have > done for Xerces-C++ in XSD. Yes, that is true. >> By the way, is it a correct analysis that it is not possible to link >> XSD with software licensed under GPL version 3? > > Appears to be the case according to the GNU website. The FLOSS exception > would cover this but we should probably add an explicit exception to > allow linking with software licensed under any "open source" license. Just to clarify the thoughts I had. I think it is the GPL version 3 software that doesn't allow itself be linked to software that can't be "relicensed" to GPL version 3 ( for instance GPL version 2 software ). That would also include XSD as the FLOSS exception doesn't give permission to "relicense" XSD to GPL version 3. cheers, Erik Sj?lund From ivan.lelann at free.fr Thu Aug 12 06:01:55 2010 From: ivan.lelann at free.fr (Ivan Le Lann) Date: Thu Aug 12 06:02:05 2010 Subject: [xsd-users] Using a SAX parser in cxx-tree In-Reply-To: <1618081182.318591281607286205.JavaMail.root@zimbra36-e6.priv.proxad.net> Message-ID: <697816250.318611281607315066.JavaMail.root@zimbra36-e6.priv.proxad.net> > It seems I overlooked C++/Hybrid. > I toyed with it, and it looks very promising. I think I found a problem in XSDe library. My options are : cxx-hybrid --root-element SKWML --generate-parser --generate-serializer --generate-aggregate. I fed it with a schema with no namespace : ... And exspected the following serializing code to work : (quickly adapted from : xsde-3.1.0-i686-windows\examples\cxx\hybrid\library\driver.cxx) SKWML_saggr catalog_s; xml_schema::document_simpl doc_s ( catalog_s.root_serializer (), catalog_s.root_namespace (), catalog_s.root_name ()); //doc_s.add_prefix ("lib", "http://www.codesynthesis.com/library"); //doc_s.add_schema ("http://www.codesynthesis.com/library", "library.xsd"); catalog_s.pre (*c); std::ofstream ofs ("out.xml"); doc_s.serialize (ofs); catalog_s.post (); It gave me "illegal namespace name" genx error code. Looking at xsde-3.1.0-i686-windows\libxsde\xsde\c\genx\genx.c (line: 841, method: genxDeclareNamespace, code: "if (uri == NULL || uri[0] == 0)" ) it seems that the check on namespace argument does not match with calling code. I modified "genxStartElementLiteral", "genxAddAttributeLiteral", "genxStartAttributeLiteral" : "if (xmlns)" --> "if (xmlns && xmlns[0] != 0)" This fixed my problem. Indeed the root namespace in my case is : (in generated file *-simpl.cxx) const char* SKWML_saggr:: root_namespace () { return ""; // I tried changing this to NULL : got runtime error } Regards, Ivan. From boris at codesynthesis.com Thu Aug 12 10:33:49 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Aug 12 10:24:13 2010 Subject: [xsd-users] XQuery on object model In-Reply-To: References: Message-ID: Hi Erik, Erik Sj?lund writes: > I was more thinking of avoiding DOM altogether. There was a discussion on this just a few days ago. Please see the following post for some ideas: http://www.codesynthesis.com/pipermail/xsd-users/2010-August/002965.html > Just to clarify the thoughts I had. I think it is the GPL version 3 > software that doesn't allow itself be linked to software that can't be > "relicensed" to GPL version 3 ( for instance GPL version 2 software ). The GNU website says that it is GPLv2 that is incompatible with GPLv3: http://www.gnu.org/licenses/gpl-faq.html#v2v3Compatibility Boris From barrie.kovish at singularsoftware.com Sun Aug 15 13:55:31 2010 From: barrie.kovish at singularsoftware.com (Barrie Kovish) Date: Sun Aug 15 13:55:40 2010 Subject: [xsd-users] Complex type with mixed content Message-ID: <506A225D-2C59-4CEC-9FA7-72B954DCD664@singularsoftware.com> I've run into a case where complex mixed content is causing us some problems. I'm hoping there might be a somewhat simpler solution than having to implement a type by hand. In our case the complex mixed type is always either a simple string or a complex type but never mixed. It is however declared in the schema as complex, mixed. Here is an example of what I am talking about. The following would be 2 examples of valid XML: Here is an example of the simple case: 2000 Here is an example of a complex case: 20 2.17 The XSD definition looks like: Also we don't actually use any of the content of the element. However we do need to preserve it between reading in the XML file modifying the XML and then writing it out. Is there a simpler solution than implementing a custom type by had? Thanks, Barrie Kovish From boris at codesynthesis.com Mon Aug 16 09:33:50 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Aug 16 09:24:38 2010 Subject: [xsd-users] Complex type with mixed content In-Reply-To: <506A225D-2C59-4CEC-9FA7-72B954DCD664@singularsoftware.com> References: <506A225D-2C59-4CEC-9FA7-72B954DCD664@singularsoftware.com> Message-ID: Hi Barrie, Barrie Kovish writes: > > 2000 > > > > > 20 > > > 2.17 > > > > > > > > > > > > > Is there a simpler solution than implementing a custom type by had? No, unfortunately not. You will need to customize the 'sample' type, however, the implementation can be based on the generated version (which will handle the case where there are nested elements) with the customization simply handling the text-only case. Here is how this can be done: 1. Customize the 'sample' type so that there is also the generated version, say 'sample_base'. Inherit 'sample' from 'sample_base' and add a string member for the text content (say, text_). 2. In the parsing constructor of the 'sample' class you can do something like this: sample:: sample (const xercesc::DOMElement& e, xml_schema::flags f, xml_schema::container* c) : sample_base (e, f, c) { // Check if we've got the text-only case. // if (e.getFirstChildElement () == 0) { // xsd::cxx::tree::text_content is in // text_ = xsd::cxx::tree::text_content (e); } } 3. In the serialization operator for the 'sample' class you can do something like this: void operator<< (xercesc::DOMElement& e, const sample& x) { if (text_.empty ()) { const sample_base& b (x); e << b; } else { e.setTextContent (xml::string (text_).c_str ()); } } > Also we don't actually use any of the content of the element. > However we do need to preserve it between reading in the XML file > modifying the XML and then writing it out. In this case another alternative would be to store the content as a DOM document fragment. The 'mixed' example in the examples/cxx/tree/custom/ directory does exactly this and you can copy the code pretty much verbatim. Boris From rc.mail.dev at gmail.com Tue Aug 24 00:55:22 2010 From: rc.mail.dev at gmail.com (Romain) Date: Tue Aug 24 00:55:34 2010 Subject: [xsd-users] Parsing and validation from CDR stream In-Reply-To: References: Message-ID: Hi Boris, Thanks for your reply. Actually, I am going to use serialization with Boost Serialization (more efficient in my case). In the example given, you are using a boost::archive::text_oarchive to serialize the data: using namespace library; using boost::archive::text_oarchive; using boost::archive::text_iarchive; // Read in the file std::auto_ptr c (catalog_ (argv[1]))); cerr << *c << endl; // Save into a text archive std::ostringstream ostr; text_oarchive oa (ostr); xml_schema::ostream os (oa); os << *c; This implies that all the numeric values (int, double, float, etc.) will be stored a sequence of characters. Let's take an example: double var = 9.123456789 (number of characters/bytes = 11) However, on x86 architecture, the representation of a double is 8 bytes. Message sizing is one of my big concern. Since Boost serialization provides a binary_oarchive, I was wondering if it was possible to use this archive model with XSD? Thank you for your help. Regards, Romain On Fri, Aug 6, 2010 at 9:24 PM, Boris Kolpackov wrote: > Hi Romain, > > Romain writes: > > > One part of my application serializes C++ data to CDR. For what I > > understand, there is no validation at this stage. > > That's correct. > > > > The other part of my application receives the CDR data, deserializes the > CDR > > to C++ data (also no validation at that stage correct?). > > Also correct. > > > > That's why I need the validation, because there might be some invalid > data > > (boundaries errors, etc.). > > Just to clarify, there cannot be CDR-related errors (that's what I assume > you refer to by "boundaries errors") since the CDR insertion/extraction > code is auto-generated from a valid schema. If you detect such errors > then that means there is a bug in the XSD compiler. > > You can get an invalid object model after extracting it from CDR only if > the object model that was saved to CDR on the other end was already invalid > (e.g., an invalid XML file was parsed with validation disabled or an > invalid > object model was created programmatically). > > > > Any other suggestions on how I could handle this case? > > If you still need to validate the result of the CDR extraction then > the only way is to serialize the object model to XML and then re- > parse it with validation, as outlined in my previous email. > > If this doesn't work for you then you can take a look at the C++/Hybrid > mapping in XSD/e[1]. It also supports CDR streams and you can validate > the object model during parsing and serialization. The idea is to > run a validating serializer on the object model with no-op writer > implementation. > > [1] http://www.codesynthesis.com/products/xsde/ > > Boris > From angelo at smartrm.com Tue Aug 24 05:58:13 2010 From: angelo at smartrm.com (Angelo Difino) Date: Tue Aug 24 05:58:23 2010 Subject: [xsd-users] exporting symbols from a windows dll Message-ID: <4C7397B5.3010507@smartrm.com> Dear Boris and all, i'm having some difficulties on a win32 platform (7), with 3.3 version of xsd, trying to exporting the symbols for a generated dll (i use visual studio 9.0 to compile and i create the c++ class by command line). The schema i use are available for download at http://www.mxb.it/enigmahc/mxm.zip The myexport.hxx includes my export definition. I've also added the preprocessor info "MXM_EXPORTS". If i don't export any simbols i got no trouble. If i export the symbols I can create the c++ class, but when i try to compile i found a lot of this kind of error: 1>VideoType.cxx 1>..\..\..\xsd-3.3.0-i686-windows\libxsd\xsd/cxx/tree/containers.txx(180) : error C2027: use of undefined type 'mxm_dataobject::mpeg7smp::CreationInformationType' 1> d:\workspace\smartrm\mxm-cpp\src\mxm_dataobject\SegmentType.hxx(93) : see declaration of 'mxm_dataobject::mpeg7smp::CreationInformationType' 1> ..\..\..\xsd-3.3.0-i686-windows\libxsd\xsd/cxx/tree/containers.txx(176) : while compiling class template member function 'void xsd::cxx::tree::optional::set(const T &)' 1> with 1> [ 1> T=mxm_dataobject::mpeg7smp::SegmentType::CreationInformation_type 1> ] 1> ..\..\..\xsd-3.3.0-i686-windows\libxsd\xsd/cxx/tree/containers.txx(161) : while compiling class template member function 'xsd::cxx::tree::optional &xsd::cxx::tree::optional::operator =(const xsd::cxx::tree::optional &)' 1> with 1> [ 1> T=mxm_dataobject::mpeg7smp::SegmentType::CreationInformation_type 1> ] 1> d:\workspace\smartrm\mxm-cpp\src\mxm_dataobject\SegmentType.hxx(179) : see reference to class template instantiation 'xsd::cxx::tree::optional' being compiled 1> with 1> [ 1> T=mxm_dataobject::mpeg7smp::SegmentType::CreationInformation_type 1> ] 1>..\..\..\xsd-3.3.0-i686-windows\libxsd\xsd/cxx/tree/containers.txx(180) : error C2228: left of '._clone' must have class/struct/union 1>..\..\..\xsd-3.3.0-i686-windows\libxsd\xsd/cxx/tree/containers.txx(180) : fatal error C1903: unable to recover from previous error(s); stopping compilation the command line is: |1) xsd cxx-tree --generate-xml-schema --generate-serialization --generate-polymorphic xmlschema.xsd 2) xsd cxx-tree --hxx-prologue "#include \"myexport.hxx\"" --export-symbol MXM_SYMBOL_DECL --generate-wildcard --extern-xml-schema xmlschema.hxx --generate-serialization --generate-polymorphic --file-per-type --namespace-map urn:mpeg:mpeg-m:schema:storelicenseprotocol:2010=mxm_dataobject::mxm_slp --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/bbl.xsd=bbl.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/mxmalp.xsd=mxmalp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2010/04/mxmbp.xsd=mxmbp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/dia.xsd=dia.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/erl.xsd=erl.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/didl-msx.xsd=didl-msx.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/didl.xsd=didl.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/didmodel.xsd=didmodel.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/dii.xsd=dii.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpdidl.xsd=ipmpdidl.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpinfo-msx.xsd=ipmpinfo-msx.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpinfo.xsd=ipmpinfo.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2010/04/mxmidp.xsd=mxmidp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpmsg.xsd=ipmpmsg.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/mpeg4ipmp.xsd=mpeg4ipmp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/mpeg7smp.xsd=mpeg7smp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-m1x.xsd=rel-m1x.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-m2x.xsd=rel-m2x.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-m3x.xsd=rel-m3x.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-mx.xsd=rel-mx.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-r.xsd=rel-r.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-sx.xsd=rel-sx.xsd --location-map http://www.w3.org/2001/xml.xsd=xml.xsd --location-map http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd=dsig.xsd --location-map http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/xenc-schema.xsd=xenc.xsd --namespace-map urn:mpeg:maf:schema:mediastreaming:DIDLextensions=mxm_dataobject::didl_msx --namespace-map urn:mpeg:mpeg21:2006:07-DIDL-NS=mxm_dataobject::didl --namespace-map urn:mpeg:mpeg21:2002:02-DIDMODEL-NS=mxm_dataobject::didmodel --namespace-map urn:mpeg:mpeg21:2002:01-DII-NS=mxm_dataobject::dii --namespace-map urn:mpeg:mpeg21:2004:01-IPMPDIDL-NS=mxm_dataobject::ipmpdidl --namespace-map urn:mpeg:mpeg21:2003:01-DIA-NS=mxm_dataobject::dia --namespace-map urn:mpeg:mpeg21:2005:01-ERL-NS=mxm_dataobject::erl --namespace-map urn:mpeg:maf:Schema:mediastreaming:IPMPINFOextensions:2007=mxm_dataobject::ipmpinfo_msx --namespace-map urn:mpeg:mpeg21:2004:01-IPMPINFO-NS=mxm_dataobject::ipmpinfo --namespace-map urn:mpeg:mpegB:schema:IPMP-XML-MESSAGES:2007=mxm_dataobject::ipmpmsg --namespace-map urn:mpeg:mpeg4:IPMPSchema:2002=mxm_dataobject::mpeg4ipmp --namespace-map urn:mpeg:mpeg7:smp:schema:2001=mxm_dataobject::mpeg7smp --namespace-map urn:mpeg:mpeg21:2005:01-REL-M1X-NS=mxm_dataobject::rel_m1x --namespace-map urn:mpeg:mpeg21:2006:01-REL-M2X-NS=mxm_dataobject::rel_m2x --namespace-map urn:mpeg:mpeg21:2006:01-REL-M3X-NS=mxm_dataobject::rel_m3x --namespace-map urn:mpeg:mpeg21:2003:01-REL-MX-NS=mxm_dataobject::rel_mx --namespace-map urn:mpeg:mpeg21:2003:01-REL-R-NS=mxm_dataobject::rel_r --namespace-map urn:mpeg:mpeg21:2003:01-REL-SX-NS=mxm_dataobject::rel_sx --namespace-map http://www.w3.org/XML/1998/namespace=mxm_dataobject::xml --namespace-map http://www.w3.org/2000/09/xmldsig#=mxm_dataobject::dsig --namespace-map http://www.w3.org/2001/04/xmlenc#=mxm_dataobject::xenc --namespace-map urn:mpeg:mpeg-m:schema:accesslicenseprotocol:2010=mxm_dataobject::mxm_alp --namespace-map urn:mpeg:mpeg-m:schema:baseprotocol:2010=mxm_dataobject::mxm_bprotocols --namespace-map urn:mpeg:mpeg-m:schema:identifycontentprotocol:2010=mxm_dataobject::mxm_icp --namespace-map urn:mpeg:mpeg-m:schema:identifydeviceprotocol:2010=mxm_dataobject::mxm_idp --namespace-map urn:mpeg:mpeg-m:schema:verifydeviceprotocol:2010=mxm_dataobject::mxm_vdp didl.xsd thank you very much for the support, best, Angelo | From boris at codesynthesis.com Tue Aug 24 10:17:21 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Aug 24 10:08:54 2010 Subject: [xsd-users] exporting symbols from a windows dll In-Reply-To: <4C7397B5.3010507@smartrm.com> References: <4C7397B5.3010507@smartrm.com> Message-ID: Hi Angelo, Angelo Difino writes: > If i export the symbols I can create the c++ class, but when i try to > compile i found a lot of this kind of error: Ok, I think I know what's going on. If you look into SegmentType.hxx you will see that the CreationInformationType type is forward-declared in this header but not defined. The definition is included later in SegmentType.cxx. The file-per-type mode relies on such forward declarations to untangle mutual dependencies between types. Now, when you declare a class as DLL-exported, VC++ will have to instantiate every implicit, non-inline function so that they actually reside in the DLL. In this case it tries to instantiate implicit operator=. The problem arises because the body of this copy-assignment operator requires the definition of CreationInformationType. One thing that you can try is to compile your DLL in the Release mode and see if this error disappears (it may disappear because operator= will be inlined). The proper fix for this problem would be to generate our own implementation of operator= in the .cxx file where the definition of CreationInformationType is known. If you would like, I can send you a pre-release binary to try when this fix is ready. Boris From boris at codesynthesis.com Tue Aug 24 10:25:28 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Aug 24 10:17:01 2010 Subject: [xsd-users] Parsing and validation from CDR stream In-Reply-To: References: Message-ID: Hi Romain, Romain writes: > In the example given, you are using a boost::archive::text_oarchive > to serialize the data: > > using namespace library; > using boost::archive::text_oarchive; > using boost::archive::text_iarchive; > > // Read in the file > std::auto_ptr c (catalog_ (argv[1]))); > > cerr << *c << endl; > > // Save into a text archive > std::ostringstream ostr; > text_oarchive oa (ostr); > xml_schema::ostream os (oa); > os << *c; > > > Since Boost serialization provides a binary_oarchive, I was wondering if it > was possible to use this archive model with XSD? Yes, you can use any Boost archive. To change the 'binary/boost' example from using text archives to binary archives you will need to do the following: 1. Change makefile/VC project to pass the following XSD options: --generate-insertion boost::archive::binary_oarchive --generate-extraction boost::archive::binary_iarchive Instead of the ones for text_?archive. 2. Change library-prologue.hxx to include binary archive Boost headers instead of text. 3. Change the driver.cxx code to use binary archives instead of text. That's it. Boris From angelo at smartrm.com Tue Aug 24 10:36:39 2010 From: angelo at smartrm.com (Angelo Difino) Date: Tue Aug 24 10:36:45 2010 Subject: [xsd-users] exporting symbols from a windows dll In-Reply-To: References: <4C7397B5.3010507@smartrm.com> Message-ID: <4C73D8F7.5080205@smartrm.com> On 24/08/2010 16:17, Boris Kolpackov wrote: > Hi Angelo, > > Angelo Difino writes: > > >> If i export the symbols I can create the c++ class, but when i try to >> compile i found a lot of this kind of error: >> > Ok, I think I know what's going on. If you look into SegmentType.hxx > you will see that the CreationInformationType type is forward-declared > in this header but not defined. The definition is included later in > SegmentType.cxx. The file-per-type mode relies on such forward > declarations to untangle mutual dependencies between types. > > Now, when you declare a class as DLL-exported, VC++ will have to > instantiate every implicit, non-inline function so that they actually > reside in the DLL. In this case it tries to instantiate implicit > operator=. The problem arises because the body of this copy-assignment > operator requires the definition of CreationInformationType. One thing > that you can try is to compile your DLL in the Release mode and see > if this error disappears (it may disappear because operator= will be > inlined). > > The proper fix for this problem would be to generate our own > implementation of operator= in the .cxx file where the definition of > CreationInformationType is known. If you would like, I can send you > a pre-release binary to try when this fix is ready. > Hi Boris, thank you for the support! Yes, please keep me updated about this issue... i'll test this feature as soon as it will ready! Best, Angelo From fschmidt at techfak.uni-bielefeld.de Thu Aug 26 11:11:06 2010 From: fschmidt at techfak.uni-bielefeld.de (Florian Schmidt) Date: Thu Aug 26 11:11:11 2010 Subject: [xsd-users] External entity declaration in instance documents Message-ID: <4C76840A.70001@techfak.uni-bielefeld.de> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, since xerces-c 2 does not support XInclude (or at least so i have read in the mailing list archives) i'm trying to use external entity declarations to assemble instance documents.. I have included below a typical instance document. I have disabled validation using the dont_validate flag. Sadly the parser throws an exception: [ParsingErrorHandler]: "An exception occurred! Type:RuntimeException, Message:When reusing the Grammar, no internal subset is allowed" in line: 3, column: 23 terminate called after throwing an instance of 'xsd::cxx::tree::parsing' what(): instance document parsing failed Aborted I think this has once worked with a previous version of XSD [i think it was 3.2].. I'm currently using XSD 3.3.. So maybe somethign has changed in the initialization of the xerces-c parser.. ]> Tree 1 0.001 0.1 0.2 0.3 -0.1 -0.2 -0.3 0.2 6 0.01 Left.hand.ff1 Left.hand.mf1 0.1 [60](0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) [2](0,0) Best wished, Florian Schmidt - -- Dipl.-Inform. Florian Paul Schmidt University of Bielefeld, Neuroinformatics Group, CITEC Contact: http://ekvv.uni-bielefeld.de/pers_publ/publ/personDetailAct?id=5504453 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFMdoQKTb4s+qNo4RIRAsVwAKCTe7UiSl2YlfK0uiK+qjV6yLxbqgCfaH9t dqvA2SaFGUOeBOUcR7/xSFg= =2Ph8 -----END PGP SIGNATURE----- From boris at codesynthesis.com Thu Aug 26 14:23:38 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Aug 26 14:15:25 2010 Subject: [xsd-users] External entity declaration in instance documents In-Reply-To: <4C76840A.70001@techfak.uni-bielefeld.de> References: <4C76840A.70001@techfak.uni-bielefeld.de> Message-ID: Hi Florian, Florian Schmidt writes: > since xerces-c 2 does not support XInclude (or at least so i have read > in the mailing list archives) i'm trying to use external entity > declarations to assemble instance documents.. Xerces-C++ 3-series has basic XInclude support thought it doesn't play very nicely with XML Schema validation (your can find out more on this by searching the xsd-users mailing list archive). The nice thing about external entities is that they are expanded before validation so XML Schema validation will work well with this method. > I have included below a typical instance document. I have disabled > validation using the dont_validate flag. Sadly the parser throws an > exception: > > [ParsingErrorHandler]: "An exception occurred! Type:RuntimeException, > Message:When reusing the Grammar, no internal subset is allowed" in > line: 3, column: 23 This Xerces-C++ error occurs only in very specific situations: 1. When you try to cache a grammar from parse and the XML document contains internal DTD subset (like the one in your sample document). 2. When you use a cached grammar in parse and this grammar is DTD and the XML document contains internal DTD subset. The parsing functions generated by XSD do not perform any grammar caching. In fact, I tried an XML document which uses an external entity for fragment inclusion with the 'library' example (both validation enabled and disabled) as well as the 'caching' example and everything works without any errors with Xerces-C++ 2.8.0 and 3.1.1. So it seems there is something special you do for parsing. Perhaps you are setting up your own parser? Boris From fschmidt at techfak.uni-bielefeld.de Thu Aug 26 18:29:19 2010 From: fschmidt at techfak.uni-bielefeld.de (Florian Paul Schmidt) Date: Thu Aug 26 18:29:26 2010 Subject: [xsd-users] External entity declaration in instance documents In-Reply-To: References: <4C76840A.70001@techfak.uni-bielefeld.de> Message-ID: <4C76EABF.9050401@techfak.uni-bielefeld.de> Boris Kolpackov wrote: > Hi Florian, > > Florian Schmidt writes: > > >> since xerces-c 2 does not support XInclude (or at least so i have read >> in the mailing list archives) i'm trying to use external entity >> declarations to assemble instance documents.. >> > > Xerces-C++ 3-series has basic XInclude support thought it doesn't play > very nicely with XML Schema validation (your can find out more on this > by searching the xsd-users mailing list archive). > > Yeah, i read about that. Sadly i cannot really install Xerces-C++ 3.x here at my university.. > The nice thing about external entities is that they are expanded before > validation so XML Schema validation will work well with this method. > Great, so it would be great if i got this to work.. >> I have included below a typical instance document. I have disabled >> validation using the dont_validate flag. Sadly the parser throws an >> exception: >> >> [ParsingErrorHandler]: "An exception occurred! Type:RuntimeException, >> Message:When reusing the Grammar, no internal subset is allowed" in >> line: 3, column: 23 >> > > This Xerces-C++ error occurs only in very specific situations: > > 1. When you try to cache a grammar from parse and the XML document > contains internal DTD subset (like the one in your sample document). > > 2. When you use a cached grammar in parse and this grammar is DTD > and the XML document contains internal DTD subset. > > The parsing functions generated by XSD do not perform any grammar > caching. In fact, I tried an XML document which uses an external > entity for fragment inclusion with the 'library' example (both > validation enabled and disabled) as well as the 'caching' example > and everything works without any errors with Xerces-C++ 2.8.0 and > 3.1.1. So it seems there is something special you do for parsing. > Perhaps you are setting up your own parser? No, i'm really just using the generated parsing functions directly. The only thing i do is to specify the dont_validate flag.. I am pretty sure this worked with XSD 3.2 and stopped working with XSD 3.3. I will test again tomorrow.. Regards, Flo From fschmidt at techfak.uni-bielefeld.de Thu Aug 26 18:37:12 2010 From: fschmidt at techfak.uni-bielefeld.de (Florian Paul Schmidt) Date: Thu Aug 26 18:37:18 2010 Subject: [xsd-users] External entity declaration in instance documents In-Reply-To: <4C76EABF.9050401@techfak.uni-bielefeld.de> References: <4C76840A.70001@techfak.uni-bielefeld.de> <4C76EABF.9050401@techfak.uni-bielefeld.de> Message-ID: <4C76EC98.20304@techfak.uni-bielefeld.de> Hi again Boris, for your reference, the code that loads the instance document is accessible here: http://github.com/fps/CBF/blob/master/apps/cbf_run_controller_from_xml.cc lines 94-96 The schema is visible here: http://github.com/fps/CBF/blob/master/schemas/schemas.xsd xsd is called as xsd cxx-tree --root-element-all --generate-serialization --generate-ostream --generate-doxygen --generate-polymorphic --polymorphic-type-all --output-dir ${PROJECT_BINARY_DIR}/libcbf/cbf/ schemas.xsd This is taken from the cmake project file here: http://github.com/fps/CBF/blob/master/schemas/CMakeLists.txt Regards, Florian Schmidt Florian Paul Schmidt wrote: > Boris Kolpackov wrote: >> Hi Florian, >> >> Florian Schmidt writes: >> >> >>> since xerces-c 2 does not support XInclude (or at least so i have read >>> in the mailing list archives) i'm trying to use external entity >>> declarations to assemble instance documents.. >>> >> >> Xerces-C++ 3-series has basic XInclude support thought it doesn't play >> very nicely with XML Schema validation (your can find out more on this >> by searching the xsd-users mailing list archive). >> >> > > Yeah, i read about that. Sadly i cannot really install Xerces-C++ 3.x > here at my university.. >> The nice thing about external entities is that they are expanded before >> validation so XML Schema validation will work well with this method. >> > > Great, so it would be great if i got this to work.. >>> I have included below a typical instance document. I have disabled >>> validation using the dont_validate flag. Sadly the parser throws an >>> exception: >>> >>> [ParsingErrorHandler]: "An exception occurred! Type:RuntimeException, >>> Message:When reusing the Grammar, no internal subset is allowed" in >>> line: 3, column: 23 >>> >> >> This Xerces-C++ error occurs only in very specific situations: >> 1. When you try to cache a grammar from parse and the XML document >> contains internal DTD subset (like the one in your sample document). >> >> 2. When you use a cached grammar in parse and this grammar is DTD >> and the XML document contains internal DTD subset. >> >> The parsing functions generated by XSD do not perform any grammar >> caching. In fact, I tried an XML document which uses an external >> entity for fragment inclusion with the 'library' example (both >> validation enabled and disabled) as well as the 'caching' example >> and everything works without any errors with Xerces-C++ 2.8.0 and >> 3.1.1. So it seems there is something special you do for parsing. >> Perhaps you are setting up your own parser? > No, i'm really just using the generated parsing functions directly. > The only thing i do is to specify the dont_validate flag.. I am pretty > sure this worked with XSD 3.2 and stopped working with XSD 3.3. I will > test again tomorrow.. > > Regards, > Flo > From boris at codesynthesis.com Fri Aug 27 08:27:15 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Aug 27 08:19:05 2010 Subject: [xsd-users] External entity declaration in instance documents In-Reply-To: <4C76EC98.20304@techfak.uni-bielefeld.de> References: <4C76840A.70001@techfak.uni-bielefeld.de> <4C76EABF.9050401@techfak.uni-bielefeld.de> <4C76EC98.20304@techfak.uni-bielefeld.de> Message-ID: Hi Florian, Florian Paul Schmidt writes: > for your reference, the code that loads the instance document is > accessible here: > > http://github.com/fps/CBF/blob/master/apps/cbf_run_controller_from_xml.cc I made a simple test case out of this as well as your schema and the sample XML document: http://www.codesynthesis.com/~boris/tmp/cbf-test.tar.gz You can copy it into the the examples/ directory of the binary XSD distribution and simply run make. I tried it with Xerces-C++ 2.8.0 and XSD 3.3.0 -- everything works without any problems. Can you take a look and see if you can make this test case fail? Boris From fschmidt at techfak.uni-bielefeld.de Fri Aug 27 08:43:57 2010 From: fschmidt at techfak.uni-bielefeld.de (Florian Schmidt) Date: Fri Aug 27 08:44:01 2010 Subject: [xsd-users] External entity declaration in instance documents In-Reply-To: References: <4C76840A.70001@techfak.uni-bielefeld.de> <4C76EABF.9050401@techfak.uni-bielefeld.de> <4C76EC98.20304@techfak.uni-bielefeld.de> Message-ID: <4C77B30D.3030406@techfak.uni-bielefeld.de> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Boris and the list :D Boris Kolpackov wrote: > I made a simple test case out of this as well as your schema and > the sample XML document: > > http://www.codesynthesis.com/~boris/tmp/cbf-test.tar.gz > > You can copy it into the the examples/ directory of the binary > XSD distribution and simply run make. > > I tried it with Xerces-C++ 2.8.0 and XSD 3.3.0 -- everything works > without any problems. Can you take a look and see if you can make > this test case fail? Hmm, weird. This works.. Very mysterious. I must be doing something else wrong then. I suspect that some other library i link against actually _does_ initialize xerces-c++ differently then. I could have thought of that before. But sometimes one needs to see to believe ;D Thank you so much for your time, I'll go bughunting now.. Regards, Florian Schmidt - -- Dipl.-Inform. Florian Paul Schmidt University of Bielefeld, Neuroinformatics Group, CITEC Contact: http://ekvv.uni-bielefeld.de/pers_publ/publ/personDetailAct?id=5504453 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFMd7MNTb4s+qNo4RIRAkA2AJ9r5oM456hTRC/Daoe8GF1Ijb4E9gCfVTB2 oxgjLa/n1rp9KcJ+1RfS+PE= =zOXc -----END PGP SIGNATURE----- From fschmidt at techfak.uni-bielefeld.de Fri Aug 27 08:52:28 2010 From: fschmidt at techfak.uni-bielefeld.de (Florian Schmidt) Date: Fri Aug 27 08:52:33 2010 Subject: [xsd-users] External entity declaration in instance documents In-Reply-To: <4C77B30D.3030406@techfak.uni-bielefeld.de> References: <4C76840A.70001@techfak.uni-bielefeld.de> <4C76EABF.9050401@techfak.uni-bielefeld.de> <4C76EC98.20304@techfak.uni-bielefeld.de> <4C77B30D.3030406@techfak.uni-bielefeld.de> Message-ID: <4C77B50C.8050409@techfak.uni-bielefeld.de> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Florian Schmidt wrote: > Hi Boris and the list :D > > Boris Kolpackov wrote: > >> I made a simple test case out of this as well as your schema and >> the sample XML document: > >> http://www.codesynthesis.com/~boris/tmp/cbf-test.tar.gz > >> You can copy it into the the examples/ directory of the binary >> XSD distribution and simply run make. > >> I tried it with Xerces-C++ 2.8.0 and XSD 3.3.0 -- everything works >> without any problems. Can you take a look and see if you can make >> this test case fail? > > Hmm, weird. This works.. Very mysterious. I must be doing something else > wrong then. I suspect that some other library i link against actually > _does_ initialize xerces-c++ differently then. I could have thought of > that before. But sometimes one needs to see to believe ;D > > Thank you so much for your time, I'll go bughunting now.. And indeed i found a spot in one of the used libs that sets up xerces-c++ to use cached grammars. Let's see if i find a way to make it not do this.. Flo - -- Dipl.-Inform. Florian Paul Schmidt University of Bielefeld, Neuroinformatics Group, CITEC Contact: http://ekvv.uni-bielefeld.de/pers_publ/publ/personDetailAct?id=5504453 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFMd7UMTb4s+qNo4RIRAsnsAJ94mPvbt9YQdqOGiFUX2mMCJ4JLVwCePsQY KT+PV8COYdhGT//nL/gGwos= =drYe -----END PGP SIGNATURE----- From fschmidt at techfak.uni-bielefeld.de Fri Aug 27 09:37:05 2010 From: fschmidt at techfak.uni-bielefeld.de (Florian Schmidt) Date: Fri Aug 27 09:37:10 2010 Subject: [xsd-users] External entity declaration in instance documents In-Reply-To: <4C77B50C.8050409@techfak.uni-bielefeld.de> References: <4C76840A.70001@techfak.uni-bielefeld.de> <4C76EABF.9050401@techfak.uni-bielefeld.de> <4C76EC98.20304@techfak.uni-bielefeld.de> <4C77B30D.3030406@techfak.uni-bielefeld.de> <4C77B50C.8050409@techfak.uni-bielefeld.de> Message-ID: <4C77BF81.4040001@techfak.uni-bielefeld.de> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Florian Schmidt wrote: >> Thank you so much for your time, I'll go bughunting now.. > > And indeed i found a spot in one of the used libs that sets up > xerces-c++ to use cached grammars. Let's see if i find a way to make it > not do this.. Hmm, this is all very weird. It seems to me that if the XSD functions set up the parsing not to use caching, then another lib using Xerces-C _with_ caching shouldn't interfere, as there shouldn't be shared global state (every xerces user calls Initialize() and creates their own parser). Flo - -- Dipl.-Inform. Florian Paul Schmidt University of Bielefeld, Neuroinformatics Group, CITEC Contact: http://ekvv.uni-bielefeld.de/pers_publ/publ/personDetailAct?id=5504453 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFMd7+BTb4s+qNo4RIRAlBVAKCx6ziXpvIh2YEb9J+CcPDuUr7QLgCeIhqJ h0199wgjbVgFwtw7SfBTPvQ= =sCfL -----END PGP SIGNATURE----- From boris at codesynthesis.com Fri Aug 27 14:12:00 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Aug 27 14:03:58 2010 Subject: [xsd-users] External entity declaration in instance documents In-Reply-To: <4C77BF81.4040001@techfak.uni-bielefeld.de> References: <4C76840A.70001@techfak.uni-bielefeld.de> <4C76EABF.9050401@techfak.uni-bielefeld.de> <4C76EC98.20304@techfak.uni-bielefeld.de> <4C77B30D.3030406@techfak.uni-bielefeld.de> <4C77B50C.8050409@techfak.uni-bielefeld.de> <4C77BF81.4040001@techfak.uni-bielefeld.de> Message-ID: Hi Florian, Florian Schmidt writes: > > And indeed i found a spot in one of the used libs that sets up > > xerces-c++ to use cached grammars. Let's see if i find a way to make it > > not do this.. > > Hmm, this is all very weird. It seems to me that if the XSD functions > set up the parsing not to use caching, then another lib using Xerces-C > _with_ caching shouldn't interfere, as there shouldn't be shared global > state (every xerces user calls Initialize() and creates their own parser). Yes, I also thought this is very strange. The caching is a per-parser parameter and the library and XSD do not share parsers. Could it be that it is the library that is printing the error message and not the XSD error handler? Boris From boris at codesynthesis.com Sun Aug 29 09:59:00 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Aug 29 09:51:20 2010 Subject: [xsd-users] exporting symbols from a windows dll In-Reply-To: <4C73D8F7.5080205@smartrm.com> References: <4C7397B5.3010507@smartrm.com> <4C73D8F7.5080205@smartrm.com> Message-ID: Hi Angelo, Angelo Difino writes: > On 24/08/2010 16:17, Boris Kolpackov wrote: > > > The proper fix for this problem would be to generate our own > > implementation of operator= in the .cxx file where the definition of > > CreationInformationType is known. If you would like, I can send you > > a pre-release binary to try when this fix is ready. > > Yes, please keep me updated about this issue... i'll test this feature > as soon as it will ready! Ok, here is the binary for you to try: http://www.codesynthesis.com/~boris/tmp/xsd-4.0.0.a1-i686-windows.zip Please let me know whether it fixes the problem. Boris From barrie.kovish at singularsoftware.com Tue Aug 31 12:24:17 2010 From: barrie.kovish at singularsoftware.com (Barrie Kovish) Date: Tue Aug 31 12:24:46 2010 Subject: [xsd-users] Possible bug Message-ID: <1CDDAE48-08FB-42CA-BF31-33BE27BD9513@singularsoftware.com> I'm getting a fatal exception when I attempt to copy an instance of an XSD generated class. Any suggestions? My code for this is pretty simple: assert( NULL != pHouseComplete ); assert( NULL != pHouse ); assert( NULL != pHouseComplete->_root()); assert( NULL != pHouse->_root()); assert( 1 == pHouseComplete->address().size()); if( pHouse != pHouseComplete ) { *pHouse = *pHouseComplete; } Both pHouseComplete and pHouse are retrieved from the object model using an XPATH query and then converted to the corresponding Code Synthesis generated object. Here is the call stack when the problem occurs: My.dll!xsd::cxx::tree::_type::dom_element_info::clone(xsd::cxx::tree::_type & tree_node={...}, xsd::cxx::tree::_type * c=0x05b36e48) Line 798 C++ My.dll!xsd::cxx::tree::_type::_type(const xsd::cxx::tree::_type & x={...}, xsd::cxx::tree::flags __formal={...}, xsd::cxx::tree::_type * c=0x05b36e48) Line 961 C++ My.dll!xsd::cxx::tree::simple_type::simple_type(const xsd::cxx::tree::simple_type & other={...}, xsd::cxx::tree::flags f={...}, xsd::cxx::tree::_type * c=0x05b36e48) Line 37 C++ My.dll!xsd::cxx::tree::string >::string >(const xsd::cxx::tree::string > & x={...}, xsd::cxx::tree::flags f={...}, xsd::cxx::tree::_type * c=0x05b36e48) Line 150 C++ My.dll!xsd::cxx::tree::string >::_clone(xsd::cxx::tree::flags f={...}, xsd::cxx::tree::_type * c=0x05b36e48) Line 27 C++ My.dll!xsd::cxx::tree::sequence_common::operator=(const xsd::cxx::tree::sequence_common & v={...}) Line 909 C++ My.dll!xsd::cxx::tree::sequence >,0>::operator=(const xsd::cxx::tree::sequence >,0> & __that={...}) C++ My.dll!house::operator=(const FCPXML4::file & __that={...}) C++ Here is the code in file elements.hxx where the problem occurs: virtual std::auto_ptr clone (type& tree_node, container* c) const { using std::auto_ptr; // Check if we are a document root. // if (c == 0) { // We preserver DOM associations only in complete // copies from root. // if (doc_.get () == 0) return auto_ptr (0); return auto_ptr ( new dom_element_info (*doc_, tree_node)); } // Check if our container does not have DOM association (e.g., // because it wasn't a complete copy of the tree). // using xercesc::DOMNode; DOMNode* cn (c->_node ()); if (cn == 0) return auto_ptr (0); // Now we are going to find the corresponding element in // the new tree. // { using xercesc::DOMElement; DOMNode& pn (*e_.getParentNode ()); assert (pn.getNodeType () == DOMNode::ELEMENT_NODE); DOMNode* sn (pn.getFirstChild ()); // Source. DOMNode* dn (cn->getFirstChild ()); // Destination. // We should have at least one child. // assert (sn != 0); // Move in parallel until we get to the needed node. // for (; sn != 0 && !e_.isSameNode (sn);) <== Barrie: It appears that e.isSameNode returns true hence dn is not set. { sn = sn->getNextSibling (); dn = dn->getNextSibling (); } // e_ should be on the list. // assert (sn != 0); assert (dn->getNodeType () == DOMNode::ELEMENT_NODE); <== Barrie: dn is NULL return auto_ptr ( new dom_element_info (static_cast (*dn), tree_node, false)); } } From boris at codesynthesis.com Tue Aug 31 17:43:04 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Aug 31 17:33:07 2010 Subject: [xsd-users] Possible bug In-Reply-To: <1CDDAE48-08FB-42CA-BF31-33BE27BD9513@singularsoftware.com> References: <1CDDAE48-08FB-42CA-BF31-33BE27BD9513@singularsoftware.com> Message-ID: Hi Barrie, Barrie Kovish writes: > *pHouse = *pHouseComplete; Are these two nodes part of the same tree? Were they created as a result of parsing or added programmatically by the application? Boris From barrie.kovish at singularsoftware.com Tue Aug 31 17:38:22 2010 From: barrie.kovish at singularsoftware.com (Barrie Kovish) Date: Tue Aug 31 17:38:51 2010 Subject: [xsd-users] Possible bug In-Reply-To: References: <1CDDAE48-08FB-42CA-BF31-33BE27BD9513@singularsoftware.com> Message-ID: Hi Boris, Part of the same tree and created as a result of parsing. Barrie On 2010-08-31, at 2:43 PM, Boris Kolpackov wrote: > Hi Barrie, > > Barrie Kovish writes: > >> *pHouse = *pHouseComplete; > > Are these two nodes part of the same tree? Were they created as a > result of parsing or added programmatically by the application? > > Boris