Question

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>kapil@abc.co.in</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,'kapil@abc.co.in')";

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.

Was it helpful?

Solution

USERS/LOGIN_ID[contains(SEARCH_ID,'Kapil') and contains(EMAIL_ID,'kapil@abc.co.in')]

should do the trick.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top