Why not use the specified xsd type ?

Feb 15, 2011 at 4:47 PM
Edited Feb 15, 2011 at 5:04 PM

Maybe related to my another discution : http://xsd2code.codeplex.com/discussions/246128

My another problem (personal, maybe) with the generated code.

If you are using in the xsd a simple list type :

<xs:complexType name="TestsType">
  <xs:sequence>
   <xs:element name="Test" minOccurs="0" maxOccurs="unbounded" type="TestType"/>
  </xs:sequence>
</xs:complexType>

Use this simple list type on a sequence :

<xs:complexType name="Toto">
  <xs:sequence>
   <xs:element name="titi" type="xs:string" />
   <xs:element name="tests" type="TestsType" />
  .....

Then the generated class Toto containe this property :

public List<TestType> tests {...}

Me i am more waiting a property as define by the xsd :

public TestsType tests {...}

The type should be the type specified Tests, no ?
This can give the possibility to add some feature to the specified type. Tests.

Morever a class Tests is generated by Xsd2Code but not used !

Feb 15, 2011 at 5:00 PM
Edited Feb 15, 2011 at 5:04 PM

If I modify the TestType to :

 

<xs:complexType name="TestsType">
  <xs:sequence>
   <xs:element name="Test" minOccurs="0" maxOccurs="unbounded" type="TestType"/>
  </xs:sequence>
  <xs:attribute name="hack"/>
</xs:complexType>

 

Then, the generated code is like i want (but i don't need this attribute !!!)

The property genereted in the class Toto is :

 

public TestsType tests {...}

 

and no more

 

public List<TestType> tests {...}