I want to save some configuration information about a specific server machine in some kind of XML file.
I started by deciding on the information structure, hand coding it in XML, and then using VS.NET to create a schema (.xsd file) for me. Since this information regarded how the machine was configured, I used the
.config
extension.
In my code, I tried to use the
SelectSingleNode(string xpath)
method to get the node that I wanted, but it kept returning
null
. It was my first time using XML files with .NET or using xpaths. I thrashed for a few hours until I determined that it was the top level tag's xmlns attribute.
<ServerInfo xmlns="http://tempuri.org/ServerInfo.xsd">
If I cut out the xmlns attribute, the
SelectSingleNode(string xpath)
method returned the node that I needed. I tried renaming the file to change the file extension to
.xml
extension, but that didn't help, either.
For now, I am just continuing on without the attribute. It would be nice, though, for the XML file to be aware of the schema so that when editing the file, Intellisense could be utilized.
Anyone understand what my problem is with the
xmlns
attribute?
David S. Alexander
Kettley Publishing
20271 SW Birch Street, 2nd Floor
Newport Beach, CA 92660-1752