xsd.exe duplicate class declaration

G

Guest

I generated a .cs class from a .xsd schema using the xsd.exe tool from Visual
Studio 2005 and noticed that is generating duplicate class declarations. This
happens because of my schema structure. I have an element, <QuestionList>,
that is a set of <Question> elements that is defined at the root of the
schema and but it can also be defined as child of an element <QuestionGroup>.
The tool, instead of generation a class for the QuestionList element,
generates it twice, one for the root element (class FormQuestion) and a class
FormQuestionQuestionGroupQuestion for <Question> element defined under
<QuestionGroup>.

Here is a portion of a xml instance based on the xsd schema:

<QuestionList>
<Question>
<QuestionGroup>
<QuestionList>
<Question>
....

xsd tool seems to generate classes as a string concatenation of the elements
throughout the schema hierarchy. Any way to avoid this class declaration
duplication?

Thanks
Miguel
 
G

Guest

Problem solved. Problem was with the schema. I inferred the schema from a xml
file and Visual Studio 2005 generated it without complex types, duplicating
the elements definition. I edited the schema and generated complex types from
the elements (option Make Complex Type) and regenerated the class.

Thanks
Miguel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top