XmlNode.InnerText
- by Jonathan.Peppers
We have XML like so:
<Example>
<Node>Some text here
<ChildNode>Child 1</ChildNode>
<ChildNode>Child 2</ChildNode>
</Node>
</Example>
We are using XmlDocument to parse this.
When we have the XmlNode of the Node element, XmlNode.InnerText returns us this:
"Some text hereChild 1Child2"
How can we get the inner text of the Node element without the child nodes' inner text? We don't really want to use any Regex or string splitting to accomplish this.
Note: We also don't want to switch to using a different set of classes to parse this XML, it would be too much of a code change.