![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Why XSD.exe does not add XmlArrayItemAttribute for the derived type in the list item? I have this XSD schema. I used XSD.exe to create the cs file, but only XmlArrayItemAttribute for the base type is specified for the list item (Not the derived type). Why is the derived type not added? Can anyone tell me how to solve this problem? My XSD Schema: <?xml version = "1.0" encoding = "UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://example.org/" xmlns="http:// example.org/" elementFormDefault="qualified"> <xsd:element name="baseInstance" type="MyBaseType" abstract="true" / Quote: > <xsd:sequence> <xsd:element name="Field1" type="xsd:string"/> <xsd:element name="Field2" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="BaseListType"> <xsd:sequence> <xsd:element maxOccurs="unbounded" minOccurs="0" ref="baseInstance" /> </xsd:sequence> </xsd:complexType> <xsd:element name="BaseList" type="BaseListType" /> <xsd:element name="derivedAInstance" type="DerivedTypeA" substitutionGroup="baseInstance" /> <xsd:complexType name="DerivedTypeA"> <xsd:complexContent> <xsd:extension base="MyBaseType"> <xsd:attribute name="ExtraInfoForA" type="xsd:string"/> </xsd:extension> </xsd:complexContent> </xsd:complexType> <xsd:element name="derivedBInstance" type="DerivedTypeB" substitutionGroup="baseInstance" /> <xsd:complexType name="DerivedTypeB"> <xsd:complexContent> <xsd:extension base="MyBaseType"> <xsd:attribute name="ExtraInfoForB" type="xsd:string"/> </xsd:extension> </xsd:complexContent> </xsd:complexType> <xsd:element name="myThings" type="MyThingsType" /> <xsd:complexType name="MyThingsType"> <xsd:sequence> <xsd:element ref="BaseList" /> </xsd:sequence> </xsd:complexType> </xsd:schema> The following code for the MyThingsType class was generated. Why derivedAInstance and derivedBInstance are not added? /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.312")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http:// example.org/")] [System.Xml.Serialization.XmlRootAttribute("myThings", Namespace="http://example.org/", IsNullable=false)] public partial class MyThingsType { private MyBaseType[] baseListField; /// <remarks/> [System.Xml.Serialization.XmlArrayItemAttribute("baseInstance", IsNullable=false)] <-- Why derivedAInstance and derivedBInstance are not added here by xsd.exe? public MyBaseType[] BaseList { get { return this.baseListField; } set { this.baseListField = value; } } } Regards, Peter |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
Deleting unused item from Startup list. Possible? | General Discussion | |||
| Checking a list and adding item if not present | PowerShell | |||
| Re: Display Item in Drop Down List | VB Script | |||