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


------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
&#149; 3 signs your SCM is hindering your productivity
&#149; Requirements for releasing software faster
&#149; Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
Xmlunit-general mailing list
Xmlunit-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmlunit-general

Reply via email to