I have a XML document with elements like
<offer>
<field name="name"><![CDATA[DS SIL CON]]></field>
<field name="merchant_id"><![CDATA[3001]]></field>
.....
</offer>
I know not the best XML! Now I am selecting different values by XPath
having an XmlNode representing the <offer> element. Now when I try something
like this
XmlNode dataNode = offerNode.SelectSingleNode("field[@name='merchant_id']");
this works fine and returns a result. However the following query runs but
returns nothing:
XmlNode dataNode = offerNode.SelectSingleNode("field[@name='name']");
Now the only thing I can think of is that the attribute and text have the
same value. I tried the same query as an XPathExpression:
XPathExpression searchData = navigator.Compile(("field[@name='name']");
XPathNodeIterator iter = navigator.Select(searchData);
and surprise surprise it works.
So is this a bug in using the SelectNodes() or SelectSingleNode methods on
an XmlNode?