tags:

views:

49

answers:

1

In order to parse

<field key="AA" code="BB">CC</field>

I suppose it should be something like

[XmlRoot("field")]
public Field 
{
   // Get AA
   [XmlAttribute("key")]
   string key;

   // Get BB
   [XmlAttribute("id")]
   string id;

}

Then how to get CC? I have looked at many places, but there are no solutions??

+1  A: 
[Serializable()]
[XmlRoot("field")]
[XmlElement()]
public Field 
{
   // Get AA
   [XmlAttribute("key")]
   string key;

   // Get BB
   [XmlAttribute("id")]
   string id;

   string cc;

}
Joel Coehoorn
Thanks! But which .net version are you using? It seems I could not find XmlValue in 3.5 sp1.
Arg, don't know what I was thinking. Edit comming.
Joel Coehoorn
Thanks a lot ~~~~~~~~~~