是否可以根据 SQL 等节点值连接两个 xml 文件?
我有两个 xml 文件:
<MailPackage>
<Mail>
<id>1</id>
<field_1>foo</field_1>
...
<field_n>bar</field_n>
</Mail>
<Mail>
<id>2</id>
<field_1>... </field_1>
...
</Mail>
....
</MailPackackage>
和
<Transaction_data>
<Transaction>
<id>1</id>
<account_number>10 </account_number>
....
</Transaction>
<Transaction>
<id>1</id>
<account_number> 50 </account_number>
....
</Transaction>
<Transaction>
<id>2</id>
<account_number> 20 </account_number>
....
</Transaction>
</Transaction_data>
现在我想通过 'id' 节点的值加入这两个 xml 文件。预期结果是:
<MailPackage>
<Mail>
<id>1 </id>
<field_1>foo </field_1>
...
<field_n>bar </field_n>
<Transaction_data>
<Transaction>
<Account_number>10</Account_number>
...
</Transaction>
<Transaction>
<Account_number>50 </Account_number>
...
</Transaction>
</Transaction_data>
</Mail>
<Mail>
<id> 2 </id>
<Field_1> ...</Field_1>
...
<Transactions>
<Transaction>
<Account_number> 20 </Account_number>
....
</Transaction>
</Transactions>
</Mail>
</MailPackage>
各位大神可以帮忙看看,如何入手?