Generate a class for a schema with an abstract complex type

I am working with some scheme that defines an abstract complex type, for example.

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

This type then refers to 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: MySchema.xsd 'processing error occurred. - Error generating code for the DataSet. '' - It is not possible to convert the contents of the input xml file to a DataSet. DataSet cannot create abstract ComplexType for data node. - DataSet cannot create abstract ComplexType for data node.

This does not look like the wrong scheme. Anyone else run into this problem?

thanks

Nick

+4
c # xml schema xsd
source share
3 answers

After evaluating several different tools based on the scheme and code, the only thing we found that could deal with our scheme (very large and extremely complex) was Liquid XML ( http://www.liquid-technologies.com/ ) .

+3
source share

I have never encountered this problem, but I quickly realized that xsd.exe has many 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.

This one has its warts, but the code that it generates is much better and it is free. In addition, it is extensible, and adding your own plugins for it is actually quite simple.

Perhaps he will not have the same restriction?

+2
source share

I know this is an old question, but this week I needed an answer to this question. I tried Liquid Studios, as @ ng5000 suggested, and found that the software is very awkward. Also, the cs output was so complex that it gave me more than 800 lines of code for a single object with 12 simple properties.

I would highly recommend Xml2CSharp , a web-based tool that generates nice simple POCOs with XML attribute decorators.

0
source share

All Articles