【发布时间】:2013-08-15 11:59:01
【问题描述】:
我需要通过代码删除结果标签内的链接。
这是我的 xml 文件:
<?xml version="1.0" encoding="utf-8"?>
<result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://www.cfhdocmail.com/TestAPI2/Result.xsd https://www.cfhdocmail.com/TestAPI2/Result.xsd" xmlns="https://www.cfhdocmail.com/TestAPI2/Result.xsd">
<data>
<key>MailingGUID</key>
<value>3699f54b-a05c-45d9-9f91-2d65fea9e2f3</value>
</data><data>
<key>OrderRef</key>
<value>52177</value>
</data>
</result>
但我想通过代码清空结果标签。我使用了这个代码:
XmlDocument xml = new XmlDocument();
xml.Load(Server.MapPath("~/XMLFile1.xml"));
// var xdoc = XDocument.Load(xmlFile);
var configuration = xml.DocumentElement.SelectSingleNode("result");
if (configuration != null)
{
// code...
}
我需要删除结果标签内的链接。
【问题讨论】:
-
哪些链接?结果节点上的三个属性的值中包含链接。
-
@mortb 我需要删除 xsd 文件,因为它们正在制造问题。xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:schemaLocation="cfhdocmail.com/TestAPI2/Result.xsd cfhdocmail.com/TestAPI2/Result.xsd" xmlns="cfhdocmail.com/TestAPI2/Result.xsd