I need a little help. I have an XML file in a web and I call that file with:
String URLString = "http://myweb.tld/myfile.xml";
var xmlDocument = new XmlDocument { XmlResolver = null };
xmlDocument.Load(URLString);
And reader works, no errors.
Now I want to read some tags in the XML, so I use:
XmlNodeList xnCheck = xmlDocument.SelectNodes("/blab/bla");
foreach (XmlNode xn in xnCheck)
if ((Text1.Text == xn["Name"].InnerText) & (Text2.Text == xn["Pwd"].InnerText))
{
status.Text = "Correct";
}
else status.Text = "Wrong data";
break;
}
When I try read, I always get “wrong data” and i don’t understand why.
This is XML file:
<?xml version="1.0" encoding="UTF-8"?>
<blap>
<bla>
<Name>name1</Name>
<Pwd>12345678</Pwd>
</bla>
<bla>
<Name>name2</Name>
<Pwd>87654321</Pwd>
</bla>
</blap>
Can anyone help me solve this problem?
Change the IF to be
That is two &’s not just one.