Reputation: 575
I've got an object whose XML structure is dynamic and can change runtime based on the Application.
What I would like to do is specify the XML Element location for each property's declaration. However, it seems this can not be done in runtime and needs to be statically set. Is there another method for accomplishing what I would want to do?
public class user
{
[System.Xml.Serialization.XmlElement(XMLLocation.PersonUsername)]
public String name;
}
Upvotes: 1
Views: 234
Reputation: 11040
Since the data is the same but passed along to different applications I'd recommend using the same internal XML and processing it with XSLT before passing it along.
Implementing IXmlSerializable is certainly possible, so are other approaches, but you'll find yourself writing complex and unmaintainable code.
Upvotes: 1