From boris at codesynthesis.com Mon Oct 4 09:16:18 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Oct 4 09:04:32 2010 Subject: [xsd-users] External entity declaration in instance documents In-Reply-To: <4C98AF5F.5060307@techfak.uni-bielefeld.de> References: <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> <4C890E65.5030708@techfak.uni-bielefeld.de> <4C98AF5F.5060307@techfak.uni-bielefeld.de> Message-ID: Hi Florian, Florian Schmidt writes: > > I think i found the culprit.. Linking against libxqilla and creating an > > instance of XQilla (from the QXilla simple API) triggers the parsing > > failure on my system.. When i find time i might browse through some > > XQilla code to see what the constructor of the XQilla class does.. > > I'm at a loss here about how i could workaround that. I attached the > test case you sent me a while ago modified to expose the problem. The > only alteration is to link against libxqilla and creating an instance of > XQilla in the main() function of the driver.cxx I finally got around to looking into this. What happens is the following: XQilla registers its own DOM implementation which returns parsers configured with grammar caching enabled. Ideally, this should only happen when the user of the DOM API ask for a DOM implementation with XPath support ("XPath2 3.0" feature string). When the user requests the Load-Store implementation ("LS" feature string), then the standard Xerces-C++ implementation should be used. However, this is not how it works at the moment and XQilla returns its implementation for all feature strings. To fix this both Xerces-C++ and XQilla will have to be changed. The relatively easy workaround for this problem would be to do the XML to DOM parsing yourself and use XercesDOMParser class instead of the standard DOMLSParser interface. This way you will get the default parser behavior without any caching. Or, you can use DOMLSParser (see the 'multiroot' example) and turn off the grammar caching (fgXercesCacheGrammarFromParse) before parsing the document. Boris From jianwei.z at gmail.com Thu Oct 7 17:06:06 2010 From: jianwei.z at gmail.com (JW) Date: Thu Oct 7 17:06:35 2010 Subject: [xsd-users] Need help: how to merge multiple xml files Message-ID: Hi Guys, I am new to the XSD tool so apologies if this question has been asked or is too obvious. Basically, I am trying to parse multiple xml files that have the same schema into one tree object model while keeping some of them in the memory. Let's say I have following three xml files: 1. full_elem.xml 2. override_elem.xml 3. override2_elem.xml First, full_elem.xml will be parsed into object model 1, override_elem.xml will be parsed into object model 2, and override2_elem.xml will be parsed into object model 3. Then object model 2 and model 3 will be merged into one single override object model, for instance, object model 3 merge into object model 2, overwriting values of same elements in model 2. Object model 2 will be kept but model 3 be removed. After that, object model 2 will be merged into model 1 and overwriting values of same elements but model 2 itself will be kept. At the end, there will be only 2 object models in the memory, model 1 and model 2. Model 1 has values from all models and model 2 has values from model 2 and 3. I have been reading the manuals and wiki but could not find a solution for this kind of merging. Could any one please give some pointers? Thank you for your patience. JW From boris at codesynthesis.com Fri Oct 8 10:49:02 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Oct 8 10:36:52 2010 Subject: [xsd-users] Need help: how to merge multiple xml files In-Reply-To: References: Message-ID: Hi, JW writes: > I have been reading the manuals and wiki but could not find a solution for > this kind of merging. There is no way to automatically merge two object models. The process is not well defined (i.e., are the new values added at the beginning or at the end, at what depth in the tree, what happens to duplicates, etc., etc). Perhaps if there is some regularity in your XML documents, then some schema-specific merging can be done. For example, if your document has the following structure: Then it should be easy to come up with a simple merge algorithm. Can you tell us more about your document structure? Maybe also show some examples of the merges that you want to achieve. Boris From jianwei.z at gmail.com Fri Oct 8 10:52:26 2010 From: jianwei.z at gmail.com (JW) Date: Fri Oct 8 10:52:54 2010 Subject: [xsd-users] Need help: how to merge multiple xml files In-Reply-To: References: Message-ID: Hi Boris, Thank you for your reply. All XML files shared the same schema. Here is an example of what I want to do with the merging. 1. full_elem.xml will have all elements ever required. Say, is the root. 10 60 20 120 2. override_elem.xml will have part of elements that their elements will be overwritten. 100 180 After the merging, the final full_elem.xml would look like the following: 100 60 20 180 Thanks, JW On Fri, Oct 8, 2010 at 10:49 AM, Boris Kolpackov wrote: > Hi, > > JW writes: > > > I have been reading the manuals and wiki but could not find a solution > for > > this kind of merging. > > There is no way to automatically merge two object models. The process is > not well defined (i.e., are the new values added at the beginning or at > the end, at what depth in the tree, what happens to duplicates, etc., > etc). > > Perhaps if there is some regularity in your XML documents, then some > schema-specific merging can be done. For example, if your document has > the following structure: > > > > > > > > Then it should be easy to come up with a simple merge algorithm. Can you > tell us more about your document structure? Maybe also show some examples > of the merges that you want to achieve. > > Boris > From ivan.lelann at free.fr Fri Oct 8 16:59:22 2010 From: ivan.lelann at free.fr (Ivan Le Lann) Date: Fri Oct 8 16:59:33 2010 Subject: [xsd-users] ODB - compiler-based ORM system for C++ In-Reply-To: <710458834.212201286571253759.JavaMail.root@zimbra36-e6.priv.proxad.net> Message-ID: <767840237.212461286571562942.JavaMail.root@zimbra36-e6.priv.proxad.net> Hi Boris, > We just announced our new project, ODB, and I thought some of you > might be interested: > I am definitely interested, though I must admit that the gcc plugin part is what really drew my attention at first. I just discovered your blog posts on the subject, this is a really precious piece of information. As for ODB itself, I'm not facing any database these days, but I am quite certain I will use it when this happens again. Finally, my curiosity compelled me to ask a silly question : Do you have any plan regarding a bridge from XSD to ODB ? (ie. that XSD generated code can somehow be used by ODB) Regards, Ivan From rlischner at proteuseng.com Sat Oct 9 16:51:02 2010 From: rlischner at proteuseng.com (Ray Lischner) Date: Mon Oct 11 06:45:45 2010 Subject: [xsd-users] --generate-comparison and anyType Message-ID: We are using Code Synthesis 3.3.0. When I use --generate-comparison and an element has type anyType, the generated comparison function does not compile because xml_schema::type does not have the == operator. I don't know what it means for an anyType to == an anyType, so I don't know the solution to this problem, but I think it a real problem when a valid schema compiles to invalid C++ without a peep from xsd. demo.xsd xsd cxx-tree --generate-comparison demo.xsd g++ -c -Ixsd demo.cxx demo.cxx: In function 'bool demo::operator==(const demo::Type&, const demo::Type&)': demo.cxx:204: error: no match for 'operator==' in '((const demo::Type*)x)->demo::Type::a() == ((const demo::Type*)y)->demo::Type::a()' Ray Lischner, Senior Member of Technical Staff 133 National Business Pkwy, Ste 150 t. 443.539.3448 Annapolis Junction, MD 20701 c. 410.854.5170 rlischner@proteuseng.com f. 443.539.3370 This electronic message and any files transmitted with it contain information which may be privileged and/or proprietary. The information is intended for use solely by the intended recipient(s). If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of this information is prohibited. If you have received this electronic message in error, please advise the sender by reply email or by telephone (443.539.3400) and delete the message. From boris at codesynthesis.com Mon Oct 11 12:05:46 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Oct 11 11:53:19 2010 Subject: [xsd-users] Need help: how to merge multiple xml files In-Reply-To: References: Message-ID: Hi JW, JW writes: > 1. full_elem.xml will have all elements ever required. Say, is > the root. > > > > 10 > 60 > > > 20 > 120 > > > > 2. override_elem.xml will have part of elements that their elements will be > overwritten. > > > > 100 > > > 180 > > > > After the merging, the final full_elem.xml would look like the following: > > > > 100 > 60 > > > 20 > 180 > > Ok, this is much more useful. There are two ways to do this that I can think of. The first is using the object model. In this case, you will need to iterate over the config elements in the first document and for each config object you will need to find the corresponding config in the second document. Once you have the two objects, you can set the values in the object from the first document using the values from the object from the second document. With this approach you will need to know which members can be present in the config object: config_t& dst = ... config_t& src = ... if (src.threshold ().present ()) // assuming threshold is optional { dst.threshol (src.threshold ()); } dst.duration (src.duration ()); // assuming threshold is required It may be easier (and faster) to first create a map of ids to config object for the second document. The other approach is more complicated but it will work without any modifications if you add new elements to the config type. The idea is to use the DOM representation to merge the two documents before parsing the result into an object model. The implementation will be quite a bit more complex so I don't recommend it unless you are proficient with Xerces-C++ DOM API and plan to change your schema often. Boris From boris at codesynthesis.com Mon Oct 11 12:18:36 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Oct 11 12:06:09 2010 Subject: [xsd-users] --generate-comparison and anyType In-Reply-To: References: Message-ID: Hi Ray, Ray Lischner writes: > We are using Code Synthesis 3.3.0. When I use --generate-comparison and > an element has type anyType, the generated comparison function does not > compile because xml_schema::type does not have the == operator. I don't > know what it means for an anyType to == an anyType, so I don't know the > solution to this problem, That's the reason why we left the comparison operators for anyType and anySimpleType unimplemented. There are two common scenarios where anyType would be used: 1. In polymorphic schemas anyType can be used as an abstract root of a type hierarchy. In this case an instance of anyType is actually never created so the comparison operator can safely return false. 2. anyType is used as a "match anything" kind of wildcard. In this case the application either ignores the content in which case the comparison operator should probably always return true or the application customizes anyType in which case it should provide its own comparison implementation. If we provided the default implementation, it would be impossible for the application to provide its won version that meets the requirements of one of the above scenarios. > but I think it a real problem when a valid schema compiles to invalid > C++ without a peep from xsd. Yes, I thinks issuing a warning would be a reasonable thing to do. Added to the TODO list. Boris From boris at codesynthesis.com Mon Oct 11 12:25:50 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Oct 11 12:13:24 2010 Subject: [xsd-users] ODB - compiler-based ORM system for C++ In-Reply-To: <767840237.212461286571562942.JavaMail.root@zimbra36-e6.priv.proxad.net> References: <710458834.212201286571253759.JavaMail.root@zimbra36-e6.priv.proxad.net> <767840237.212461286571562942.JavaMail.root@zimbra36-e6.priv.proxad.net> Message-ID: Hi Ivan, Ivan Le Lann writes: > Finally, my curiosity compelled me to ask a silly question : > Do you have any plan regarding a bridge from XSD to ODB ? > (ie. that XSD generated code can somehow be used by ODB) Not a silly question at all. We have thought about it thought there doesn't seem to be much demand for such a functionality (I think I've only heard two people asking for a feature like this). But should we support this at some point, it would be interesting to take one of these hairy schemas with a few thousand types and see how various database implementations will cope with something like this. Boris From vieri122 at gmail.com Mon Oct 11 07:11:29 2010 From: vieri122 at gmail.com (=?UTF-8?B?5YiY5by6?=) Date: Mon Oct 11 12:13:41 2010 Subject: [xsd-users] please help me codesynthesis xsd team! Message-ID: please help me codesynthesis xsd team! there is a mistake when I use the xsd serialization. That is my code(so easy): auto_ptr h(csHostStatus("C:\\Users\\vieri122\\Desktop\\hostStatus.xml")); csHostStatus(cout,*h); the consle print context is: * * * but the hostStatus.xml actual is:* * * may be there is diffrent thing that you find.* where is the "p1:" from? * * * *that is all thank you. *-- Best wishes for you and your family From boris at codesynthesis.com Mon Oct 11 12:39:04 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Oct 11 12:26:38 2010 Subject: [xsd-users] please help me codesynthesis xsd team! In-Reply-To: References: Message-ID: Hi, vieri122@gmail.com writes: > Subject: please help me codesynthesis xsd team! Please see item #3 in the posting guidelines: http://www.codesynthesis.com/support/posting-guidelines.xhtml > > > [...] > > > > where is the "p1:" from? It is an automatically-assigned prefix for the "URN:cantronic-system-4" XML namespace. If you want to get the same output as the original document, try something like this: xml_schema::namespace_infomap map; map[""].name = "URN:cantronic-system-4"; csHostStatus(cout,*h, map); For more information, see Section 6.1, "Namespace and Schema Information" in the C++/Tree Mapping Getting Started Guide: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/#6.1 Boris From Gene.Falendysz at itron.com Mon Oct 11 12:48:32 2010 From: Gene.Falendysz at itron.com (Falendysz, Gene) Date: Mon Oct 11 12:48:53 2010 Subject: [xsd-users] Limiting the "depth" of serialized objects Message-ID: <8E77780E66177E44BC77F3AE0187DA450100CDAA@ITR-EXMBXVS-2.itron.com> I have an object that has as an element a list. Currently when I serialize this object it serializes each of the elements in the list with all of their sub-elements. What I require is that only the href of the list elements gets included in the serialization of the main object. Following is an excerpt from the specification I am trying to implement. GET /goose/{#}/egg returns an EXI list (described by the schema) of individual eggs that belong to this goose, each with their own URI that is subordinate to this URI. The client would send: GET /Goose/1/Egg HTTP/1.1 Host: {IPv6 Address} The server would respond: HTTP/1.1 200 OK Content-Type: application/exi GET /goose/{#}/egg/{#} returns an EXI representation (described by the schema) of the egg addressed by this URI. The client would send: GET /Goose/1/Egg/1 HTTP/1.1 Host: {IPv6 Address} The server would respond: HTTP/1.1 200 OK Content-Type: application/exi 1 http{s}://{IPv6 Address}/Goose/1/Egg/1 White No Male Gene Falendysz Principal Engineer Phone: (864) 718.6676 Fax: (864) 718.6871 www.itron.com [cid:image001.gif@01CB6941.3E0B9BD0] -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.gif Type: image/gif Size: 4783 bytes Desc: image001.gif Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20101011/56fd9aaf/image001.gif From boris at codesynthesis.com Tue Oct 12 07:56:16 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Oct 12 07:46:05 2010 Subject: [xsd-users] Limiting the "depth" of serialized objects In-Reply-To: <8E77780E66177E44BC77F3AE0187DA450100CDAA@ITR-EXMBXVS-2.itron.com> References: <8E77780E66177E44BC77F3AE0187DA450100CDAA@ITR-EXMBXVS-2.itron.com> Message-ID: Hi Gene, Falendysz, Gene writes: > I have an object that has as an element a list. Currently when I serialize > this object it serializes each of the elements in the list with all of > their sub-elements. What I require is that only the href of the list > elements gets included in the serialization of the main object. You can get this behavior by customizing the sub-element's type (Egg in the your example) and providing your own serialization operator. Your own implementation would need to somehow decide when to serialize the complete object and when to only write the href attribute. It seems that checking whether the element to which we are serializing is the root of the document will do the trick in your case. The 'wildcard' example in the examples/cxx/tree/custom/ directory of the XSD distribution shows how to customize a type and its serialization operator. See also the C++/Tree Mapping Customization Guide: http://wiki.codesynthesis.com/Tree/Customization_guide Boris From vieri122 at gmail.com Tue Oct 12 07:32:52 2010 From: vieri122 at gmail.com (=?UTF-8?B?5YiY5by6?=) Date: Tue Oct 12 09:34:03 2010 Subject: [xsd-users] please help me codesynthesis xsd team! In-Reply-To: References: Message-ID: Thank you very much for your reply.I got it. And there is anather mistake,about "xsi:type" that is my code: * auto_ptr h = csMsgsReq_("demo.xml",::xml_schema::flags::dont_validate); xml_schema::namespace_infomap map; map[""].name = "URN:cantronic-system-4"; csMsgsReq_(cout,*h,map);* * *the consle print: * * * but the "demo.xml" actual is:* * * where is the xsi:type="cstypeStatus"? I used the --generate-polymorphic and the --polymorphic-type-all command. please help me. thank you again. 2010/10/12 Boris Kolpackov > > Hi, > > vieri122@gmail.com writes: > > > Subject: please help me codesynthesis xsd team! > > Please see item #3 in the posting guidelines: > > http://www.codesynthesis.com/support/posting-guidelines.xhtml > > > > > > > > [...] > > > > > > > > where is the "p1:" from? > > It is an automatically-assigned prefix for the "URN:cantronic-system-4" > XML namespace. If you want to get the same output as the original > document, try something like this: > > xml_schema::namespace_infomap map; > > map[""].name = "URN:cantronic-system-4"; > > csHostStatus(cout,*h, map); > > For more information, see Section 6.1, "Namespace and Schema Information" > in the C++/Tree Mapping Getting Started Guide: > > http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/#6.1 > > Boris -- Best wishes for you and your family From boris at codesynthesis.com Tue Oct 12 09:50:04 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Oct 12 09:39:52 2010 Subject: [xsd-users] missing xsi:type (please help me codesynthesis xsd team!) In-Reply-To: References: Message-ID: Hi, Please follow posting guidelines: http://www.codesynthesis.com/support/posting-guidelines.xhtml You have now violated items 2 and 3. I will not reply to any of your future emails if you keep doing this. vieri122@gmail.com writes: > where is the xsi:type="cstypeStatus"? csMsgReq element's type is probably cstypeStatus (check schema to make sure) so the xsi:type attribute is not necessay. XSD tries not write unnecessary information to XML. Boris From jianwei.z at gmail.com Tue Oct 19 13:09:20 2010 From: jianwei.z at gmail.com (JW) Date: Tue Oct 19 13:09:44 2010 Subject: [xsd-users] Need help: type-naming and function-naming issue Message-ID: Hi, I tried to name all class types and function names in java/ucc style but it didn't seem to work as I expected. This was the command line options I used: xsd cxx-tree --type-naming java --function-naming java --root-element config --generate-ostream --generate-serialization config.xsd Here were some class names and function names generated by the command: Class Variable_condition; typedef ::Variable_condition Variable_conditionType; const Variable_conditionType& getVariable_condition(); void setVariable_condition(const Variable_conditionType& x); I would expect every words in the names to be capitalized such as VariableCondition, getVariableCondition, setVariableCondition, VariableConditionType, etc. Did any one have similar issue before? Thanks, JW From boris at codesynthesis.com Wed Oct 20 09:43:13 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Oct 20 09:32:35 2010 Subject: [xsd-users] Need help: type-naming and function-naming issue In-Reply-To: References: Message-ID: Hi JW, JW writes: > I tried to name all class types and function names in java/ucc style but it > didn't seem to work as I expected. > > [...] > > Here were some class names and function names generated by the command: > > Class Variable_condition; > typedef ::Variable_condition Variable_conditionType; With the predefined naming schemas ('java', 'lcc', etc), XSD only makes sure that the names it constructs (e.g., by adding the 'type' or 'iterator' suffix) follow this conventions. It does not change the names that come from the schema, assuming that the schema names already follow the desired convention. In your case, I assume you have a schema type Variable_condition which doesn't follow the 'ucc' style. If you want to also change the schema names, then you will need to create your own regular expressions for that. See the "NAMING CONVENTION" section in the XSD Compiler Command Line Manual for more information on how to do this: http://www.codesynthesis.com/projects/xsd/documentation/xsd.xhtml Boris From jianwei.z at gmail.com Wed Oct 20 12:30:41 2010 From: jianwei.z at gmail.com (JW) Date: Wed Oct 20 12:31:04 2010 Subject: [xsd-users] Need help: type-naming and function-naming issue In-Reply-To: References: Message-ID: Hi Boris, Thank you very much. I figured out the problem and finally made it work. By the way, --name-regex-trace is very helpful during the regex debugging. Excellent design. Thanks, JW On Wed, Oct 20, 2010 at 9:43 AM, Boris Kolpackov wrote: > Hi JW, > > JW writes: > > > I tried to name all class types and function names in java/ucc style but > it > > didn't seem to work as I expected. > > > > [...] > > > > Here were some class names and function names generated by the command: > > > > Class Variable_condition; > > typedef ::Variable_condition Variable_conditionType; > > With the predefined naming schemas ('java', 'lcc', etc), XSD only makes > sure that the names it constructs (e.g., by adding the 'type' or 'iterator' > suffix) follow this conventions. It does not change the names that come > from the schema, assuming that the schema names already follow the desired > convention. > > In your case, I assume you have a schema type Variable_condition which > doesn't follow the 'ucc' style. If you want to also change the schema > names, then you will need to create your own regular expressions for > that. See the "NAMING CONVENTION" section in the XSD Compiler Command > Line Manual for more information on how to do this: > > http://www.codesynthesis.com/projects/xsd/documentation/xsd.xhtml > > Boris > From bill.npo.wheeler at intel.com Fri Oct 22 14:33:34 2010 From: bill.npo.wheeler at intel.com (Wheeler, Bill NPO) Date: Fri Oct 22 14:33:49 2010 Subject: [xsd-users] out of memory problem Message-ID: <7A447CD3CC413B4D9258027141E7AD0414F530CE27@azsmsx502.amr.corp.intel.com> Hi, I'm using your tree parsing software (version 3.3 /w xerces 3.1.1) to process 1000's of XML files. Well into the processing, the OutOfMemoryException in MemoryManagerImpl::allocate is thrown. The strange thing about this is that I am nowhere near my memory quota when this happens (I'm less than 1/10 th of my limit). After each parse op, I am always cleaning up the tree by calling "reset()" on the std::auto_ptr<> object holding the root of the parsed tree. I should never have more than one parse op going on at any one time. Any idea what's going on here? Is there some aspect to managing this that I'm not familiar with that explains this? Thanks, Bill Wheeler From boris at codesynthesis.com Fri Oct 22 15:54:50 2010 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Oct 22 15:44:15 2010 Subject: [xsd-users] out of memory problem In-Reply-To: <7A447CD3CC413B4D9258027141E7AD0414F530CE27@azsmsx502.amr.corp.intel.com> References: <7A447CD3CC413B4D9258027141E7AD0414F530CE27@azsmsx502.amr.corp.intel.com> Message-ID: Hi Bill, Wheeler, Bill NPO writes: > I'm using your tree parsing software (version 3.3 /w xerces 3.1.1) to > process 1000's of XML files. Well into the processing, the > OutOfMemoryException in MemoryManagerImpl::allocate is thrown. > The strange thing about this is that I am nowhere near my memory > quota when this happens (I'm less than 1/10 th of my limit). > After each parse op, I am always cleaning up the tree by calling > "reset()" on the std::auto_ptr<> object holding the root of the > parsed tree. Do you call one of the generated parsing functions or do you setup the Xerces-C++ parser yourself? If you call the parsing function (and assuming there are no memory leaks), then the only thing that I can think of is the heap fragmentation. That is, the heap gets so fragmented that the heap implementation has to keep allocating more and more process memory with each parse operation. In this case it would be helpful to know which platform you are running this on. Also, can you try to reproduce this problem using the 'performance' example? You can create a test file as big as your real XML documents using the supplied gen.cxx program. You can also comment out the call to serialization() to only test parsing. Boris