dha*_*ton 1 c# xml linq-to-xml
在我的问题上,我在XElement中有以下XML.完整的XML中可以有许多这些"标识符"节点,我的导航工作到此为止.
<Identifiers>
<identifier>
<Type>MR</Type>
<Value>123321</Value>
<Authority></Authority>
</identifier>
<identifier>
<Type>AN</Type>
<Value>123321-01</Value>
<Authority></Authority>
</identifier>
<identifier>
<Type>PN</Type>
<Value>123321</Value>
<Authority></Authority>
</identifier>
</Identifiers>
Run Code Online (Sandbox Code Playgroud)
这是Linq-To-XML:
id = xd.Root.Element("Patient");
id = id.Element("Identifiers"); //At this point "id" contains the above XML.
id = id.Elements("Identifier").FirstOrDefault(x => x.Element("Type").Value == "AN");
Run Code Online (Sandbox Code Playgroud)
是它崩溃的最后一个语句,并返回null.
我在这里错过了什么?
| 归档时间: |
|
| 查看次数: |
99 次 |
| 最近记录: |