合并2个不同的XML文件...... [英] Merging 2 different XML files...

查看:88
本文介绍了合并2个不同的XML文件......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有两个基于类似文本标识符使用Java合并的文件:


文件1:

展开 | 选择 | Wrap | 行号

解决方案

对不起我忘了提,我必须用Java来合并它们......

需要定义:
  • 行/标识符
  • 要合并的字段
  • 合并规则



如果出现以下任何一种情况,请更正。

查看代码的假设:


字段摘要d在xpaths中:
文件1

行:/ ListRecords / record

行id:header / identifier

文件2

行:/ ListRecords / record / metadata / group / item


让'看看要合并的单独xml部分:

文件2:

展开 | 选择 | Wrap | 行号


日Thnx。很多你的回复我很担心它,因为我有一个截止日期

实际上我想在该id的文件1记录结束后加入从文件2到文件1的类似id的记录,输出可能如下所示:

展开 | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号


Hi,

I have two files to merge using Java based on a similar text identifier:

File 1:

Expand|Select|Wrap|Line Numbers

解决方案

sorry i forgot to mention, i have to use Java to merge them...


Need to define:
  • Rows/identifiers
  • Fields to be merged
  • Merging rules


Please correct if any of the following is wrong.
Assumptions from looking at the code:

Fields summarized in xpaths:
File 1
rows: /ListRecords/record
row id: header/identifier

File 2
rows: /ListRecords/record/metadata/group/item


Let''s look at the seperate xml sections to be merged:
File 2:

Expand|Select|Wrap|Line Numbers


Thnx. a lot for ur reply i was so worried about it as i have a deadline
Actually i want to join the record of similar id from file 2 into file 1 after the file 1 record for that id ends, the output might look like:

Expand|Select|Wrap|Line Numbers


这篇关于合并2个不同的XML文件......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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