![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
| | Thread Tools | Display Modes |
| | #1 (permalink) | ||||||||||||
| Guest | 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" /
<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 | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Checking a list and adding item if not present | Jsimpson | PowerShell | 2 | 07-23-2008 08:44 AM |
| Re: Display Item in Drop Down List | McKirahan | VB Script | 1 | 06-13-2008 11:03 AM |
| WPF: Own Control Derived From TextBox | hufaunder@yahoo.com | Avalon | 5 | 07-29-2007 08:49 PM |
| GUI application unable to display info derived from registry | Tony | Vista General | 3 | 02-05-2007 08:44 AM |