Compare & Merge XML documents

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Ransburg

    Compare & Merge XML documents

    Hello!

    Is there some library for comparing & merging XML documents? I want it
    to do something like that:

    Base document:
    <office>
    <desk color="brown" height=50></desk>
    </office>

    Update document:
    <office>
    <desk length=30 height=30></desk>
    <chair height=5></chair>
    </office>

    Result:
    <office>
    <desk color="brown" height=30 length=30></desk>
    <chair height=5></chair>
    </office>


    So, if the update document contains an element/attribute which the
    base document does not contain, it is added.
    If the update document contains the same element/attribute with
    another value, the base document's value is overwritten.

    I would prefer a java library / open source tool for this.

    Does anyone know of an implementation for this functionality? If there
    is no such thing, I'll have to do it on my own, using either a SAX
    parser or XSLT I guess...

    Any input ist really appreciated!

    cheers
    Michael
Working...