我需要合并两个 xml 文件。我正在尝试使用 stax 解析器进行调查。我只关心少数特定元素,因为两个 xml 文件中的剩余元素相同。例如:A.xml
<report>
<measurement event-id="2170014015"/>
<measurement event-id="2170014021"/>
</report>
B.xml
<report>
<measurement event-id="2170014011"/>
<measurement event-id="2170014013"/>
<measurement event-id="2170014015"/>
</report>
Output:
<report>
<measurement event-id="2170014015">
<measurement event-id="2170014021">
<measurement event-id="2170014011">
<measurement event-id="2170014013">
</report>
These are for understanding purpose(but xml files are pretty big). What is the opinion on using jaxb