S
Soulless
Hi, I am trying to retrieve a value from a node in an XML document and
cannot.. .any ideas?
Here is my code:
string isDBConfig =
System.IO.Directory.GetCurrentDirectory().ToString() + "\
\dsconfig.XML";
XmlDocument doc = new XmlDocument();
doc.Load(isDBConfig);
/// I use this line to show me that the file truly is
loaded...
Console.WriteLine(doc.InnerXml.ToString());
// I have tried using the node and the full path...
Appconfig
always returns 'null'...
XmlNode Appconfig = doc.SelectSingleNode("//
logging_option");
string s;
/// I don't worry too much about this because of the 'null' above...
when it gets here it crashed because of the null...
s = Appconfig.SelectSingleNode("//
logging_option").InnerText;
//XmlNode option =
doc.GetElementsByTagName("logging_option")[0];
Console.WriteLine(s);
Here is part of the file:
<?xml version="1.0" standalone="yes" ?>
- <dsConfig xmlns="http://tempuri.org/dsConfig.xsd">
- <AppConfig>
<extract_directory>c:\temp</extract_directory>
<logging_option>E</logging_option>
</AppConfig>
I want 'logging_option' value 'E' returned.
I cannot figure out what i'm doing wrong.
Thanks.
cannot.. .any ideas?
Here is my code:
string isDBConfig =
System.IO.Directory.GetCurrentDirectory().ToString() + "\
\dsconfig.XML";
XmlDocument doc = new XmlDocument();
doc.Load(isDBConfig);
/// I use this line to show me that the file truly is
loaded...
Console.WriteLine(doc.InnerXml.ToString());
// I have tried using the node and the full path...
Appconfig
always returns 'null'...
XmlNode Appconfig = doc.SelectSingleNode("//
logging_option");
string s;
/// I don't worry too much about this because of the 'null' above...
when it gets here it crashed because of the null...
s = Appconfig.SelectSingleNode("//
logging_option").InnerText;
//XmlNode option =
doc.GetElementsByTagName("logging_option")[0];
Console.WriteLine(s);
Here is part of the file:
<?xml version="1.0" standalone="yes" ?>
- <dsConfig xmlns="http://tempuri.org/dsConfig.xsd">
- <AppConfig>
<extract_directory>c:\temp</extract_directory>
<logging_option>E</logging_option>
</AppConfig>
I want 'logging_option' value 'E' returned.
I cannot figure out what i'm doing wrong.
Thanks.