HELP - Getting a Difference between XML documents?

E

Ed

Hi,

I have 2 sets of XML documents.

XML1 is:
<Root>
<Node1>111</Node1>
<Node2>222</Node2>
<Node3>333</Node3>
<Node4>
<Node4A>444A</Node4A>
<Node4B>444B</Node4B>
</Node4>
<Node5>555</Node5>
</Root>

XML2 is:
<Root>
<Node1>111</Node1>
<Node2>222New</Node2>
<Node3>333</Node3>
<Node4>
<Node4A>444A</Node4A>
<Node4B>444BNew</Node4B>
</Node4>
<Node5>555New</Node5>
</Root>

Essentially, what I want to do in my VB Dot Net application is to have
XML2 - XML1, where the result would be:

<Root>
<Node2>222New</Node2>
<Node4>
<Node4B>444BNew</Node4B>
</Node4>
<Node5>555New</Node5>
</Root>

Only the differring nodes remain.

Is something like this possible? Please Help.

Thanks,
ed
 
A

Aleksi Kallio

Only the differring nodes remain.
Now if only there was a platform-independent, GPL'd version :)

How about X-Diff? It has C++ ja Java implementations and it's a real
difference algorithm - most normal algorithms assume that the order of
elements is significant, thus reducing the problem to finding the
difference between two strings.

But it is recommended that in XML the order of child elements would not
be significant. In that case one might think that the task reduces to
finding a difference between two trees - which is NP-Complete. However,
by taking advantage of some properties of XML documents, X-Diff runs in
polynomial time.

http://www.cs.wisc.edu/~yuanwang/xdiff.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top