I've used XSD.EXE to convert an XSD into an object. That works fine and I can Deserialize using XMLSerializer just fine, except that the subelements which are generated as arrays don't populate.
private SubElements[] subelementsField;
/// <remarks/>
[System.Xml.Serialization.XmlArrayItemAttribute("SubElement", IsNullable=false)]
public SubElement[] SubElement {
get {
return this.subelementField;
}
set {
this.subelementField = value;
}
}
Even though there is data in the XML it just doesn't populate it when I use the following code:
// Deserialize
var result = serializer.Deserialize(new StringReader(data.XMLText.ToString()));
The root elements all work fine, just not the sub elements of this type of XML data:
<RootNode Weight="205" Year="1995">
<ParentNodeWhichWorksFine Contact="John Doe">
<SubElement SomeAttribute="123">
<Location>New York City</Location>
<Team>New York Pizza</Team>
</SubElement>
</ParentNodeWhichWorksFine>
</RootNode>
Am I missing some hints or something else that XSD.EXE is not including?