From volokosd at gmail.com Sat Jan 13 02:11:13 2018 From: volokosd at gmail.com (Darien Sokolov) Date: Sat Jan 13 05:49:26 2018 Subject: [xsd-users] Slow DOM Element Creation Message-ID: Hello, I am a programmer working on Project Ironfist (more info at Ironfi.st). We are using CodeSynthesis XSD to handle the creation of save files for the game that we are modifying. Save/Load times seem to be slower than usual, and I have traced the behavior down to the creation of DOM elements during these times. It appears that these times increase near-linearly with the total size of the overarching tree of structures that must be saved in the save file. I have seen repeated calls to this particular constructor within the generated code: ::xercesc::DOMElement& s ( ::xsd::cxx::xml::dom::create_element ( Most of these calls are within FOR loops that visit each node of each nested structure that is to be saved. I am not too familiar with the intricacies of CodeSynthesis XSD and I do not know what information should be provided. The end goal here is to speed up the times of the XML file generation. If anyone here has any ideas, questions, or suggestions, it would be greatly appreciated! Thank You, Darien Sokolov From boris at codesynthesis.com Sat Jan 13 08:10:59 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sat Jan 13 08:11:20 2018 Subject: [xsd-users] Slow DOM Element Creation In-Reply-To: References: Message-ID: Darien Sokolov writes: > [...] I have seen repeated calls to this particular constructor within > the generated code: > > ::xercesc::DOMElement& s ( > ::xsd::cxx::xml::dom::create_element ( > > Most of these calls are within FOR loops that visit each node of each > nested structure that is to be saved. I am not too familiar with the > intricacies of CodeSynthesis XSD and I do not know what information should > be provided. The end goal here is to speed up the times of the XML file > generation. If you are saving a lot of small XML documents/fragments, then creating and re-using a single DOMDocument should help. See the section on serialization in the FAQ (there is even a question on speeding things up): http://wiki.codesynthesis.com/Tree/FAQ Boris From harikrishnanhkks at gmail.com Thu Jan 18 03:34:30 2018 From: harikrishnanhkks at gmail.com (Hari Krishnan) Date: Thu Jan 18 05:21:19 2018 Subject: [xsd-users] Support for XSD cxx-parser --suppress-validation Message-ID: Hi, I am encountering some problem while using CodeSynthesis XSD to parse an XSD file. The generated code need not use XSD file to parse the XML file. I used the option: --suppress-validation. The resulting code was the same and is not suppressing validation with xsd-schema. Is there another way to deal with the situation? Thank you! -- Kind and Regards *HARIKRISHNAN K. S.* *MSc. Computational Sciences in Engineering [CSE] * *(Ongoing: Fourth Semester)* *Technische Universit?t Braunschweig* *Braunschweig, Germany* *(m) +49 1521 7513640 (e) hk.sreekumar@tu-bs.de * From boris at codesynthesis.com Fri Jan 19 07:21:54 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jan 19 07:22:09 2018 Subject: [xsd-users] Support for XSD cxx-parser --suppress-validation In-Reply-To: References: Message-ID: Hari Krishnan writes: > I am encountering some problem while using CodeSynthesis XSD to parse an > XSD file. The generated code need not use XSD file to parse the XML file. I > used the option: --suppress-validation. The resulting code was the same and > is not suppressing validation with xsd-schema. Is there another way to deal > with the situation? This options only has effect when you are using a non-validating XML parser (Expat). If you are using Xerces-C++, then the validation decision is made at runtime. See documentation for details. Boris From isharp at atis.org Tue Jan 23 04:06:12 2018 From: isharp at atis.org (Iain Sharp) Date: Tue Jan 23 04:06:57 2018 Subject: [xsd-users] Extracting DOMDocument from anyType Message-ID: All, I am using XSD Tree to build a C++ object model and parse XML for a set of pre-defined XSD files. The normal parsing process is: 1. Take the incoming XML 2. Using XercesDOMParser parse the XML to a DOMDocument 3. Peek at the tag of the root element to determine its type (similar to the second approach in "How do I handle XML data of an unknown type?" in the FAQ) 4. Parse the DOMDocument to the C++ data structure of the appropriate type using the appropriate parser method generated by XSD I now want to expand the parsing to extract an appropriate type instance for an anyType element which will contain one of the types already handled by the parser. To do this, the obvious thing is to get the DOMDocument for the anyType and pass this through steps 3 and 4 of the existing parsing process above. However, the dom_content_document() for the anyType element doesn't seem to be returning a populated document. I have processed the XSD using "-generate-any-type". If I call dom_content() on the anyType element then I see all the tags and values belonging to the contained type as I would expect. However, dom_content_document() doesn't seem to contain any data: xercesc::DOMDocument& dcd = anyTypeElement.dom_content_document(); dcd.getNodeName() is "#document" dcd.hasChildNodes() is false dcd.getDocumentElement() is NULL Am I missing something about how to get a DOMDocument for an anyType element? Thanks Iain From boris at codesynthesis.com Tue Jan 23 06:44:19 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jan 23 06:44:46 2018 Subject: [xsd-users] Extracting DOMDocument from anyType In-Reply-To: References: Message-ID: Iain Sharp writes: > I now want to expand the parsing to extract an appropriate type instance for > an anyType element which will contain one of the types already handled by > the parser. To do this, the obvious thing is to get the DOMDocument for the > anyType and pass this through steps 3 and 4 of the existing parsing process > above. However, the dom_content_document() for the anyType element doesn't > seem to be returning a populated document. > > I have processed the XSD using "-generate-any-type". If I call dom_content() > on the anyType element then I see all the tags and values belonging to the > contained type as I would expect. However, dom_content_document() doesn't > seem to contain any data: > > xercesc::DOMDocument& dcd = anyTypeElement.dom_content_document(); > dcd.getNodeName() is "#document" > dcd.hasChildNodes() is false > dcd.getDocumentElement() is NULL The DOMDocument returned by dom_content_document() is the "container" document for wildcard content. If you have 10 elements of anyType in your document, then they will all be "owner" by a single DOM document (as opposed to 10 different documents). To handle wildcard content you will need to directly call the parsing constructors for the corresponding types instead of going through the parsing functions (which are used for root elements only). See the 'cxx/tree/wildcard' example for details. Boris From isharp at atis.org Tue Jan 23 08:02:41 2018 From: isharp at atis.org (Iain Sharp) Date: Tue Jan 23 08:03:15 2018 Subject: [xsd-users] Extracting DOMDocument from anyType In-Reply-To: References: Message-ID: Thanks - I guess that makes sense. If I want to be consistent between how the root elements and the wildcard elements are created is there any reason not to use the constructors that take a DOMElement parameter in both cases? Regards Iain -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: 23 January 2018 11:44 To: Iain Sharp Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] Extracting DOMDocument from anyType Iain Sharp writes: > I now want to expand the parsing to extract an appropriate type > instance for an anyType element which will contain one of the types > already handled by the parser. To do this, the obvious thing is to get > the DOMDocument for the anyType and pass this through steps 3 and 4 of > the existing parsing process above. However, the > dom_content_document() for the anyType element doesn't seem to be returning a populated document. > > I have processed the XSD using "-generate-any-type". If I call > dom_content() on the anyType element then I see all the tags and > values belonging to the contained type as I would expect. However, > dom_content_document() doesn't seem to contain any data: > > xercesc::DOMDocument& dcd = anyTypeElement.dom_content_document(); > dcd.getNodeName() is "#document" > dcd.hasChildNodes() is false > dcd.getDocumentElement() is NULL The DOMDocument returned by dom_content_document() is the "container" document for wildcard content. If you have 10 elements of anyType in your document, then they will all be "owner" by a single DOM document (as opposed to 10 different documents). To handle wildcard content you will need to directly call the parsing constructors for the corresponding types instead of going through the parsing functions (which are used for root elements only). See the 'cxx/tree/wildcard' example for details. Boris From boris at codesynthesis.com Tue Jan 23 08:07:12 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jan 23 08:07:38 2018 Subject: [xsd-users] Extracting DOMDocument from anyType In-Reply-To: References: Message-ID: Iain Sharp writes: > If I want to be consistent between how the root elements and the > wildcard elements are created is there any reason not to use the > constructors that take a DOMElement parameter in both cases? Probably not in your situation. One extra thing that the parsing functions do is handle XML schema polymorphism (substitution groups and xsi:type) but if you don't use those on the root elements, then it should be the same. Boris From goyal.vinayak44 at gmail.com Wed Jan 31 00:11:59 2018 From: goyal.vinayak44 at gmail.com (Vinayak Goyal) Date: Wed Jan 31 08:58:25 2018 Subject: [xsd-users] Issue while serialization Message-ID: Dear Team, I created the cxx and hxx file using cxx-tree command but whenever I am trying to use push_back method I am getting error *"C:\Users\Vinayak\Documents\Parser\main.cpp:101: error: C2664: 'void xsd::cxx::tree::sequence::push_back(std::auto_ptr)': cannot convert argument 1 from 'void' to 'const OpenDRIVE::junctionGroup_type &'* *with* *[* * T=OpenDRIVE::junctionGroup_type* *]"* and I am also unable to use *xml_schema::namespace_infomap* in my code. If there is any predefined method for modifying the file and creating a new file, kindly advise me for same. Looking forward to hear back. Thanking You. Regards, VInayak