string xml = "<ABCProperties> <Action> Yes | No | None </Action><Content>
<Header> Header Text </Header><Body1> Body Paragraph 1 </Body1>
<BodyN> Body Paragraph N</BodyN></Content><IsTrue> true | false </IsTrue>
<Duration> Long | Short </Duration></ABCProperties>";
Here, from the XML, I want to extract certain strings. First is the Header Text in the Header tags.
When, I try
XDocument doc = XDocument.Parse(xml);
var a = doc.Descendants("Header").Single();
I get variable a = <Header> Header Text </Header>. How can I get only var a = Header Text?
Secondly, I want to get text of all the Body paragrahs. It can be either Body1, Body2 or BodyN. How can I get contents of all Body tags.
Can anyone help me with this?
<Header> Header Text </Header>- it's just a variable. If you convert the variable to a string, you might get"<Header> Header Text </Header>but you should clarify that that's what you mean.