Click here to Skip to main content
14,972,912 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
i am loading a Web.Config into a XmlDocument. It is successfully read.
System.Xml.XmlElement Root = xmlDocument.DocumentElement;
                System.Xml.XmlNode node = Root.SelectSingleNode("//appSettings/add[@key='ipAdresseWebServer']");


after that, "Root" has the value "configuration" which is right, but "node" always stays "null" :/
I just can't find the problem.
Greetings Tobi
Posted

This tells me there's something wrong with your parameter.
   
Thats right, he doesn't find the node.
The XML looks like this:
<   ?xml version="1.0"?>
 <  configuration      xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <   appsettings>
   < add key="ipAdresseWebServer" value="XXX.XXX.XXX.XXX:XX" />
  <   /appsettings>
 <  /configuration>


So whats wrong?
   
v4
XML is case sensitive. (appsettings vs. appSettings)
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900