I have the following complex type in my XML schema:
<xs:complexType name="Widget" mixed="true">
<xs:sequence>
<xs:any namespace="##any" processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
The element in derived XML could contain string or could contained wellformed XML, hence the mixed attribute being true.
When I run this through the .NET XSD Tool I get the following generate code:
public partial class Widget{
private System.Xml.XmlNode[] anyField;
/// <remarks/>
[System.Xml.Serialization.XmlTextAttribute()]
[System.Xml.Serialization.XmlAnyElementAttribute()]
public System.Xml.XmlNode[] Any {
get {
return this.anyField;
}
set {
this.anyField = value;
}
}
}
The question I have is that I am not entirely sure how I should then use this. Ultimately I need to be able to set the value of widget to either:
<widget>Hello World!</widget>
or
<widget>
<foo>Hello World</foo>
</widget>
Both of which validate agaisnt the schema