I am attempting to create a web service that reads an xml file and search for a node. But every time I get an error back which says return base.Channel.MymethodName(username);
XmlDocument doc = new XmlDocument();
doc.Load("C:\\CustomerDatabase.xml");
XmlNode root = doc.DocumentElement;
string searchpath = "//CustomerInformation[CustomerName'" + name + "']";
XmlNode userNode = root.SelectSingleNode(searchpath);
If I block out this part of the code everything else works, so I am thinking I am not doing this correct. I have read through all the posts I can on here, and still having no luck on the issues. Any suggestions or help?
Update:
My xml file looks like this
<CustomerInfo>
<CustomerInformation>
<name>JohnDoe</name>
</CustomerInformation>
</CustomerInfo>
I started commented each line of my code and i think this is one is problem
XmlNode userNode = root.SelectSingleNode(searchpath);
any ideas how I can fix that
2nd Edit:
I am attempting to open the file so that I can see if the name that is inputted is in the XML file. so pretty much a person types in JohnDoe if it exist it send a string saying person already exists.
Try,
Or use Linq-XML.