XML : Deserialize XML CData with attribute

I have an xml file and I try to write a type for it. At a certain point my brain freezes.

This xml is as minimal as I can write it.

  <Level ID="SomeID">      <Selection Name="AnotherID">          <Content><![CDATA[SomeData]]></Content>      </Selection>  </Level>    

In cs I want to write a class as a type for the xmlserializer.

  public class Level  {      [XmlAttribute]      public string ID {get; set;}      public ??? Selection {get; set;}      //What is the type of CDATA      //Where would the Name Attribute go?  }    

Somehow the Selection has to be a class with an attribute and also the type of Selection is CData. Whatever CData is it would be a standard type and so I could not set the Name Attribute.

How do I resolve this in the cs class? - the xml is legacy and can not be changed now.

No comments:

Post a Comment