[xsd-users] Problem in translating schema to C++ (following parser guide)

Pedro pmonteirorocha at sapo.pt
Wed Jun 30 10:14:41 EDT 2010


Hello,

My name is Pedro Rocha. Im working on a university project that could 
use xml as main data format, since it is already being used in some of 
its smaller parts.
I have been trying to follow the tutorial (C++ /Parser Mapping Guide), 
but i have a problem translating Hello.xsd to C++ parser skeletons. I'm 
not using the tree mapping because i need support for large xml files. 
I'm trying to learn how to work with this data binding compiler because 
i've seen good reviews about it and seems simple to use.
In point 2.2 of the guide, the command "$ xsd cxx-parser --xml-parser 
expat hello.xsd" gives me the error "unknown option --xml-parser". Im 
using Ubuntu Linux 10.04 and gnu c++ 4.4.4.3.

When i type "xsd" on the console, this is the result:

xsd.exe - a utility for generating schema or class files

xsd.exe <schema>.xsd /classes [/element:NAME] [/language:NAME] 
[/namespace:NAME] [/outputdir:PATH] [/uri:NAME]
xsd.exe <schema>.xsd /dataset [/element:NAME] [/language:NAME] 
[/namespace:NAME] [/outputdir:PATH] [/uri:NAME]
xsd.exe <assembly>.dll|<assembly>.exe [/outputdir:PATH] [/type:NAME]
xsd.exe <instance>.xml [<instance>.xml ...] [/outputdir:PATH]

    /c /classes        Generate classes for the specified schema.
    /d /dataset        Generate typed dataset classes for the specified 
schema.
    /e /element:NAME   Element from schema to generate code for.
                       Multiple elements can be specified.
    /u /uri:NAME       Namespace uri of the elements to generate code for.
    /l /language:NAME  The language, or type name of custom CodeDomProvider
                       to use for the generated code.
                       Shorthand specifiers are: "CS" (C#) and "VB" 
(VB.NET).
                       For type name, assembly qualified name is required.
    /g /generator:TYPE Code Generator type name, followed by ','
                       and assembly file name.
    /o /outputdir:PATH The directory where to generate the code or schemas.
    /n /namespace:NAME Namespace for the generated code.
    /t /type:NAME      Type for which to generate an xml schema.
                       Multiple types can be specified.
    /h /help           Output this help.

However, typing "xsdcxx man" shows some possible options like the ones 
presented on the example in your guide (cxx-parser, --xml-parser <expat 
or xerces>) but when I enter the command "xsdcxx cxx-parser --xml-parser 
expat hello.xsd" it returns "terminate called after throwing an instance 
of 'std::length_error' what():  basic_string::resize".

I have reinstalled xsdcxx, I have updated everything, reinstalled 
xsd-3.3.0 from your website but I'm stuck at this point. Without the 
files hello-pskel.hxx/cxx I don't see what I can do.

I'm open to suggestions.

Thank you for your attention and help.
Pedro Rocha.




More information about the xsd-users mailing list