Pablo Castilla
Pablo Castilla

Reputation: 2741

parsing xml node with a value and a node inside

We have the following XML

<A>
   <B>0
      <C>4</C>
    </B>
</A>

As you can see there is a node C after the value of node B. We would like to parse it with Xml.Serialization tags (XMLElement, XMLRoot...) as we have done with the rest of the messages.

Any ideas?

Upvotes: 1

Views: 63

Answers (1)

Alexei Levenkov
Alexei Levenkov

Reputation: 100545

Such content of nodes called "mixed content".

I never needed to deal with XmlSerialization of such files. Looks like XmlRootAttribute could be used to serilize such data into list of strings:

[System.Xml.Serialization.XmlTextAttribute()]
public string[] Text {get;set;}

Upvotes: 1

Related Questions