I need to now call another function which takes a custom class as an argument. The custom class has 2 properties: 1 is another custom class which contains the routing information and the other is of type System.Xml.XmlElement. The signature is something like this:

public class Message
Public header as HeaderInfo
Public payload as System.Xml.XmlElement
End Class

In essence, I need to convert everything within the

<PayLoad>

tags to a type System.Xml.XmlElement, maintaining the XML structure under PayLoad (I was able to generate the HeaderInfo class)

The XML schema is fixed and it will always have the same elements in it.