我有以下 XML 文档信息:
<Document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 CDA_SDTC.xsd" xmlns="urn:hl7-org:v3" xmlns:cda="urn:hl7-org:v3" xmlns:sdtc="urn:hl7-org:sdtc">
<component>
<structuredBody>
<component>
<section>
<templateId root="2.16.840.1.113883.10.20.22.2.45" />
<title>Instructions</title>
<text>
<paragraph>Putting instructions into the node to read out into the text area.</paragraph>
</text>
</section>
</component>
</structuredBody>
</component>
</Document>
我必须让 VB.NET 页面加载 XML 文档才能查找此特定信息并将段落节点的内容放入网页上的文本区域表单字段中。这没有问题,但是文档根目录添加了一些命名空间信息,现在它无法正常工作。这是 VB.NET 代码:
m_nodelist = m_xmld.SelectNodes("Document/component/structuredBody/component/section")
For Each m_node In m_nodelist
If m_node("title").InnerText = "Instructions" Then
Dim Instructions As String = m_xmld.SelectSingleNode("Document/component/structuredBody/component/section[title='Instructions']/text/paragraph").InnerText
txtInstructions.Text = Replace(patientInstructions, "<br>", Chr(10) & Chr(13))
hfInstructionsOld.Value = Replace(patientInstructions, "<br>", Chr(10) & Chr(13))
End If
Next
我认为它以前可以工作,因为根节点没有定义命名空间。现在确实如此。我不知道如何更改 VB.NET 代码来解决这个问题。