I have the following xml (see below) that I want to de-serialize to the class Rule. I have not found the magical combination of xml attributes that allows me to store as text the xml content from the Parameters node in my xml input.
I need an object of type Rule having the property Name = "Rule1"
and property Parameters =
"<User>Tommy</User><Database>local</Database>"
Thanks in advance.
<Rule>
<Name>Rule1</Name>
<Parameters>
<User>Tommy</User>
<Database>local</Database>
</Parameters>
</Rule>
class Rule
{
[XmlElement("Name")]
public string Name { get; set; }
[XmlElement("Parameters")]
[XmlText(typeof(string))]
public string Parameters { get; set; }
}
EDIT: I don't think I have been clear enough. I need to have the entire node named Parameters serialized to a string not to a custom class. As an example if an xml document was processed containing this
<Parameters>
<X>xxxx</X>
<Y>yyyy</Y>
</Parameters>
I need it deserialized to the string "<X>xxxx<Y>yyyy" If a different xml document contained this
<Parameters>
<A>aaaa</A>
<B>bbbb</B>
</Parameters>
I need it deserialized to the string "<A>aaaa<B>bbbb"