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:
-
<item>
-
<guid>oai:triple-l:2c7ba037-52a6-4323-97dd-b6ea1cdbfd18</guid>
-
<events>
-
<event>
-
<dateTime>2008-03-26T13:27:49.00</dateTime>
-
<action>
-
<actionType>doSomeAtcion</actionType>
-
</action>
-
</event>
-
</events>
-
</item>
-
Is this technically a 'join' ? Eg are you just adding fields from one file to another, or are you copying over existing fields?
Since you're merging into a file I would recommend either:
1. DOM. Open both files with DOM. Add nodes to File1 DOM. Save back to file.
2. XSLT. Performance may be less than optimal, but code is much more maintainable.