"The XmlChoiceIdentifierAttribute allows you to assign a special enumeration value to each instance of the member. You must either create the enumeration yourself or it can be generated by the XML Schema Definition Tool (Xsd.exe). "
Of course they neglect to tell you how to persuade it (xsd) to do this. I'm afraid I'm new to this XML lark, perhaps someone may enlighten me?
My xml schema includes the following...
Expand|Select|Wrap|Line Numbers
- <xs:complexType name="Communications">
- <xs:choice maxOccurs="1">
- <xs:element name="serial" type="SerialPort" />
- <xs:element name="tcp" type="TCPConnection" />
- </xs:choice>
- </xs:complexType>
Expand|Select|Wrap|Line Numbers
- .
- /// <remarks/>
- [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
- [System.SerializableAttribute()]
- [System.Diagnostics.DebuggerStepThroughAttribute()]
- [System.ComponentModel.DesignerCategoryAttribute("code")]
- [System.Xml.Serialization.XmlTypeAttribute(Namespace="Anite/Terminal Automation Gateway")]
- public partial class Communications {
- private object itemField;
- /// <remarks/>
- [System.Xml.Serialization.XmlElementAttribute("serial", typeof(SerialPort))]
- [System.Xml.Serialization.XmlElementAttribute("tcp", typeof(TCPConnection))]
- public object Item {
- get {
- return this.itemField;
- }
- set {
- this.itemField = value;
- }
- }
- }
Simon