tags:

views:

780

answers:

2

I'm working with some schema which defines an abstract complex type, eg.

<xs:complexType name="MyComplexType" abstract="true">

This type is then referenced by another complex type in the schema:

<xs:complexType name="AnotherType">
  <xs:sequence>
    <xs:element name="Data" type="MyComplexType" maxOccurs="unbounded"/>
  </xs:sequence>
</xs:complexType>

When I run "xsd.exe /d /l:CS MySchema.xsd" I get this error:

Error: There was an error processing MySchema.xsd'. - Error generating code for DataSet ''. - Unable to convert input xml file content to a DataSet. DataSet cannot instantiate an abstract ComplexType for the node Data. - DataSet cannot instantiate an abstract ComplexType for the node Data.

It doesn't seem to be invalid schema. Has anyone else run into this issue?

Thanks

Nick

+1  A: 

I have never run into this problem, but I quickly learned that xsd.exe has a lot of shortcomings. We started using CodeXS a long time ago. The product is a web service, but the code is available as a command-line tool.

It has its own warts, but the code it generates is much better and it is free. Plus, it is extensible, and adding your own plug-ins for it is actually pretty easy.

Possibly, it won't have the same limitation?

Brian Genisio
That works, but I won't be able to upload our company's xsd to a third party web service (no matter how briefly or whatever guarantees or in place). At least it seems to confirm that it's a xsd.exe issue :(
ng5000
You don't have to worry about it. Actually, you can download their source and compile it to an exe that you run locally -- http://www.bware.biz/default.htm?http://www.bware.biz/DotNet/Tools/CodeXS/WebClient/GenerateInput.aspx
Brian Genisio
We use the command-line version and run it as a pre-build step in our solution.
Brian Genisio
+1  A: 

After evaluating several different schema-to-code tools the only one we found that was able to deal with our schema (very large and extremely complicated) was Liquid XML (http://www.liquid-technologies.com/).

ng5000