XML is case sensitive hence Xml parser (XmlDocument) too...
- by Narendra Tiwari
XML is case sensitive hence Xml parser (XmlDocument) too...
In below example I am trying to search the <user> element node with name attibute as 'pupu'.
<user name="PuPu" fullname="Priyanka T" email="[email protected]" />
::translate() functon esures the case insensitive comparision in Xpath expression.
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("<xml file to load>");
XmlElement userElement = (XmlElement)xmlDoc.DocumentElement.SelectSingleNode("//user[translate(@name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') ='pupu']");