In your example the XmlElement node named "Parent" has 2 children.
One has NodeType "text" the other has node type "Element".
You are interested in the Value property of the child that has
NodeType==XmlNodeType.Text.
if we change the eg to
<Parent>
first text child
<Child>blah</Child>
second text child
</Parent>
to better represent mixed mode content.
XmlNode "parentNode" is the node whose text value you are interested in .
If you are only interest in "first text child" just use
parentNode.ChildNodes[0].Value.
If you need the entire text content under parentNode - but not the
information from subelements
"first text child
second text child "
you will need to concatenate text values from all its children - like
so:
string value = string.Empty;
foreach(XmlNode child in parentNode.ChildNodes) {
if (child.NodeType == XmlNodeType.Text) {
value += child.Value;
}
}
Thanks,
Tejal.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Newbie" <an*******@discussions.microsoft.com> wrote in message
news:39**********************************@microsof t.com...
Yes but this returns all text, including any child nodes. I just want the
text associated with an element.
<Parent>Element Text
<Child>blah</Child></Parent>
I only want Element Text out of the above. This is what the old node.text
property used to provide, at least in MSXML 3.0
----- Dare Obasanjo [MSFT] wrote: -----
Have you tried the InnerText property?