繁体   English   中英

c#select单节点xpath返回null

[英]c# select single node xpath returns null

我在ac #project中有一个app配置我需要在运行时编辑。 作为其中的一部分,我有一个自定义部分集合,我需要为其选择一个节点。 这是我的即时窗口中的xml和selection语句:

node = xmlDoc.SelectSingleNode("//Customers/add[@id='1']");  

空值

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <section name="customers" type ="ImporterSupport.CustConfigSection, ImporterSupport"/>
    </configSections>
    <customers>
        <add id ="1" license="gh620g0g0g0g0g3p" ServerAddress ="localhost"  ServerPort="8292" SettingsFile ="AutoImportTest.txt" Confirm ="false" DisableRemoveRecips="true" DisableRecoverRecips="true" DisableAlphaId ="true" />
    </customers>
</configuration>

Xml区分大小写。 采用

var node = xmlDoc.SelectSingleNode("//customers/add[@id='1']");

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM