So I have searched all I can, but cannot find the exact problem I am encountering.
This is my nested XML:
<Message>
<Foo>
<Bar>1</Bar>
<Baz>2</Baz>
<Qux>3</Qux>
</Foo>
</Message>
And I have a class in C#:
[Serializable()]
[XmlRoot("Message")]
public class Foo
{
[XmlElement("Bar")]
public string Bar { get; set; }
[XmlElement("Baz")]
public string Baz { get; set; }
[XmlElement("Qux")]
public string Qux { get; set; }
}
Now Message is just arbitrary and gets sent with every XML message. So every XML message sent will have a <Message> tag around it. When I put Foo as the XmlRoot it throws an error, and with Message as XmlRoot it doesn't recognize the child elements. I am looking for a clean and easy solution to this. Thanks!