使用c#合并两个xmls [英] merge two xmls using c#

查看:115
本文介绍了使用c#合并两个xmls的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一个xml保存在磁盘上



 <   AriReport  >  
< < span class =code-leadattribute> gen_rbl_Ship > 1 < / gen_rbl_Ship >
< < span class =code-leadattribute> gen_txt_LocationType > 常规< / gen_txt_LocationType >
< < span class =code-leadattribute> gen_ta_ReportSubject > 在船上发生意外< / gen_ta_ReportSu bject >
< gen_txt_NameofPort > missinig < / gen_txt_NameofPort >
< gen_ddl_TaskInvolved > 请检查此< / gen_ddl_TaskInvolved >







获得第二个xml运行时

 <   AriReport  >  
< gen_ddl_Location > c的cab rew < / gen_ddl_Location >
< gen_ta_WhatHappened > 请检查narative < / gen_ta_WhatHappened >
< txtPersonalFactor > 5 < / txtPersonalFactor >
< gen_txt_ReportSerial > 123456 < / gen_txt_ReportSerial >
< / AriReport >





像这样合并



 <   AriReport  >  
< gen_rbl_Ship > 1 < / gen_rbl_Ship >
< gen_txt_LocationType > 常规< / gen_txt_LocationType >
< gen_ta_ReportSubject > 事故发生在船上< / gen_ta_ReportSubject >
< gen_txt_NameofPort > missinig < / gen_txt_NameofPort >
< gen_ddl_TaskInvolved > 请检查此< / gen_ddl_TaskInvolved >
< gen_ddl_location > 乘员组驾驶室< / gen_ddl_location >
< gen_ta_whathappened > 请检查narative < / gen_ta_whathappened >
< txtpersonalfactor > 5 < / txtpersonalfactor >
< gen_txt_reportserial > 123456 < / gen_txt_reportserial >





任何一个帮助

解方案
你的AriReport标签没有被关闭,从什么you''ve发布,这可能是问题。否则,它是不可能的,你没有发布任何代码。


你好,



有一个看这里:

http://www.c-sharpcorner.com/uploadfile/ae35ca/merge-2-xml-files-into-single-xml-using-C-Sharp/ [ ^ ]

http://stackoverflow.com/questions/982597/what-is-the-fastest-way-to-combine-two-xml-files-into-one [ ^ ]

http: // stackoverflow.com/questions/6467798/how-to-merge-2-xml-files-with-c-sharp [ ^ ]

http://support.microsoft.com/kb/311530 [ ^ ]


first xml saved on disk

<AriReport>
  <gen_rbl_Ship>1</gen_rbl_Ship>
  <gen_txt_LocationType>regular</gen_txt_LocationType>
  <gen_ta_ReportSubject>accident happend on ship</gen_ta_ReportSubject>
  <gen_txt_NameofPort>missinig</gen_txt_NameofPort>
  <gen_ddl_TaskInvolved>please check this</gen_ddl_TaskInvolved>




get second xml runtime

<AriReport>
  <gen_ddl_Location>cab of crew</gen_ddl_Location>
  <gen_ta_WhatHappened>please check narative</gen_ta_WhatHappened>
  <txtPersonalFactor>5</txtPersonalFactor>
  <gen_txt_ReportSerial>123456</gen_txt_ReportSerial>
</AriReport>



merge like this

<AriReport>
  <gen_rbl_Ship>1</gen_rbl_Ship>
  <gen_txt_LocationType>regular</gen_txt_LocationType>
  <gen_ta_ReportSubject>accident happend on ship</gen_ta_ReportSubject>
  <gen_txt_NameofPort>missinig</gen_txt_NameofPort>
  <gen_ddl_TaskInvolved>please check this</gen_ddl_TaskInvolved>
  <gen_ddl_location>cab of crew</gen_ddl_location>
  <gen_ta_whathappened>please check narative</gen_ta_whathappened>
  <txtpersonalfactor>5</txtpersonalfactor>
  <gen_txt_reportserial>123456</gen_txt_reportserial>



any one help

解决方案

Your "AriReport" tag is not being closed, from what you''ve posted, that could be the problem. Otherwise, it''s impossible to tell, you haven''t posted any code.


Hi,

Have a look here:
http://www.c-sharpcorner.com/uploadfile/ae35ca/merge-2-xml-files-into-single-xml-using-C-Sharp/[^]
http://stackoverflow.com/questions/982597/what-is-the-fastest-way-to-combine-two-xml-files-into-one[^]
http://stackoverflow.com/questions/6467798/how-to-merge-2-xml-files-with-c-sharp[^]
http://support.microsoft.com/kb/311530[^]


这篇关于使用c#合并两个xmls的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆