Get content of XML node using c#

Posted by Adam S on Stack Overflow See other posts from Stack Overflow or by Adam S
Published on 2010-06-03T15:23:33Z Indexed on 2010/06/03 16:14 UTC
Read the original article Hit count: 362

Filed under:
|
|

Hi all, simple question but I've been dinking around with it for an hour and it's really starting to frustrate me. I have XML that looks like this:

  <TimelineInfo>
    <PreTrialEd>Not Started</PreTrialEd>
    <Ambassador>Problem</Ambassador>
    <PsychEval>Completed</PsychEval>
  </TimelineInfo>

And all I want to do is use C# to get the string stored between <Ambassador> and </Ambassador>.

So far I have:

XmlDocument doc = new XmlDocument();
doc.Load("C:\\test.xml");
XmlNode x = doc.SelectSingleNode("/TimelineInfo/Ambassador");

which selects the note just fine, now how in the world do I get the content in there?

© Stack Overflow or respective owner

Related posts about c#

Related posts about Xml