我有以下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;Password=sa@</connectionstring>
</appSettings>
现在我必须从connectionstring
节点中提取整个路径。我尝试使用以下代码:
XmlNodeList xnList = xml.SelectNodes("/appSettings/connectionstring");
但它似乎不起作用。知道如何让它发挥作用吗?
答案 0 :(得分:3)
TRY
XmlNode node = xml.DocumentElement.SelectSingleNode("/appSettings/connectionstring");
string nodeval=node.InnerText;