[xsd-users] cxx-parser with --file-per-type

Latrach, Farhat Farhat.Latrach at sc.com
Thu Nov 21 14:53:27 EST 2013


Hi Boris,

Thanks for your prompt answers.

For my case, the cxx-tree does not fit well my need as I still need to parse the whole tree and for such amount of objects it will be very complicated. I would prefer parse directly with xercess instead. Please let me know if I am wrong.

The pattern of the error is when I run xsd cxx-parser -file-per-type --generate-validation the xsd starts generating some files and suddenly ends with "runtime error".
I removed the --generate-validation (I have changed to use xercess instead of expat) the error disappeared and a big chunk of files are generated. It works fine. I guess there is something wrong when using both --file-per-type and --generate-validation.

The test driver file I got does contain only the root element in the my_schema.xsd I am compiling. But, The xml I am expecting to parse has the root element of the included schema:( 

So, I did generate a test driver for the included schema as well and I have tried modifying one of its generated parsers by adding to it my_schema_test_drive root parser (a way to include my schema parsers  in the root parser of the included schema which is the root for the xml); by modifying its constructor and _start/end_element methods.
 
It worked fine and now I can parse all the included schemas elements and the root element of my schema (and its sub elements) in the xml file. 

The problem is: I have many other included schemas in my root element for which I need to make the same way of linking and obviously I need to automate this. 

My questions:
Is there a better way (or other compiling options) to generate a test driver taking into account automatically the root elements of included schemas (putting --root-element my_included_schema_root_element does not work)? 

I would like to use the test driver as it generates automatically what I need and I would only change the .impl.cxx files for my implementations.

PS: Please don't ask me to change the .xsd files as I am not in a position to change them.

Thanks a lot!


-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Friday, November 22, 2013 12:55 AM
To: Latrach, Farhat
Cc: xsd-users at codesynthesis.com
Subject: Re: [xsd-users] cxx-parser with --file-per-type

Hi Farhat,

Latrach, Farhat <Farhat.Latrach at sc.com> writes:

> First of all, thanks for your great xsd compiler.

Thanks, I am glad you like it.


> I have a very complicated schemas with many include/import. I tried to 
> use the cxx-parser with option -file-per-type to ensure of a complete 
> parser but xsd always ends with runtime error at mid road!

I can't say for sure what it wrong without knowing exactly what error you are getting. Having said that, the C++/Parser mapping is meant for simple schemas since you will have to implement a parser for every type yourself. For complex schemas I would recommend you use C++/Tree instead.


> Is there any option like -parts of cxx-tree to use with cxx-parser?

No. Also, this option won't help you with your issue (complex import/include graphs).

Boris

This email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please delete all copies and notify the sender immediately. You may wish to refer to the incorporation details of Standard Chartered PLC, Standard Chartered Bank and their subsidiaries at http://www.standardchartered.com/en/incorporation-details.html.



More information about the xsd-users mailing list