I'm trying to use the XPathSelectElement method of the System.Xml.XPath namespace, but for some reason it always returns null, and I have no idea why.
Here is the code:
TextReader stream = new StreamReader("config.ini"); XmlReader reader = XmlReader.Create(stream); XElement xml = XElement.Load(reader); XElement file = xml.XPathSelectElement("Config/File");
Here is the XML file that he is trying to read:
<?xml version="1.0" encoding="utf-8"?> <Config> <File>serp_feed.xml</File> </Config>
I tried a lot of things (adding a namespace table, changing XPath, etc.), but nothing works!
Any ideas?
source share