I need to know. Is there some javascript implementation exist to handle deltas between XML data ? So main point is to detect difference existence, it doesn't matter what was changed: attribute or node value.
Requirements are following:
- each node will have unique id (it's one of simplifications made to find more candidates-libraries)
- deltas should be checked in nodes, attributes and node values
- support XML node hierarchies up to 3 levels
- the result of computation should be also XML (see example), but it could be 3 arrays of added, updated and deleted nodes
- ignore some subnodes in delta calculation, for example I want to track just 3 levels of hierarchy, not more
- changes detection should not be propogated to upper nodes, so for example child node changes should not make parent node as updated
Here is example how it should work:
XML#1:
<node id="0">
<node id="1">
<node id="4">
<node id="23">DATA</data>
</node>
<node id="5">DATA</node>
</node>
</node>
XML#2:
<node id="0">
<node id="1">
<node id="3">
<node id="342">DATA</data>
</node>
<node id="5" some_attribute="attr"/>
</node>
<node id="6"/>
</node >
So result should be following:
<result>
<added>
<id>6</id>
<id>3</id>
<id>342</id>
</added>
<updated>
<id>5</id>
</updated>
<removed>
<id>4</id>
<id>23</id>
</removed>
</result>