1
特定節點的值,我有以下XML文檔:選擇從XML
<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
<Path> blahblahblah </Path>
<PathValue> blahblahblah </PathValue>
<domainName> blahblahblah </domainName>
<SuperUserEmail> blahblahblah </SuperUserEmail>
<SuperUserName> blahblahblah </SuperUserName>
<UserName> blahblahblah </UserName>
<Password> blahblahblah </Password>
<connectionstring>Data Source=ABC\SQLEXPRESS;Initial Catalog=mail;User ID=sa;[email protected]</connectionstring>
</appSettings>
現在我已經從connectionstring
節點提取的完整路徑。我試着用下面的代碼:
XmlNodeList xnList = xml.SelectNodes("/appSettings/connectionstring");
但它似乎沒有工作。任何想法如何使其工作?
你可以分享你的錯誤的屏幕截圖 – 2013-02-14 04:48:01
我試過了。它沒有上傳。在調試它,我得到的是'System.XML.XMLelementlist' – Esha 2013-02-14 04:56:19
請參閱此鏈接「http://stackoverflow.com/questions/6442024/getting-specified-node-values-from-xml-document」我希望這可能會對你有所幫助 – 2013-02-14 04:59:45