473,385 Members | 1,342 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Is there an xml diff test function

Hi;

I have a bunch of unit tests that generate xml files (WordML and
SpreadsheetML) and then compare those to the "correct" file. This works great
except that the java code I use to generate the xml (dom4j) differs from
XmlTextWriter in that dom4j places a space at the end of <name atr='value' />
and XmlTextWriter has no space <name atr='value'/>.

They are identical as xml but not as raw text. Is there some method I can
use to compare xml? And I do need to be able to ignore 2 nodes that are
different - they have the version of the software that creates the file and
the date/time it was created.

???

--
thanks - dave
Nov 12 '05 #1
5 1343
David Thielen wrote:
I have a bunch of unit tests that generate xml files (WordML and
SpreadsheetML) and then compare those to the "correct" file. This works
great
except that the java code I use to generate the xml (dom4j) differs from
XmlTextWriter in that dom4j places a space at the end of <name atr='value'
/>
and XmlTextWriter has no space <name atr='value'/>.

They are identical as xml but not as raw text. Is there some method I can
use to compare xml? And I do need to be able to ignore 2 nodes that are
different - they have the version of the software that creates the file and
the date/time it was created.


Try XMLUnit: http://xmlunit.sourceforge.net/

It's not perfect, but it should be able to deal with the cases you are
describing.
Oliver Sturm
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)
Nov 12 '05 #2
This is perfect - thank you!!

--
thanks - dave
"Oliver Sturm" wrote:
David Thielen wrote:
I have a bunch of unit tests that generate xml files (WordML and
SpreadsheetML) and then compare those to the "correct" file. This works
great
except that the java code I use to generate the xml (dom4j) differs from
XmlTextWriter in that dom4j places a space at the end of <name atr='value'
/>
and XmlTextWriter has no space <name atr='value'/>.

They are identical as xml but not as raw text. Is there some method I can
use to compare xml? And I do need to be able to ignore 2 nodes that are
different - they have the version of the software that creates the file and
the date/time it was created.


Try XMLUnit: http://xmlunit.sourceforge.net/

It's not perfect, but it should be able to deal with the cases you are
describing.
Oliver Sturm
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)

Nov 12 '05 #3
Hi dave,

You need some third party tools to get the difference between Xml files.
These products can ignore the spaces and only compare the nodes. XmlSpy is
one of them. Please check the following link:

http://www.altova.com/features_xmldiff.html

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #4
Hello!
You need some third party tools to get the difference between Xml files.
These products can ignore the spaces and only compare the nodes. XmlSpy is
one of them. Please check the following link:

http://www.altova.com/features_xmldiff.html


Altova also offers DiffDog wich is cheaper than XmlSpy, if one does not
need the full suite (although it's really nice, especially the Schema
editor)

<http://www.altova.com/features_xml_diffdog.html>
Oh, and Altova also offers "SemanticWorks", an RDF-Editor. It would be
nice, if Microsoft would add something similar to its ToDo-List for
VisualStudio and the .NET Framework.
(There are a lot of SemanticWeb Java-Tools, that should be a reason :)
--
Pascal Schmitt
Nov 12 '05 #5
Try the Stylus Studio XML Diff -
http://www.stylusstudio.com/xml_differencing.html

Sincerely,
The Stylus Studio Team
http://www.stylusstudio.com

Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nick Allen | last post by:
After using ndiff from difflib, the function restore would return the sequence that generated the delta. Unfortunately, restore does not do the same for unified_diff. I do not see any similar...
9
by: Ching-Lung | last post by:
Hi all, I try to create a tool to check the delta (diff) of 2 binaries and create the delta binary. I use binary formatter (serialization) to create the delta binary. It works fine but the...
1
by: KPS | last post by:
I'm attempting to create a simple treeview-like behavior in JavaScript. The desired behavior happens in IE but I cannot get the same to happen in FireFox. The primary thing I want to accomplish...
17
by: Rob Hoelz | last post by:
I've been compiling a list of the differences between C and C++, and I'd like to see how thorough I've been. Could any of you go over this list and see if I've missed anything? Here's the list:...
1
by: Stef Mientki | last post by:
Does anyone know the equivalent of the MatLab "diff" function. The "diff" functions calculates the difference between 2 succeeding elements of an array. I need to detect (fast) the falling edge of...
1
by: Lennart | last post by:
diff -u /home/system/db2inst1/nya/bin/db2filter.py ./db2filter.py --- /home/system/db2inst1/nya/bin/db2filter.py 2007-01-12 15:23:34.000000000 +0100 +++ ./db2filter.py 2007-04-14...
1
by: Andy Fish | last post by:
hi, I am looking for a library (i.e. not a standalone GUI program) that can do diff and merge of HTML or XML, preferably in C# or at least that can be called from C# anyone know of such a...
1
by: erikcw | last post by:
Hi, I'm trying to create an undo/redo feature for a webapp I'm working on (django based). I'd like to have an undo/redo function. My first thought was to use the difflib to generate a diff to...
4
by: mail.dsp | last post by:
Suppose in a class we overload four operators: operator new operator delete operator new operator delete class Test{ public: void * operator new (size_t t){ cout<<"\nCalling... new";
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.