XmlNode.SelectNode with multiple attribute.

Posted by kapil on Stack Overflow See other posts from Stack Overflow or by kapil
Published on 2010-03-23T11:42:47Z Indexed on 2010/03/23 11:53 UTC
Read the original article Hit count: 340

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about Xml

Related posts about selectnodes