From: SourceForge.net <no...@so...> - 2007-08-24 06:54:55
|
Bugs item #1779701, was opened at 2007-08-22 21:58 Message generated for change (Comment added) made by bodewig You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1779701&group_id=23187 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: Accepted Priority: 5 Private: No Submitted By: Elias Ross (genman) >Assigned to: Stefan Bodewig (bodewig) Summary: XMLUtil.ignoreWhitespace does not work with namespace Initial Comment: Test case: public void testIgnoreWhitespace2() throws Exception { String control = "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" + "\r\n <env:Header/>" + "\r\n </env:Envelope>"; String test = "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" + "<env:Header/>" + "</env:Envelope>"; XMLUnit.setIgnoreWhitespace(true); try { Diff diff = XMLUnit.compareXML(control, test); System.out.println(test); System.out.println(control); System.out.println(new DetailedDiff(diff)); assertEquals("Should be identical", true, new Diff(control, test).identical()); } finally { XMLUnit.setIgnoreWhitespace(false); } } Output: <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header/></env:Envelope> <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'> <env:Header/> </env:Envelope> org.custommonkey.xmlunit.DetailedDiff [different] Expected number of child nodes '3' but was '1' - comparing <env:Envelope...> at /Envelope[1] to <env:Envelope...> at /Envelope[1] [different] Expected presence of child node '#text' but was 'null' - comparing <env:Envelope ...> </env:Envelope> at /Envelope[1] to at /Envelope[1]/Header[1] [not identical] Expected sequence of child nodes '1' but was '0' - comparing <env:Header...> at /Envelope[1]/Header[1] to <env:Header...> at /Envelope[1]/Header[1] [different] Expected presence of child node '#text' but was 'null' - comparing <env:Envelope ...> </env:Envelope> at /Envelope[1]/Header[1] to at /Envelope[1]/Header[1] ---------------------------------------------------------------------- >Comment By: Stefan Bodewig (bodewig) Date: 2007-08-24 08:54 Message: Logged In: YES user_id=113148 Originator: NO http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6413803 probably holds the full story. ---------------------------------------------------------------------- Comment By: Stefan Bodewig (bodewig) Date: 2007-08-24 08:50 Message: Logged In: YES user_id=113148 Originator: NO I can confirm that the test passes on JDK 1.4.2 and 1.6. I'd rather think it is the XSLT transformer since JDK 1.5's XSLTC really is a mess - and responsible for many other problems. XPath assertions in XMLUnit 1.0 don't work because of it either. You could try downloading Xalan-J (for example) and tell XMLUnit to use Xalan instead of the JDK's transformer as a workaround. I'll look into the issue myself as well. ---------------------------------------------------------------------- Comment By: Elias Ross (genman) Date: 2007-08-23 18:03 Message: Logged In: YES user_id=556458 Originator: YES The test works on JDK 1.6.0_02 but does not on JDK 1.5.0_07 or 1.5.0_11, so I suppose it is a difference in XML parsers shipped with the JDK 1.5. (This is on Linux by the way.) If you can reproduce this, is there some sort of work-around you could put into place? My product is JDK 1.5 only. ---------------------------------------------------------------------- Comment By: Stefan Bodewig (bodewig) Date: 2007-08-23 13:01 Message: Logged In: YES user_id=113148 Originator: NO I've added your test and it passes for me (trunk as well as XMLUnit 1.1). http://xmlunit.svn.sourceforge.net/viewvc/xmlunit?view=rev&revision=230 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1779701&group_id=23187 |