|
From: Gordon R. <gr...@ui...> - 2014-05-09 16:09:49
|
I’m having trouble getting a basic XML comparison to give me the answer I expect. I’m using Junit4 & XMLUnit 1.5.
My code is:
public void testXmlTest1() throws SAXException, IOException
{
String source = "<stuff-doc><stuff>Stuff Stuff Stuff</stuff><more-stuff>Some More Stuff</more-stuff></stuff-doc>";
String test = "<stuff-doc>\n<stuff>Stuff Stuff Stuff</stuff>\n<more-stuff>Some More Stuff</more-stuff>\n</stuff-doc>";
assertXMLEqual(source, test);
}
XMLUnit is saying they are not the same as the number of children of <stuff-doc> is 5, not 2. Well, that’s true because of the whitespace creating text nodes. But I thought XMLUnit was supposed to cope with this?
What am I doing wrong? Do I need to specify something like a DTD? Or do I have to create XPaths for every element?
Thanks,
GTG
—
Gordon Ross
|