Array of Objects vs Object with Array

Apr 19, 2013 at 10:52 AM
Hello,

I generate Csharp code from an XSD file.
The xsd contains an ComplexType "WorkspaceDefinition", that has, amongst others, an element "Domains" from type "ArrayOfDomain". This type is also defined in the XSD. It contains a sequence from type "Domain".

My problem:
In the resulting Csharp code the Class "WorkspaceDefinition" contains a Parameter from type "List<Domain>". What I would expext it to have is a Parameter from type "ArrayOfDomain".
The class "ArrayOfDomain" is generated in the CSharp file, but never referenced.


Is this a Problem in the xsd2code configuration?



The xsd:
<xs:complexType name="WorkspaceDefinition">
    ...
      <xs:element name="Domains" type="esri:ArrayOfDomain">
        <xs:annotation>
          <xs:documentation>The list of Domains.</xs:documentation>
        </xs:annotation>
      </xs:element>
   ...
  </xs:complexType>
<xs:complexType name="ArrayOfDomain">
    <xs:annotation>
      <xs:documentation>Generic array of objects.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" name="Domain" type="esri:Domain" />
    </xs:sequence>
  </xs:complexType>
<xs:complexType name="Domain" abstract="true">
    <xs:annotation>
      <xs:documentation>
        Domain Properties control and their merge split policies control.
      </xs:documentation>
    </xs:annotation>
   ...
  </xs:complexType>
The resulting Csharp Code:
public partial class WorkspaceDefinition {
        
        private esriWorkspaceType workspaceTypeField;
        
        private string versionField;
        
        private List<Domain> domainsField;
        
        private List<DataElement> datasetDefinitionsField;
        
        private XmlPropertySet metadataField;
        
        public WorkspaceDefinition() {
            this.metadataField = new XmlPropertySet();
            this.datasetDefinitionsField = new List<DataElement>();
            this.domainsField = new List<Domain>();
        }
        
       ...
        [System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]        [System.Xml.Serialization.XmlArrayItemAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
        public List<Domain> Domains {
            get {
                return this.domainsField;
            }
            set {
                this.domainsField = value;
            }
        }
        
        [System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
        [System.Xml.Serialization.XmlArrayItemAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
        public List<DataElement> DatasetDefinitions {
            get {
                return this.datasetDefinitionsField;
            }
            set {
                this.datasetDefinitionsField = value;
            }
        }
        
        public XmlPropertySet Metadata {
            get {
                return this.metadataField;
            }
            set {
                this.metadataField = value;
            }
        }
    }

public partial class ArrayOfDomain {
        
        private List<Domain> domainField;
        
        public ArrayOfDomain() {
            this.domainField = new List<Domain>();
        }
        
        public List<Domain> Domain {
            get {
                return this.domainField;
            }
            set {
                this.domainField = value;
            }
        }
    }