SelectNodes non-standard behaviour

Topics: Developer Forum
Mar 5, 2013 at 12:19 AM
So I ran into a most unusual issue, for which I'm assuming the answer is trivial, but for some reason it appears to escape my gaze.

I have the following XML document (Names had been modified to protect the innocent):
<A><B>C</B></A>

I load it as a document, and run multiple searches on it, all return the expected results. Except for the last, simplest one.
doc.DocumentNode.SelectNodes("//B"); returns null. It shouldn't. It should return a single node.
I thought my XPath was off, but loading the same XML string as a System.Xml.Document and running SelectNodes("//B"); Does indeed return the desired node.

What am I doing wrong?
Mar 5, 2013 at 1:05 AM
Lowercase. It has to be lower case.
It happened to me last time. I made a huge note which I disregarded. I wish there was a note in the implementation, or in the documentation. But oh well.
//b saves the day.
Mar 5, 2013 at 1:08 AM
Hi itamaram,

What version do you have? Think I came across this before with someone but the new version it works 1.4.6

Just checking now
Mar 5, 2013 at 1:18 AM
Ok my mistake.. the search string has to be lowercase but the html can be upper or lowercase.
Mar 5, 2013 at 2:58 AM
shouldn't it return an empty List<Node> ? why null ?