From: SourceForge.net <no...@so...> - 2013-02-01 16:22:24
|
Bugs item #3602981, was opened at 2013-02-01 07:05 Message generated for change (Comment added) made by bodewig You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=3602981&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: None Priority: 5 Private: No Submitted By: David Portabella Clotet (dportabella) Assigned to: Nobody/Anonymous (nobody) Summary: Diff failswith xsi:type and different prefix Initial Comment: This code: import org.custommonkey.xmlunit.Diff; String result = "<ns1:Square xsi:type=\"ns1:Shape\" xmlns:ns1=\"http://example.com/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>"; String correct = "<ns2:Square xsi:type=\"ns2:Shape\" xmlns:ns2=\"http://example.com/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>"; Diff diff = new Diff(result, correct); System.out.println("diff:" + diff); System.out.println("diff.similar(): " + diff.similar()); results in: diff: org.custommonkey.xmlunit.Diff [not identical] Expected namespace prefix 'ns1' but was 'ns2' - comparing <ns1:Square...> at /Square[1] to <ns2:Square...> at /Square[1] [different] Expected attribute value 'ns1:Shape' but was 'ns2:Shape' - comparing <ns1:Square xsi:type="ns1:Shape"...> at /Square[1]/@type to <ns2:Square xsi:type="ns2:Shape"...> at /Square[1]/@type diff.similar(): false --- someone posted a fix here: http://stackoverflow.com/questions/14647861/xmlunit-diff-returns-similar-false-if-there-is-a-xsitype-and-a-different-namesp/14648786#14648786 ---------------------------------------------------------------------- >Comment By: Stefan Bodewig (bodewig) Date: 2013-02-01 08:22 Message: Actually, XMLUnit doesn't really support much of the XML-Schema Instance stuff at all. I've started to fix it in the 1.x branch and simply ignoring the namespace prefix is trivial for this case, making sure the prefixes map to the same NS uris seems more difficult, at least as long as I'm in Java 1.4 land. Once this is fixed I'll roll a new release. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=3602981&group_id=23187 |