How do I resolve the error “Expression must evaluate to a node-set” when checking for the existence of a node?

后端 未结 3 718
盖世英雄少女心
盖世英雄少女心 2021-01-17 10:28

I\'m attempting to check for the existence of a node using the following .NET code:

xmlDocument.SelectSingleNode(
        String.Format(\"//ErrorTable/Projec         


        
3条回答
  •  太阳男子
    2021-01-17 10:51

    Try:

    Node node = xmlDocument.SelectSingleNode(String.Format("//ErrorTable/ProjectName = '{0}'", projectName));
    
    if (node != null) {
        // and so on
    }
    

    Edit: silly error

提交回复
热议问题