XML is case sensitive hence Xml parser (XmlDocument) too...
Posted
by Narendra Tiwari
on Geeks with Blogs
See other posts from Geeks with Blogs
or by Narendra Tiwari
Published on Tue, 23 Mar 2010 04:53:09 GMT
Indexed on
2010/03/23
5:43 UTC
Read the original article
Hit count: 410
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']");
© Geeks with Blogs or respective owner