Cant generate nested array list from xsd

Jul 6, 2011 at 11:28 PM

Hello,

 

I am trying to generate c# code from the schema described below. For some reason it wont generate the a List<Row> in Grid.  Instead it generates List<string> Row which is wrong.  This works in a java code generator that I tried.  What am I doing wrong here?

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

	<xs:element name="Grid" type="Grid"/>
	<xs:element name="Row" type="Row"/>
	
	<xs:complexType name="Grid">
		<xs:sequence>
			<xs:element name="Row" type="Row" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="Row" >
		<xs:sequence>
			<xs:element name="Foo" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
</xs:schema>

// ------------------------------------------------------------------------------
//  <auto-generated>
//    Generated by Xsd2Code. Version 3.4.0.38967
//    <NameSpace>TTORenderer</NameSpace><Collection>List</Collection><codeType>CSharp</codeType><EnableDataBinding>False</EnableDataBinding><EnableLazyLoading>False</EnableLazyLoading><TrackingChangesEnable>False</TrackingChangesEnable><GenTrackingClasses>False</GenTrackingClasses><HidePrivateFieldInIDE>False</HidePrivateFieldInIDE><EnableSummaryComment>False</EnableSummaryComment><VirtualProp>False</VirtualProp><IncludeSerializeMethod>False</IncludeSerializeMethod><UseBaseClass>False</UseBaseClass><GenBaseClass>False</GenBaseClass><GenerateCloneMethod>False</GenerateCloneMethod><GenerateDataContracts>False</GenerateDataContracts><CodeBaseTag>Net35</CodeBaseTag><SerializeMethodName>Serialize</SerializeMethodName><DeserializeMethodName>Deserialize</DeserializeMethodName><SaveToFileMethodName>SaveToFile</SaveToFileMethodName><LoadFromFileMethodName>LoadFromFile</LoadFromFileMethodName><GenerateXMLAttributes>False</GenerateXMLAttributes><EnableEncoding>False</EnableEncoding><AutomaticProperties>False</AutomaticProperties><GenerateShouldSerialize>False</GenerateShouldSerialize><DisableDebug>False</DisableDebug><PropNameSpecified>Default</PropNameSpecified><Encoder>UTF8</Encoder><CustomUsings></CustomUsings><ExcludeIncludedTypes>False</ExcludeIncludedTypes><EnableInitializeFields>True</EnableInitializeFields>
//  </auto-generated>
// ------------------------------------------------------------------------------
namespace TTORenderer {
    using System;
    using System.Diagnostics;
    using System.Xml.Serialization;
    using System.Collections;
    using System.Xml.Schema;
    using System.ComponentModel;
    using System.Collections.Generic;
    
    
    public partial class Grid {
        
        private List<string> rowField;
        
        public Grid() {
            this.rowField = new List<string>();
        }
        
        [System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
        [System.Xml.Serialization.XmlArrayItemAttribute("Foo", typeof(string), Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
        public List<string> Row {
            get {
                return this.rowField;
            }
            set {
                this.rowField = value;
            }
        }
    }
    
    public partial class Row {
        
        private List<string> fooField;
        
        public Row() {
            this.fooField = new List<string>();
        }
        
        public List<string> Foo {
            get {
                return this.fooField;
            }
            set {
                this.fooField = value;
            }
        }
    }
}


Thanks for your help

Ryan