簡體   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