I have this xml
<Report Name="Report">
<Input>
<Content>
<XmlInput>Any xml inside the input tag should be deserialised as string</XmlInput>
<XmlInput>Any xml inside the input tag should be deserialised as string</XmlInput>
</Content>
<!--<XmlInput>Any xml inside the input tag should be deserialised as string</XmlInput>-->
</Input>
</Report>
and this class
[XmlRoot("Report")]
public class Report
{
[XmlAttribute]
public string Name { get; set; }
public Input Input { get; set; }
}
public class Input
{
[XmlElement]
public string Content { get; set; }
}
I am using the following code to deserialize the xml
string path = @"C:\temp\myxml.xml";
var xmlSerializer = new XmlSerializer(typeof(Report));
using (var reader = new StreamReader(path))
{
var report = (Report)xmlSerializer.Deserialize(reader);
}
The problem here is, I want the xml content inside the content element to be deserialized as a string. Is this possible?
<Content>
<XmlInput>Any xml inside the input tag should be deserialised as string</XmlInput>
<XmlInput>Any xml inside the input tag should be deserialised as string</XmlInput>
</Content>