XML Search

Ice725

Active member
Joined
Apr 19, 2004
Messages
31
Trying to find out how to do a search that is not case-sensitive, I found the following code:

Code:
<?xml version="1.0" encoding="utf-8"?>
<Users>
  <User>
    <Name>sonu</Name>
    <Password>sonu</Password>
  </User>
</Users>
</code>
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>

http://www.devx.com/DevX/Tip/21293

This works, except if you capitalize the first letter: Sonu, instead of the lower-case sonu, in the XML file

Anyone familiar with the translate function?
 
Back
Top