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
0
thielen (152)
10/9/2005 9:39:03 PM
dotnet.xml 7266 articles. 0 followers. Follow

5 Replies
816 Views

Similar Articles

[PageSpeed] 46

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)
0
10/10/2005 9:33:11 AM
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)
> 
0
thielen (152)
10/10/2005 1:56:02 PM
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."

0
v-kevy (347)
10/11/2005 7:03:18 AM
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
0
10/11/2005 9:55:13 PM
Try the Stylus Studio XML Diff -
http://www.stylusstudio.com/xml_differencing.html

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

0
10/12/2005 4:44:30 PM
Reply:

Similar Artilces:

XML Header
Hi, I have some XML doc loaded in a C# Web Service. XmlDocument doc = new XmlDocument(); doc.LoadXml(myDoc); Code Missing to manipulate header (I would like to replace or manupulate all these XXXXX): <mso-XXXXXX productversion="XXXXXX"> <mso-application progid="XXXXX"?> doc.Save(myNewDoc); Any idea on how to access and manipulate data within the doc header? Thanks vbdev vb6dev2003 wrote: > I have some XML doc loaded in a C# Web Service. > XmlDocument doc = new XmlDocument(); > doc.LoadXml(myDoc); > > Code Missing to manipulate header ...

Average IF Function
How can you test a range of cells to be greater than or less than another cell using the average if function? Ex: =AVERAGEIFS(A1:A4,A1:A4,"A6",A1:A4,"A7") Keep getting the #DIV/0! error! HELP!!!!! Thank you! Hi, See if it works by removing the double quotes. Else, try this =sumproduct((A1:A4>=A6)*(A1:A4<=A4)*(A1:A4))/sumproduct((A1:A4>=A6)*(A1:A4<=A4)) -- Regards, Ashish Mathur Microsoft Excel MVP www.ashishmathur.com "SandiVaughn" <SandiVaughn@discussions.microsoft.com> wrote in message news:B74ED6DC-6F56-4...

combined two countif functions
I want to have a table as such: state population CO 100 NE 200 CO 300 I want to count the number of times state is CO and Population is > 200. In the example it should result in a count of 1. How do i formulate this? thanks. Hi Geoff Try this: =SUMPRODUCT((A1:A3="CO")*(B1:B3>200)) HTH Michael Mitchelson "Geoff" wrote: > I want to have a table as such: > > state population > > CO 100 > NE 200 > CO 300 > > I want to count the number of times state is CO and Population is > >...

Identify files on two diff spreadsheets
I need help... I have two spreadsheets, named 2008 and RS, both with file numbers in column A1 with different information in the other columns. I need to know if the files on the spreadsheet "RS" are on the spreadsheet "2008" and if so, then put a "1" in column "U" next to that file on the "2008" spreadsheet. I tried the vlookup function, but couldn't quite figure it out. Please help. Thanks in advance. Try this formula in column U of the 2008 sheet: =IF(COUNTIF(RS!A:A,'2008'!A1)>0,"U","") ...

Read XHTML into XML
Hi all, I need to read/parse XHTML aspx pages and look for certain tokens and content. How can I use a XmlTextReader for this? If not, any other ideas? Thanks in advance, JA Reyes. Jose Antonio Reyes wrote: > I need to read/parse XHTML aspx pages and look for certain tokens and > content. How can I use a XmlTextReader for this? If not, any other ideas? If the pages are well-formed XHTML then it is possible to use XmlReader (in .NET 2.0/3.0) or XmlTextReader (in .NET 1.x) to parse the XHTML documents. You can also use the other XML APIs .NET provides so using XPathNavigator and/o...

Sorting in a custom view not functioning as expected
I just can't shake the feeling this is a stupid question, but I can't seem to get it or find an appropriate Google response. I have saved a custom view for my tasks. In it, I have a custom sort set up for my tasks. (A custom field text field "Grouping" ascending, then "Status" descending, then "Due Date" ascending, if you want to know.) My problem is, it's often convenient to look at things by category, so I (and my little users) click on the "Category" heading to get a quick view of things sorted that way. Then, I want to...

How to invoke the xml editor?
I installed vs2005 on a new xp pro machine, and installed everything except C++. When I click on a file with a ".xml" extension it is opened with IE. When I click file/Edit with XML Editor, it opens it with Notepad. If I click File/Open With and select XML Editor, it opens it with IE. So, where is the xml editor? Can it be invoked from withing VS? Where? Bill * billsahiker@yahoo.com wrote in microsoft.public.dotnet.xml: >I installed vs2005 on a new xp pro machine, and installed everything >except C++. When I click on a file with a ".xml" extension it is >opened ...

This is a test
When will the KB reports for June be posted on CustomerSource and PartnerSource -- Darryl L. Miller ...

How do I disable the "save as" function in Excel
I want to prevent user that is using the file to save it in another location in order to distribute it. The sheets are already protected with locked & unlocked cells. The file is also in a protected limited access folder to specific users. The users that is using the file run it from a shortcut. Hi if the user can copy the file using the Windows Explorer not really a chance to prevent this kind of copying -- Regards Frank Kabel Frankfurt, Germany Max wrote: > I want to prevent user that is using the file to save it in another > location in order to distribute it. The sheets ar...

Autofilter Function
I have a spreadsheet that contains Autofilters at the top of a number of columns. When I password protect the spreadsheet the Autofilter function appears to be disabled. There must be a way to get around this but I don't seem to be able to find it. Can anybody help? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.aspx/ms-excel/200511/1 Hi Brian If you have 2002 or 2003 you can enabled this when you protect your sheet If not see http://www.contextures.com/xlautofilter03.html#Protect -- Regards Ron de Bruin http://www.rondebruin.nl "Brian Hearty via Offi...

typedef, signed keyword and function overloading
HI, recently I wanted to port some software from unix world to ms one and I found something weird about signed keyword, typedefs and function overloading. Let't say I write the following code : typedef char int8_t; typedef unsigned char uint8_t; void TestCast(int8_t cTest); void TestCast(uint8_t cTest); void TestCast(int8_t cTest) { int i = 2+2; return; } int _tmain(int argc, _TCHAR* argv[]) { char cTest = 'T'; TestCast(cTest); return 0; } During my studies I was told that when I declare char, it 's signed by default. So I tried to write this instead : ...

show XML schema and values
I have an XML document that looks like the following: <record> <Field1>value1</Field1> <Field2>value2</Field2> <Field3>value3</Field3> </record> What I'm aiming to do is to show the data in a report as in the following example: record: Field1 value1 Field2 value2 Field3 value3 The "Field1-3"-elements can have any name, so I'm trying to get a table that has in one result column the element name, and in the second colum...

Outlook 2002 Test Message In Loop
I generated an Outlook Test Message from my email account a couple of days ago. I get a test message in my inbox every 20 or 30 seconds. I have hundreds! Anyone know how I can stop it? I've already deleted the account, rebooted and re-entered the email account as new. No change. I also had my web host reboot his mail server AND his complete server. No change. Thank you. did you try making a new pst and setting it as the default delivery location? if that works, there is a message stuck in the outbox - you'll need outlookspy to delete it. -- Diane Poremsky [MVP - Outlook] Aut...

Offline synch using XML web-services
This is a bit long-winded. Can somebody read thru these 2 use cases, and tell me if it is feasible ? :- Use Case : Replication before Offline Synch Scenario 1 : Oracle Server , MSDE client 1. User clicks on 'Go Offline'. System creates a MSDE SQL database in laptop (client), gets the schemas of the tables in Oracle, creates corresponding tables in client's MSDE SQL (mapping Oracle datatypes to SQL datatypes). 2. Offline replication program reads in the tables of the server into a typed datasets, converts the typed datasets into XML, and stores the XML in the client. (XML serial...

Factorial function...whaaaaaa?
I have the following equation in my code: TotalCalc = Fact(n + 4) / (Fact(4) * Fact(n)) When I compile, it highlights the first Fact and tells me "Sub or Function not defined". TIA FACT() is a worksheetfunction. So you can try something like the below TotalCalc = WorksheetFunction.Fact(n + 4) / (WorksheetFunction.Fact(4) * _ WorksheetFunction.Fact(n)) -- Jacob "Geoff" wrote: > I have the following equation in my code: > > TotalCalc = Fact(n + 4) / (Fact(4) * Fact(n)) > > When I compile, it highlights the first Fact and tell...

XML Serialization ... how to truncate <?xml...
While xml serializing object how can I truncate <?xml ...?> this line alone? I need to send the serialized xml data to a web method ... since SOAP already have <?xml tag there was some confusion Any help would be greatly appreciated Thank you Regards Raj Raj wrote: > While xml serializing object how can I truncate <?xml ...?> this line alone? Serialize to an XmlWriter created with XmlWriterSettings where you set OmitXmlDeclaration to true. -- Martin Honnen --- MVP XML http://msmvps.com/blogs/martin_honnen/ ...

String to xml document
Hi there, I was hoping someone can help me with a little problem I can't seem to find any answers to. I've got a form wich will be posted. On receiving the post I would like to parse a formvar to a xml document. The contents of this formvar (string) will be a valid xhtml document. Can someone give me a startertip (or more :-)) on how to achieve this? tnx in advance, James van der Veen Sjeems wrote: > I was hoping someone can help me with a little problem I can't seem to find > any answers to. > > I've got a form wich will be posted. On receiving the p...

Date Diff
> I am new to Access.I work for a multi billion $ company and believe it not > have no expertise in Access.We have Access 2002.I created a table which has 2 > date fields.I would like to obtain the date difference excluding weedends.I > would like to know the formula and how and where to use it. > -- Insurance Guy Do a search on Weekdays. You'll find numerous threads relating to your problem. Bob PJ wrote: >> I am new to Access.I work for a multi billion $ company and believe it not >> have no expertise in Access.We have Access 2002.I created a table which ...

Beginner of XML
I am a beginner of XML. I want to group some files together with a xml file. (it includes a text file, and an image file and a video file) Can someone show me some guidelines? Please help. ...

Valid xml to read from an xml file?
I'm using vb.net, i get an error at the reader line saying the remote server can't be found. Is the below even valid? dim reader as XmlTextReader reader = new XmlTextReader ("http://www.mysite.com/my.xml") do while (reader.Read()) 'do some action here response.write(reader) loop thanx chumley XmlTextReader uses System.Net.WebRequest under the covers -- see if you can figure out how to create a connection that way. Usually there's some proxy server information missing that you can enable if you use WebRequest directly, and then pass the result of GetResponse()...

TreeView and research function
Hi, I'm using a TreeView to display several information to user. 1. I would like to know if exist a method to hide some of TreeView's rows ? 2. The same for showing all rows ? 3. Does a search function exist to research a "string" part through all cells of TreeView ? thanks, Maileen Maileen <nospan@email.com> wrote in message news:<OQiWZxDMEHA.3216@tk2msftngp13.phx.gbl>... > Hi, > > I'm using a TreeView to display several information to user. > 1. I would like to know if exist a method to hide some of TreeView's rows ? > 2. The same fo...

Create Dependent Lists using an INDEX function??
I am a really rookie when it comes to Excel but have managed to create an order form with three drop down lists using the INDIRECT function and the instructions on the following wonderful page: http://www.contextures.com/xlDataVal02.html#TwoWord My problem is that I want to convert the spreadsheet into a webpage and the Spreadsheet Convertor does not support the INDIRECT function. It suggests using the INDEX function instead. Could anyone point me in the right direction. Many thanks Hi, What does your INDIRECT function look like, exactly? -- If this helps, please click the Yes but...

Example eConnect XML documents
MSDN says the following: Installing eConnect schema When you include the schemas component of the eConnect install, the installer places schema files in a schemas folder on your computer. The following schema resources are available: The install places the .xsd schema files in the directory c:\Program Files\Microsoft Great Plains\eConnect9\XML Schema\Incoming XSD Individual Schemas. The files in the directory contain the schema for each eConnect XML document. The install places a file named eConnect.xsd that contains the schema definition for all eConnect XML documents. The install typicall...

Saving DataSet as XML in ADO format using VB.NET
Hi, I am trying to convert a lot of web reports from ASP/VB to ASP.NET/VB.NET. I would like to save my dataset in XML and then use XSLT to transform the XML. The catch is I would like to have the XML in the format that ADO uses versus the default format in which ADO.NET uses. Currently, I am using ADO within .NET, but I am concerned about the performance and it might improve if I used the native data providers for .NET. I am not sure if I am missing something but how do I save the .NET DataSet to XML in the OLD ADO format? Thanks for you help in advance and it is most appreciated. In the ...

Overidding IF function
I am making a table for a competition. So far I have it sorted out so that from each match it can decide who is the winner and loser or if it is a draw. What I want to find out is when it puts draw as the result, it keeps the winner and loser so for instance if x played y and the score was 10-10 it would put DRAW and give both teams two points on the table, but it still thinks one of them is a winner so it gives one of them 4 points as well. How do I make a formula that says if it is a draw the both the winner and loser cells are nullified? Please Help me:confused: -------------------------...