Load XML in C# InnerText



My English is sometimes quite crooked. Sorry for any spelling errors.


I have a C# service where I loop every 1 seconds trough a directory looking for XML files.


These XML files may look like this:



<?xml version="1.0" encoding="UTF-8"?>
<job>
<type>freelance</type>
<text>blah</text>
</job>


In a foreach I do the following:



var doc = new XmlDocument();
doc.LoadXml(xmlFile);

XmlNode xmltype = doc.DocumentElement.SelectSingleNode("/job/type");


And than I would like to use these strings to use in my program, however. Using xmltype.InnerText does not work. Documentation on MSDN does not provide me with anything new and I would like to know what I am doing wrong.


No comments:

Post a Comment