views:

139

answers:

1

One of my nodes inmy xml file is as follows.

  <LOGIN_ID NAME="Kapil">
    <SEARCH_ID>Kapil Koli</SEARCH_ID>
    <GUID>111</GUID>
    <FIRST_NAME>Kapil</FIRST_NAME>
    <LAST_NAME>Koli</LAST_NAME>
    <EMAIL_ID>[email protected]</EMAIL_ID>
    <PASSWORD>abc123**</PASSWORD>
  </LOGIN_ID>

The code I am using is -

XmlDocument document = new XmlDocument();
document.Load(_XmlFileName);
nodeList = document.SelectNode."USERS/LOGIN_ID[contains(SEARCH_ID,'Kapil')";
nodeList = document.SelectNode."USERS/LOGIN_ID[contains(EMAIL_ID,'[email protected]')";

I want to use select node which will accept search_id and login_id as attributes to search? If either search_id or email_id is wrong, I want to return null. How could I do this?

thanks. kapil.

+2  A: 
USERS/LOGIN_ID[contains(SEARCH_ID,'Kapil') and contains(EMAIL_ID,'[email protected]')]

should do the trick.

Christian Hayter
Thanks, it worked.
kapil