在针对xml有多层级时候会遇到数据集解析时候处理麻烦解析方法也不知道时候可以参考如下方法人
入参如下:
<Report_Result>
<Report_Info>
<ext_lab_code>kingmed</ext_lab_code>
<lis_Barcode>15112121</lis_Barcode>
<ext_Barcode>XACS220330</ext_Barcode>
<ext_checkItem />
<pat_name>啊倒萨打算啊</pat_name>
<pat_age />
<pat_height />
<pat_wight />
<pat_pre_week />
<pat_id>1555</pat_id>
<pat_bedNo />
<result_info>
<result_seq>1</result_seq>
<ext_compound_item>00.02428</ext_compound_item>
<ext_compound_name>血项(含网织红计数)</ext_compound_name>
<ext_combine_code>ZH00061</ext_combine_code>
</result_info>
<result_info>
<result_seq>2</result_seq>
<ext_compound_item>00.02428</ext_compound_item>
<ext_compound_name>项(含网织红计数)</ext_compound_name>
<ext_combine_code>ZH00 </ext_combine_code>
</result_info>
XmlDocument xmldoc = new XmlDocument();xmldoc.LoadXml(richTextBox1.Text);//获取xml XmlNodeList topM = xmldoc.SelectNodes("Report_Result/Report_Info/result_info");//解析集合foreach (XmlElement element in topM){string id = element.GetElementsByTagName("result_unit")[0].InnerText;//具体入参string domainName = element.GetElementsByTagName("result_department")[0].InnerText;//具体入参}
关于需要引用的类如下所示
using System.Xml;
using System.IO;
using System.Collections;
本文发布于:2024-01-29 05:48:22,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170647850513136.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |