XML文本:

<?xml version="1.0" encoding="utf-8"?>

<ECG xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id root="1.2.392.200111.1.2.2.20191015.141109"/>
<name>李思思</name>
<effectiveTime>
<low value="20191011110754.000" inclusive="true"/>
<high value="20191011110809.000" inclusive="false"/>
</effectiveTime>
</ECG>

读取方式:

XmlDocument doc = new XmlDocument();
doc.Load(@"D:\XMLFile\FtSampledData.xml"); XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance"); XmlElement root = doc.DocumentElement; XmlNode name = root.SelectSingleNode("name", nsmgr);

总结:没有什么特殊的不同,只要把相应的命名空间加上即可。 

05-11 13:38