HELP - Getting a Difference between XML documents?

Ed

Usenet Archive
Joined
Feb 13, 2000
Messages
792
Reaction score
0
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
 

Gabriel_k

Usenet Archive
Joined
Aug 11, 2003
Messages
2
Reaction score
0
I think you should take a look at the xslt extension.. especially the function differance http://www.exslt.org/set/functions/difference/index.html

I just found out recently that the functions in EXSL can be found in MSXML too by declaring the right namespace.

/Gabriel

"Ed" skrev i meddelandet

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>
...
 

Aleksi Kallio

Usenet Archive
Joined
Sep 28, 2000
Messages
26
Reaction score
0
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
 

Ed

Usenet Archive
Joined
Feb 13, 2000
Messages
792
Reaction score
0
Thanks for all the responses.. I'm gonna give the XML Diff tool a look!
 

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
548,042
Messages
3,104,223
Members
248,131
Latest member
Tonypshaw1

Latest Threads

Top