Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Home » Tip Bank » XML
Language: XML
Expertise: Beginner
Jun 8, 2004

Perform a Case-sensitive Search in .NET Using XPath

The following code shows to how to perform a case-sensitive search in .NET using XPath.

XML File:


<?xml version="1.0" encoding="utf-8"?>
<Users>
  <User>
    <Name>sonu</Name>
    <Password>sonu</Password>
  </User>
</Users>
</code></pre>
Code File:

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Xml" %>
<%@ Page Language="C#" Debug="true" %>

<script  runat="server">
void Page_Load(object sender, System.EventArgs e){
    if(!Page.IsPostBack){
        XmlDocument xmlDoc = new XmlDocument();
        xmlDoc.Load(Server.MapPath("user.xml"));
	
	XmlNodeList nodeList = xmlDoc.SelectNodes("Users/User[Name = translate
('SONU', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')]");

	Response.Write(nodeList.Count.ToString());
    }
}
</script>
Sonu Kapoor
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date