• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XMLUnit ignore Timestamps?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a simple question:
Is it possible to ignore timestamps within the XML-Files using XMLUnit?

I use something like this:
Diff diff = new Diff(validString, toTestString);
this.assertXMLEqual(diff,true);

The valid-String contains other timestamps as the totest-String which comes from a running database.

A very simple solution would be to erase all "timestamplike" strings in the toTestString and the validString but I think that there is an other way ... something linke an own DifferenceListener?
I think that this task is a very common one but google did not help me

The only thing I found was: It is possible with an own implementation of the DifferenceListener interface but not how.

Thanks for help
mfg KhanQ

example:
<file key="onekey" timestamp="2009.12.01"
<something/>
</file>

should be resolved as equal with

<file key="onekey" timestamp="2007.10.02"
<something/>
</file>

The timestampvalue should be ignored.
 
We can fix it! We just need some baling wire, some WD-40, a bit of duct tape and this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic