My xml looks like this
<Element> text <B>text<B></Element>
Unknown number of B tags or tags even of a different name.
How do i get the text from these? so it would be like this
text text
using linq to xml
My xml looks like this
<Element> text <B>text<B></Element>
Unknown number of B tags or tags even of a different name.
How do i get the text from these? so it would be like this
text text
using linq to xml
You could do the following assuming XElement
was pointing to the Element tag
var root = GetRoot();
var text = root.Elements("B").Select(x => x.Value);
As you need any children not just the "B"s if root is your Element tag as as XElement
var text = string.Empty;
root.DescendentsAndSelf().Select(x => text += x.Value);
Kindness,
Dan