从 XML 中提取内部文本
本文关键字:内部 文本 提取 XML | 更新日期: 2023-09-27 18:30:18
<?xml version="1.0" encoding="utf-8"?>
<my:myFields ..........>
<my:ProjectDeliverables>
<html xmlns="http://www.w3.org/1999/xhtml" xml:space="preserve">
<p>
<span id="ms-rterangepaste-start"></span>
<div>Deliverables will include but are not limited to:</div>
<div><span style="font-family:symbol"><span>·<span style="font:7pt 'times new roman'"> </span></span></span>Feature sets identified by management for Production release of Pfx.Net application.</div>
<div><span style="font-family:symbol"><span>·<span style="font:7pt 'times new roman'"> </span></span></span>SQL server performance tuning reports</div>
<div><span style="font-family:symbol"><span>·<span style="font:7pt 'times new roman'"> </span></span></span>SQL alter scripts for each development build</div>
<span id="ms-rterangepaste-end"></span>
</p>
</html>
</my:ProjectDeliverables>
我正在使用以下内容:-
XmlNodeList nodelist1 = xml.GetElementsByTagName("my:myFields");
key_deliverables = node["my:ProjectDeliverables"].InnerText;
但这行不通。
XmlNodeList nodelist1 = xml.GetElementsByTagName("my:myFields");
var key_deliverables = nodelist1[0].InnerText;
您需要包含以下 xml 命名空间声明:
WITH XMLNAMESPACES ('http://schemas.microsoft.com/office/infopath/2003/myXSD/2013-09-10T21:30:46' as my