开发者

XmlNode.SelectNode with multiple attribute

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.c开发者_StackOverflow中文版o.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.


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

should do the trick.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜