You can subscribe to this list here.
2007 |
Jan
|
Feb
(3) |
Mar
(18) |
Apr
(39) |
May
(15) |
Jun
(12) |
Jul
(3) |
Aug
(23) |
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(21) |
Feb
(23) |
Mar
(33) |
Apr
(8) |
May
(1) |
Jun
(22) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(6) |
Nov
|
Dec
(11) |
2009 |
Jan
(5) |
Feb
|
Mar
(2) |
Apr
(24) |
May
(36) |
Jun
(18) |
Jul
(2) |
Aug
(3) |
Sep
(9) |
Oct
(3) |
Nov
(1) |
Dec
|
2010 |
Jan
(5) |
Feb
(3) |
Mar
|
Apr
(15) |
May
(24) |
Jun
(11) |
Jul
(8) |
Aug
(34) |
Sep
(42) |
Oct
|
Nov
|
Dec
|
2011 |
Jan
(13) |
Feb
(32) |
Mar
(35) |
Apr
(31) |
May
(33) |
Jun
(30) |
Jul
(32) |
Aug
(31) |
Sep
(30) |
Oct
(31) |
Nov
(32) |
Dec
(31) |
2012 |
Jan
(35) |
Feb
(31) |
Mar
(31) |
Apr
(30) |
May
(31) |
Jun
(34) |
Jul
(23) |
Aug
(30) |
Sep
(30) |
Oct
(29) |
Nov
(30) |
Dec
(32) |
2013 |
Jan
(25) |
Feb
(39) |
Mar
(1) |
Apr
(18) |
May
(1) |
Jun
|
Jul
(1) |
Aug
(20) |
Sep
(41) |
Oct
(32) |
Nov
(9) |
Dec
(31) |
2014 |
Jan
(31) |
Feb
(30) |
Mar
(34) |
Apr
(60) |
May
(31) |
Jun
(28) |
Jul
(32) |
Aug
(28) |
Sep
(26) |
Oct
(32) |
Nov
(43) |
Dec
(115) |
2015 |
Jan
(106) |
Feb
(101) |
Mar
(51) |
Apr
(32) |
May
(63) |
Jun
(18) |
Jul
|
Aug
(18) |
Sep
|
Oct
(1) |
Nov
(84) |
Dec
(63) |
2016 |
Jan
(26) |
Feb
(17) |
Mar
(104) |
Apr
(30) |
May
(6) |
Jun
(30) |
Jul
|
Aug
|
Sep
|
Oct
(3) |
Nov
(48) |
Dec
(22) |
2017 |
Jan
(15) |
Feb
(29) |
Mar
(43) |
Apr
(29) |
May
(25) |
Jun
(28) |
Jul
(62) |
Aug
(35) |
Sep
(35) |
Oct
(72) |
Nov
(10) |
Dec
(4) |
2018 |
Jan
(7) |
Feb
(4) |
Mar
|
Apr
(46) |
May
(20) |
Jun
(12) |
Jul
(9) |
Aug
(42) |
Sep
(4) |
Oct
(17) |
Nov
(32) |
Dec
(31) |
2019 |
Jan
(21) |
Feb
(14) |
Mar
|
Apr
(74) |
May
(25) |
Jun
(43) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
|
Dec
(10) |
2020 |
Jan
(1) |
Feb
|
Mar
(26) |
Apr
(8) |
May
(62) |
Jun
(4) |
Jul
(25) |
Aug
|
Sep
(21) |
Oct
(24) |
Nov
(26) |
Dec
(9) |
2021 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(1) |
Oct
(11) |
Nov
(1) |
Dec
(12) |
2022 |
Jan
(47) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(14) |
2023 |
Jan
(3) |
Feb
|
Mar
(60) |
Apr
(9) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2024 |
Jan
(5) |
Feb
|
Mar
|
Apr
(10) |
May
(1) |
Jun
|
Jul
|
Aug
(17) |
Sep
(2) |
Oct
|
Nov
|
Dec
(1) |
2025 |
Jan
|
Feb
|
Mar
(88) |
Apr
(64) |
May
(47) |
Jun
(20) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <bo...@us...> - 2008-02-04 12:04:57
|
Revision: 239 http://xmlunit.svn.sourceforge.net/xmlunit/?rev=239&view=rev Author: bodewig Date: 2008-02-04 04:04:58 -0800 (Mon, 04 Feb 2008) Log Message: ----------- Announce release, don't lie about quickly evolving code Modified Paths: -------------- trunk/xmlunit/src/site/index.html Modified: trunk/xmlunit/src/site/index.html =================================================================== --- trunk/xmlunit/src/site/index.html 2008-02-04 11:25:40 UTC (rev 238) +++ trunk/xmlunit/src/site/index.html 2008-02-04 12:04:58 UTC (rev 239) @@ -107,8 +107,8 @@ <tr> <td colspan="2"> <p>The current release is <a - href="http://sourceforge.net/project/showfiles.php?group_id=23187&release_id=201538">XmlUnit -.Net 0.3</a>, December 2003</p> + href="https://sourceforge.net/project/showfiles.php?group_id=23187&package_id=91308">XmlUnit +.Net 0.3.1</a>, February 2008</p> <p>XMLUnit for .Net provides NUnit extension classes written in C#, e.g. <code>XmlAssertion</code> and <code>XmlDiff</code>, that allow assertions to be made about the differences between two pieces of XML, @@ -116,10 +116,7 @@ on a piece of XML, and the result of an XSL Transform.<br> </p> <p>Please be aware that the .Net code base is not as advanced as its Java -counterpart, in particular there is currently no explicit support for namespaces. -The code is evolving fairly quickly though so please do visit <a - href="http://xmlunit.svn.sourceforge.net/viewvc/xmlunit/trunk/xmlunit/">the -Subversion repository</a> </p> +counterpart, in particular there is currently no explicit support for namespaces.</p> </td> </tr> <tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bo...@us...> - 2008-02-04 11:25:37
|
Revision: 238 http://xmlunit.svn.sourceforge.net/xmlunit/?rev=238&view=rev Author: bodewig Date: 2008-02-04 03:25:40 -0800 (Mon, 04 Feb 2008) Log Message: ----------- tag release Added Paths: ----------- tags/XMLUnit.NET-0.3.1/ Copied: tags/XMLUnit.NET-0.3.1 (from rev 237, trunk/xmlunit) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SourceForge.net <no...@so...> - 2008-01-28 18:06:31
|
Feature Requests item #1762410, was opened at 2007-07-27 16:55 Message generated for change (Comment added) made by kestesisme You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377771&aid=1762410&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: Ken Estes (kestesisme) Assigned to: Nobody/Anonymous (nobody) Summary: use tolerance for floating point values in XML Initial Comment: We produce XML which has numerical values scattered through out the XML both in nodes and attributes. <svg xmlns="http://www.w3.org/2000/svg" width="0.085in" height="0.085in"> <text text-anchor="end" y="92" x="15">36</text> <fo:block-container height="2pc" width="46.5pc" left="2.5pc" top="64pc"> The numerical values can be produced by computations which are carried out in software or hardware. Because of round off errors we need to have a custom string equals function which will allow for round off in the numeric portions of the string. Enclosed please find a file which will perform such numeric comparisons. Here is my suggestion for how to hook it into XMLUnit. /** * Test two non-null values for inequality * @param expected * @param actual * @return TRUE if the values are not equals() equal (taking whitespace * into account if necessary) */ private boolean unequalNotNull(Object expected, Object actual) { boolean bothStrings = (expected instanceof String && actual instanceof String); if (!bothStrings) { return !(expected.equals(actual)); } String expectedString = (String) expected; String actualString = (String) actual; if (XMLUnit.getIgnoreWhitespace()) { expectedString = expected.trim(); actualString = actual.trim(); } if (XMLUnit.getNormalizeWhitespace()) { expectedString = normalizeWhitespace(expectedString); actualString = normalizeWhitespace(actualString); } if (XMLUnit.getTolerantNumericCompare) { return !StringCmpNumericTolerance.equals(expected,actualString); } return !expectedString.equals(actualString); } ---------------------------------------------------------------------- >Comment By: Ken Estes (kestesisme) Date: 2008-01-28 13:06 Message: Logged In: YES user_id=1855117 Originator: YES It would be simplest for my case to wrap the standard DifferenceEngine with another class, because what I wish to change is the method unequalNotNull(Object expected, Object actual) in this class. However this is difficult with the current code structure. 1) The DifferenceEngine class has methods which are private/final and this makes extending the object diffcult 2) it is not clear how to pass my new class into the Diff(,) object to be used instead of the normal differenceEngine. I was hoping to use the diff constructor Diff(Document controlDoc, Document testDoc, DifferenceEngine comparator) But this is a tangle of dependencies. My DifferenceEngine needs to be constructed first, so that I could pass it into the Diff. However to construct my class I need to pass in the Diff (this is the only class which implements ComparisonController) that it will be used for as a parameter. I suggest that you should separate the implementations of DifferenceListener, ComparisonController and not keep diff as an implementation of both since the dependency issues for both are quite separate. And Worse there is no setDifferenceEngine() method for Diff() so that I could create my own DifferenceEngine after the diff was constructed (and pass in the already constructed diff as a parameter) then override the default difference engine with what I just created. In sort overriding the DifferenceEngine class is quite difficult. ---------------------------------------------------------------------- Comment By: Stefan Bodewig (bodewig) Date: 2008-01-04 05:38 Message: Logged In: YES user_id=113148 Originator: NO Hi Ken, to be honest I feel we would be stretching XMLUnit quite a bit if we added special purpose options like handling of numeric values to its core. The same could be said for case insensitive comparisons of element and attribute names (HTML as a use-case) or texts and so on. It should be possible to use a DifferenceListener of your own that wrapped whatever DifferenceListener would get used normally and performed some special sort of comparision for ATTR_VALUE Differences. We might even add such a DifferenceListener in XMLUnit's examples package. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377771&aid=1762410&group_id=23187 |
From: SourceForge.net <no...@so...> - 2008-01-28 17:38:36
|
Bugs item #1863632, was opened at 2008-01-03 15:05 Message generated for change (Comment added) made by nobody You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1863632&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: Works For Me Priority: 5 Private: No Submitted By: Forest (forestcarlisle) Assigned to: Nobody/Anonymous (nobody) Summary: similar ignore-whitespace comparison fails incorrectly Initial Comment: consider the following control xml <a><b/></a> vs. the following test xml <a> <b/> </a> when XMLUnit has been configured to ignore whitespace by XMLUnit.setIgnoreWhitespace(true). if we are ignoring whitespace, then these two documents should be similar. on line 305 of DifferenceEngine.class for v1.1, the diff compares the number of child nodes of <a> and finds that the control xml has 1 child node and the test xml has 3 child nodes. the extra 2 child nodes on the text xml are whitespace-only, but this causes a DifferenceFoundException to be thrown simply because the count is different. this logic is too limited; it should only be thrown when whitespace is *not* being ignored. the fix is to first eliminate any all-whitespace nodes from the node list when ignoring whitespace *unless* the node has exactly one child node. in the latter case, the single child node can be a text node with whitespace which should be regarded as literal text, as in the following example: <a><b> </b></a> is not similar to <a><b/></a> ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2008-01-28 09:38 Message: Logged In: NO I have a similar problem with the following piece: public void testDit() throws SAXException, IOException { String shcont = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Data><Person><Name><![CDATA[JOE]]></Name></Person></Data>"; String newTest = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +"<Data>" +" <Person>" +" <Name>" +" <![CDATA[JOE]]>" +" </Name>" +" </Person>" +"</Data>"; XMLUnit.setIgnoreWhitespace(true); try { Diff diff = XMLUnit.compareXML(shcont, newTest); System.out.println(diff.toString()); assertTrue(diff.similar()); } finally { XMLUnit.setIgnoreWhitespace(false); } } ---------------------------------------------------------------------- Comment By: Forest (forestcarlisle) Date: 2008-01-04 12:03 Message: Logged In: YES user_id=1092645 Originator: YES You actually need to have a namespace variable on the root element (or any child element) to see the problem. Sorry about that. public void testBasicWhitespaceHandling() throws Exception { String control = "<xyz:a xmlns:xyz=\"abc\"><b/></xyz:a>"; String test = "<xyz:a xmlns:xyz=\"abc\">\r\n <b/>\r\n</xyz:a>"; XMLUnit.setIgnoreWhitespace(true); try { Diff diff = XMLUnit.compareXML(control, test); assert diff.similar() : diff.toString(); } finally { XMLUnit.setIgnoreWhitespace(false); } } ---------------------------------------------------------------------- Comment By: Stefan Bodewig (bodewig) Date: 2008-01-04 01:42 Message: Logged In: YES user_id=113148 Originator: NO there must be some other problem with your test since not only are the two pieces similar, they are even identical. I've just added a testcase for your report http://xmlunit.svn.sourceforge.net/viewvc/xmlunit/trunk/?view=log and it passes. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1863632&group_id=23187 |
From: <bo...@us...> - 2008-01-28 14:49:46
|
Revision: 237 http://xmlunit.svn.sourceforge.net/xmlunit/?rev=237&view=rev Author: bodewig Date: 2008-01-28 06:49:49 -0800 (Mon, 28 Jan 2008) Log Message: ----------- make stuff work with NUnit 2.4 Modified Paths: -------------- trunk/xmlunit/NUnit.ReadMe trunk/xmlunit/src/csharp/AssemblyInfo.cs trunk/xmlunit/tests/csharp/DiffConfigurationTests.cs trunk/xmlunit/tests/csharp/XmlAssertionTests.cs trunk/xmlunit/xmlunit.nant.build Modified: trunk/xmlunit/NUnit.ReadMe =================================================================== --- trunk/xmlunit/NUnit.ReadMe 2008-01-04 10:24:02 UTC (rev 236) +++ trunk/xmlunit/NUnit.ReadMe 2008-01-28 14:49:49 UTC (rev 237) @@ -2,16 +2,20 @@ ================ To run this software you will need: -- Nunit v2.1 (http://nunit.org/) -- .NET runtime v1.1 or Mono runtime v0.28 (or above) +- Nunit v2.2 or above (http://nunit.org/) +- .NET runtime v1.1 or Mono runtime v1.0 (or above) If you want to build the source code yourself you will also need NAnt (http://nant.sourceforge.net/) -This build of the source code was prepared using .NET csc 1.1.4322, NUnit2.1.4, and NAnt0.8.3 +This build of the source code was prepared using .NET csc 1.1.4322, NUnit2.4.6, and NAnt0.8.5 Enjoy! http://xmlunit.sourceforge.net/ +Changes in version 0.3.1: +- made it compile and all tests pass on .NET 1.1 as well as 2.0 and + NUnit 2.4 + Changes in version 0.3: - New XSLT assertions - New XmlOutput class @@ -23,4 +27,4 @@ - Removed (ab)use of statics - thanks Joe Changes in version 0.1: -- New classes for basic xml differencing \ No newline at end of file +- New classes for basic xml differencing Modified: trunk/xmlunit/src/csharp/AssemblyInfo.cs =================================================================== --- trunk/xmlunit/src/csharp/AssemblyInfo.cs 2008-01-04 10:24:02 UTC (rev 236) +++ trunk/xmlunit/src/csharp/AssemblyInfo.cs 2008-01-28 14:49:49 UTC (rev 237) @@ -23,7 +23,7 @@ // You can specify all values by your own or you can build default build and revision // numbers with the '*' character (the default): -[assembly: AssemblyVersion("0.3.0.0")] +[assembly: AssemblyVersion("0.3.1.0")] // The following attributes specify the key for the sign of your assembly. See the // .NET Framework documentation for more information about signing. Modified: trunk/xmlunit/tests/csharp/DiffConfigurationTests.cs =================================================================== --- trunk/xmlunit/tests/csharp/DiffConfigurationTests.cs 2008-01-04 10:24:02 UTC (rev 236) +++ trunk/xmlunit/tests/csharp/DiffConfigurationTests.cs 2008-01-28 14:49:49 UTC (rev 237) @@ -21,24 +21,30 @@ new XmlDiff("", "").OptionalDescription); } - [Test][ExpectedException(typeof(XmlSchemaValidationException))] + [Test] public void DefaultConfiguredToUseValidatingParser() { DiffConfiguration diffConfiguration = new DiffConfiguration(); Assert.AreEqual(DiffConfiguration.DEFAULT_USE_VALIDATING_PARSER, diffConfiguration.UseValidatingParser); - FileStream controlFileStream = File.Open(ValidatorTests.VALID_FILE, - FileMode.Open, FileAccess.Read); - FileStream testFileStream = File.Open(ValidatorTests.INVALID_FILE, - FileMode.Open, FileAccess.Read); - try { + bool exception = false; + using (FileStream controlFileStream = File.Open(ValidatorTests.VALID_FILE, + FileMode.Open, + FileAccess.Read)) + using (FileStream testFileStream = File.Open(ValidatorTests.INVALID_FILE, + FileMode.Open, + FileAccess.Read)) { + try { XmlDiff diff = new XmlDiff(new StreamReader(controlFileStream), new StreamReader(testFileStream)); diff.Compare(); - } finally { - controlFileStream.Close(); - testFileStream.Close(); + } catch (System.Exception) { + // should be an XmlSchemaValidationException in .NET 2.0 + // and later + exception = true; + } } + Assert.IsTrue(exception, "expected validation to fail"); } [Test] Modified: trunk/xmlunit/tests/csharp/XmlAssertionTests.cs =================================================================== --- trunk/xmlunit/tests/csharp/XmlAssertionTests.cs 2008-01-04 10:24:02 UTC (rev 236) +++ trunk/xmlunit/tests/csharp/XmlAssertionTests.cs 2008-01-28 14:49:49 UTC (rev 237) @@ -29,7 +29,7 @@ XmlAssertion.AssertXmlIdentical(diff); caughtException = false; } catch (NUnit.Framework.AssertionException e) { - Assert.IsTrue(e.Message.StartsWith(description)); + Assert.IsTrue(e.Message.IndexOf(description) > -1); } Assert.IsTrue(caughtException); } @@ -43,7 +43,7 @@ XmlAssertion.AssertXmlEquals(diff); caughtException = false; } catch (NUnit.Framework.AssertionException e) { - Assert.AreEqual(true, e.Message.StartsWith(description)); + Assert.IsTrue(e.Message.IndexOf(description) > -1); } Assert.IsTrue(caughtException); } Modified: trunk/xmlunit/xmlunit.nant.build =================================================================== --- trunk/xmlunit/xmlunit.nant.build 2008-01-04 10:24:02 UTC (rev 236) +++ trunk/xmlunit/xmlunit.nant.build 2008-01-28 14:49:49 UTC (rev 237) @@ -1,5 +1,5 @@ <project name="xmlunit" description="XmlUnit for .Net" default="compile"> - <property name="project.version" value="0.3" overwrite="false"/> + <property name="project.version" value="0.3.1" overwrite="false"/> <property name="base.dir" value="${project::get-base-directory()}" overwrite="false"/> <property name="src.dir" value="${base.dir}/src/csharp" overwrite="false"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SourceForge.net <no...@so...> - 2008-01-23 22:50:42
|
Feature Requests item #1878549, was opened at 2008-01-23 17:50 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377771&aid=1878549&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: Frank Callahan (fcallahan) Assigned to: Nobody/Anonymous (nobody) Summary: recursive ElementQualifier implementation Initial Comment: An implementation of the ElementQualifier interface is needed that can match comparable control and test nodes at arbitrary levels of nesting. While working on an automated regression tool, I found that MultiLevelElementNameAndTextQualifier could not correctly match comparable nodes in deeply nested and complex SOAP response messages. The data contents of these nodes were identical, but they occurred in different orders. Also, MultiLevelElementNameAndTextQualifier requires that the number of levels to explore in each candidate comparable pair be specified in advance of running a comparison. QA testers using the tool would have to enter a number as their best quess of how deep to look, a requirement that would make the tool less useful to them. To solve this problem, I wrote a recursive implementation of ElementQualifier that is able to find all the comparable nodes in a control and test SOAP response message. Probably there are other XMLUnit users who have had to write something similar, so it might be a good idea to include a recursive ElementQualifier in the XMLUnit examples package. The Open Source Review Board at my company, Fidelity Investments, has approved making this originally proprietary code available as a potential contribution to XMLUnit, so please consider adding it to the examples package, making any changes that would make it more consistent with your code standards. It does work fine "as is" though. Anyhow, the code for the RecursiveElementNameAndTextQualifier is pasted in below, so anyone who wants to is welcome to try it. Also, it's in an attached file. /** Based on XMLUnit example MultiLevelElementNameAndTextQualifier. Frank Callahan */ import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.custommonkey.xmlunit.ElementNameQualifier; import org.custommonkey.xmlunit.ElementQualifier; /** * Compares all Element and Text nodes in two pieces of XML. Allows elements of * complex, deeply nested types that are returned in different orders but have * the same content to be recognized as comparable. */ public class RecursiveElementNameAndTextQualifier implements ElementQualifier { private static final ElementNameQualifier NAME_QUALIFIER = new ElementNameQualifier(); /** * Uses element names and the text nested an arbitrary level of child * elements deeper into the element to compare elements. Checks all nodes, * not just first child element. * * <p> * Does not ignore empty text nodes. */ public RecursiveElementNameAndTextQualifier() { } /** * Returns result of recursive comparison of all the nodes of a control and * test element. * */ public boolean qualifyForComparison(Element currentControl, Element currentTest) { return compareNodes(currentControl, currentTest); } private boolean compareNodes(Node currentControl, Node currentTest) { try { // if they are elements, compare names of the two nodes if (!NAME_QUALIFIER.qualifyForComparison((Element) currentControl, (Element) currentTest)) { return false; } // Compare the control and test elements' children NodeList controlNodes = null; NodeList testNodes = null; // Check that both nodes have children and, if so, get lists of them if (currentControl.hasChildNodes() && currentTest.hasChildNodes()) { controlNodes = currentControl.getChildNodes(); testNodes = currentTest.getChildNodes(); } else if (currentControl.hasChildNodes() || currentTest.hasChildNodes()) { return false; // if both nodes are empty, they are comparable } else { return true; } // check that both node lists have the same length if (controlNodes.getLength() != testNodes.getLength()) { return false; } // Do checks of test and control nodes' children int nNodes = controlNodes.getLength(); for (int i = 0; i < nNodes; i++) { Node testNode = testNodes.item(i); Node controlNode = controlNodes.item(i); // check if both node are same type if (controlNode.getNodeType() != testNode.getNodeType()) { return false; } // compare text nodes if (controlNode.getNodeType() == Node.TEXT_NODE) { // compare concatenated, trimmed text nodes if (!catText(controlNode).equals(catText(testNode))) { return false; } // recursive check of current child control and test nodes' // children } else if (!compareNodes((Element) controlNode, (Element) testNode)) { return false; } } // All descendants of current control and test nodes are comparable return true; } catch (Exception e) { return false; } } /** * Concatenates contiguous Text nodes and removes all leading and trailing whitespace. * @param textNode * @return */ private String catText(Node textNode) { assert (textNode.getNodeType() == Node.TEXT_NODE); StringBuffer text = new StringBuffer(); Node next = textNode; do { if (next.getNodeValue() != null) { text.append(next.getNodeValue().trim()); next = next.getNextSibling(); } } while (next != null && next.getNodeType() == Node.TEXT_NODE); return text.toString(); } } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377771&aid=1878549&group_id=23187 |
From: SourceForge.net <no...@so...> - 2008-01-22 15:50:12
|
Feature Requests item #1877458, was opened at 2008-01-22 16:50 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377771&aid=1877458&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: Olivier Armand (extended) Assigned to: Nobody/Anonymous (nobody) Summary: Support for XML entities comparison Initial Comment: The DifferenceEngine's JavaDoc ( http://xmlunit.sourceforge.net/api/org/custommonkey/xmlunit/DifferenceEngine.html ) indicates: "Nodes of other types (eg ENTITY_NODE) will be skipped." This means that for example this test case fails: assertXMLEqual("<root>bla\r\nbla</root>", "<root>bla
\nbla</root>"); I suppose this is because XmlUnit sees \r\n on one side and only \n on the other side since 
 is skipped. In my case the control and the test are generated by different processing chain (and XML parsers/serializers), which may produce either entities or standard characters. XMLUnit.setNormalizeWhitespace(true); seems to be a solution for the special case of this entity, but true support for XML entities comparison would be much better. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377771&aid=1877458&group_id=23187 |
From: SourceForge.net <no...@so...> - 2008-01-19 23:44:12
|
Bugs item #1875554, was opened at 2008-01-20 01:43 Message generated for change (Comment added) made by betelgeus You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1875554&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: Petteri Räty (betelgeus) Assigned to: Nobody/Anonymous (nobody) Summary: testURIResolverForStylesheet fails with JDK >=1.5 Initial Comment: [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.004 sec [junit] Running org.custommonkey.xmlunit.test_SimpleXpathEngine testURIResolverForStylesheet Failure should fail because of unknown include URI junit.framework.AssertionFailedError: should fail because of unknown include URI at org.custommonkey.xmlunit.test_Transform.testURIResolverForStylesheet(test_Transform.java:137) 0.015 happens with 1.5 and 1.6. Doesn't matter whether I use the XSLT implementation from the JDK or Xalan 2.7 ---------------------------------------------------------------------- >Comment By: Petteri Räty (betelgeus) Date: 2008-01-20 01:44 Message: Logged In: YES user_id=924568 Originator: YES [junit] Tests run: 8, Failures: 1, Errors: 0, Time elapsed: 0.209 sec [junit] TEST org.custommonkey.xmlunit.test_Transform FAILED Wrong line pasted ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1875554&group_id=23187 |
From: SourceForge.net <no...@so...> - 2008-01-19 23:43:45
|
Bugs item #1875554, was opened at 2008-01-20 01:43 Message generated for change (Settings changed) made by betelgeus You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1875554&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: Petteri Räty (betelgeus) Assigned to: Nobody/Anonymous (nobody) >Summary: testURIResolverForStylesheet fails with JDK >=1.5 Initial Comment: [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.004 sec [junit] Running org.custommonkey.xmlunit.test_SimpleXpathEngine testURIResolverForStylesheet Failure should fail because of unknown include URI junit.framework.AssertionFailedError: should fail because of unknown include URI at org.custommonkey.xmlunit.test_Transform.testURIResolverForStylesheet(test_Transform.java:137) 0.015 happens with 1.5 and 1.6. Doesn't matter whether I use the XSLT implementation from the JDK or Xalan 2.7 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1875554&group_id=23187 |
From: SourceForge.net <no...@so...> - 2008-01-19 23:43:33
|
Bugs item #1875554, was opened at 2008-01-20 01:43 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1875554&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: Petteri Räty (betelgeus) Assigned to: Nobody/Anonymous (nobody) Summary: testURIResolverForStylesheet fails with JDK >=15 Initial Comment: [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.004 sec [junit] Running org.custommonkey.xmlunit.test_SimpleXpathEngine testURIResolverForStylesheet Failure should fail because of unknown include URI junit.framework.AssertionFailedError: should fail because of unknown include URI at org.custommonkey.xmlunit.test_Transform.testURIResolverForStylesheet(test_Transform.java:137) 0.015 happens with 1.5 and 1.6. Doesn't matter whether I use the XSLT implementation from the JDK or Xalan 2.7 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1875554&group_id=23187 |
From: SourceForge.net <no...@so...> - 2008-01-04 20:23:15
|
Bugs item #1864168, was opened at 2008-01-04 12:23 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1864168&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: Forest (forestcarlisle) Assigned to: Nobody/Anonymous (nobody) Summary: docs with different URI variable names should be similar Initial Comment: Consider the following control document <abc:a xmlns:abc='abc'><b/></abc:a> and the following two test documents <a xmlns='abc'><b/></a> <xyz:a xmlns:xyz='abc'><b/></xyz:a> although they are not identical, they should be similar because the only difference is the URI variable name. the URI variable name is not data but only a hint to the parser on how to abbreviate the URI value, which is data and which is always 'abc'. the problem is that the diff tool reports these both as differences as follows: [not identical] Expected namespace prefix 'abc' but was 'null' - comparing <abc:a...> at /a[1] to <a...> at /a[1] [different] Expected namespace URI 'null' but was 'abc' - comparing <b...> at /a[1]/b[1] to <b...> at /a[1]/b[1] See the attached example. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1864168&group_id=23187 |
From: SourceForge.net <no...@so...> - 2008-01-04 20:05:25
|
Bugs item #1863632, was opened at 2008-01-03 15:05 Message generated for change (Settings changed) made by forestcarlisle You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1863632&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: Works For Me Priority: 5 Private: No Submitted By: Forest (forestcarlisle) Assigned to: Nobody/Anonymous (nobody) Summary: similar ignore-whitespace comparison fails incorrectly Initial Comment: consider the following control xml <a><b/></a> vs. the following test xml <a> <b/> </a> when XMLUnit has been configured to ignore whitespace by XMLUnit.setIgnoreWhitespace(true). if we are ignoring whitespace, then these two documents should be similar. on line 305 of DifferenceEngine.class for v1.1, the diff compares the number of child nodes of <a> and finds that the control xml has 1 child node and the test xml has 3 child nodes. the extra 2 child nodes on the text xml are whitespace-only, but this causes a DifferenceFoundException to be thrown simply because the count is different. this logic is too limited; it should only be thrown when whitespace is *not* being ignored. the fix is to first eliminate any all-whitespace nodes from the node list when ignoring whitespace *unless* the node has exactly one child node. in the latter case, the single child node can be a text node with whitespace which should be regarded as literal text, as in the following example: <a><b> </b></a> is not similar to <a><b/></a> ---------------------------------------------------------------------- Comment By: Forest (forestcarlisle) Date: 2008-01-04 12:03 Message: Logged In: YES user_id=1092645 Originator: YES You actually need to have a namespace variable on the root element (or any child element) to see the problem. Sorry about that. public void testBasicWhitespaceHandling() throws Exception { String control = "<xyz:a xmlns:xyz=\"abc\"><b/></xyz:a>"; String test = "<xyz:a xmlns:xyz=\"abc\">\r\n <b/>\r\n</xyz:a>"; XMLUnit.setIgnoreWhitespace(true); try { Diff diff = XMLUnit.compareXML(control, test); assert diff.similar() : diff.toString(); } finally { XMLUnit.setIgnoreWhitespace(false); } } ---------------------------------------------------------------------- Comment By: Stefan Bodewig (bodewig) Date: 2008-01-04 01:42 Message: Logged In: YES user_id=113148 Originator: NO there must be some other problem with your test since not only are the two pieces similar, they are even identical. I've just added a testcase for your report http://xmlunit.svn.sourceforge.net/viewvc/xmlunit/trunk/?view=log and it passes. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1863632&group_id=23187 |
From: SourceForge.net <no...@so...> - 2008-01-04 20:03:39
|
Bugs item #1863632, was opened at 2008-01-03 15:05 Message generated for change (Comment added) made by forestcarlisle You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1863632&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: Pending Resolution: Works For Me Priority: 5 Private: No Submitted By: Forest (forestcarlisle) Assigned to: Nobody/Anonymous (nobody) Summary: similar ignore-whitespace comparison fails incorrectly Initial Comment: consider the following control xml <a><b/></a> vs. the following test xml <a> <b/> </a> when XMLUnit has been configured to ignore whitespace by XMLUnit.setIgnoreWhitespace(true). if we are ignoring whitespace, then these two documents should be similar. on line 305 of DifferenceEngine.class for v1.1, the diff compares the number of child nodes of <a> and finds that the control xml has 1 child node and the test xml has 3 child nodes. the extra 2 child nodes on the text xml are whitespace-only, but this causes a DifferenceFoundException to be thrown simply because the count is different. this logic is too limited; it should only be thrown when whitespace is *not* being ignored. the fix is to first eliminate any all-whitespace nodes from the node list when ignoring whitespace *unless* the node has exactly one child node. in the latter case, the single child node can be a text node with whitespace which should be regarded as literal text, as in the following example: <a><b> </b></a> is not similar to <a><b/></a> ---------------------------------------------------------------------- Comment By: Forest (forestcarlisle) Date: 2008-01-04 12:03 Message: Logged In: YES user_id=1092645 Originator: YES You actually need to have a namespace variable on the root element (or any child element) to see the problem. Sorry about that. public void testBasicWhitespaceHandling() throws Exception { String control = "<xyz:a xmlns:xyz=\"abc\"><b/></xyz:a>"; String test = "<xyz:a xmlns:xyz=\"abc\">\r\n <b/>\r\n</xyz:a>"; XMLUnit.setIgnoreWhitespace(true); try { Diff diff = XMLUnit.compareXML(control, test); assert diff.similar() : diff.toString(); } finally { XMLUnit.setIgnoreWhitespace(false); } } ---------------------------------------------------------------------- Comment By: Stefan Bodewig (bodewig) Date: 2008-01-04 01:42 Message: Logged In: YES user_id=113148 Originator: NO there must be some other problem with your test since not only are the two pieces similar, they are even identical. I've just added a testcase for your report http://xmlunit.svn.sourceforge.net/viewvc/xmlunit/trunk/?view=log and it passes. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1863632&group_id=23187 |
From: SourceForge.net <no...@so...> - 2008-01-04 10:41:10
|
Feature Requests item #1860491, was opened at 2007-12-29 19:01 Message generated for change (Comment added) made by bodewig You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377771&aid=1860491&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: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: Notice about successful matchings of nodes? Initial Comment: Hello, at the moment, the user gets informed via DifferenceListener.differenceFound(), whenever a *difference* between two nodes is recognized. But as I understood XMLUnit, there is no chance to get informed about a successful *matching* of nodes. This could be helpful, too. Not that urgent, but maybe you could think about it. Thanks in advance, Joerg ---------------------------------------------------------------------- >Comment By: Stefan Bodewig (bodewig) Date: 2008-01-04 11:41 Message: Logged In: YES user_id=113148 Originator: NO That's why it is a DifferenceListener ;-) OK, an additional callback interface that gets notified of successful matches would certainly be possible, it just might get overwhelmed with invocations. Any idea on its name? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377771&aid=1860491&group_id=23187 |
From: SourceForge.net <no...@so...> - 2008-01-04 10:38:24
|
Feature Requests item #1762410, was opened at 2007-07-27 22:55 Message generated for change (Comment added) made by bodewig You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377771&aid=1762410&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: Ken Estes (kestesisme) Assigned to: Nobody/Anonymous (nobody) Summary: use tolerance for floating point values in XML Initial Comment: We produce XML which has numerical values scattered through out the XML both in nodes and attributes. <svg xmlns="http://www.w3.org/2000/svg" width="0.085in" height="0.085in"> <text text-anchor="end" y="92" x="15">36</text> <fo:block-container height="2pc" width="46.5pc" left="2.5pc" top="64pc"> The numerical values can be produced by computations which are carried out in software or hardware. Because of round off errors we need to have a custom string equals function which will allow for round off in the numeric portions of the string. Enclosed please find a file which will perform such numeric comparisons. Here is my suggestion for how to hook it into XMLUnit. /** * Test two non-null values for inequality * @param expected * @param actual * @return TRUE if the values are not equals() equal (taking whitespace * into account if necessary) */ private boolean unequalNotNull(Object expected, Object actual) { boolean bothStrings = (expected instanceof String && actual instanceof String); if (!bothStrings) { return !(expected.equals(actual)); } String expectedString = (String) expected; String actualString = (String) actual; if (XMLUnit.getIgnoreWhitespace()) { expectedString = expected.trim(); actualString = actual.trim(); } if (XMLUnit.getNormalizeWhitespace()) { expectedString = normalizeWhitespace(expectedString); actualString = normalizeWhitespace(actualString); } if (XMLUnit.getTolerantNumericCompare) { return !StringCmpNumericTolerance.equals(expected,actualString); } return !expectedString.equals(actualString); } ---------------------------------------------------------------------- >Comment By: Stefan Bodewig (bodewig) Date: 2008-01-04 11:38 Message: Logged In: YES user_id=113148 Originator: NO Hi Ken, to be honest I feel we would be stretching XMLUnit quite a bit if we added special purpose options like handling of numeric values to its core. The same could be said for case insensitive comparisons of element and attribute names (HTML as a use-case) or texts and so on. It should be possible to use a DifferenceListener of your own that wrapped whatever DifferenceListener would get used normally and performed some special sort of comparision for ATTR_VALUE Differences. We might even add such a DifferenceListener in XMLUnit's examples package. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377771&aid=1762410&group_id=23187 |
From: SourceForge.net <no...@so...> - 2008-01-04 10:31:40
|
Bugs item #1863632, was opened at 2008-01-04 00:05 Message generated for change (Settings changed) made by bodewig You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1863632&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: Pending >Resolution: Works For Me Priority: 5 Private: No Submitted By: Forest (forestcarlisle) Assigned to: Nobody/Anonymous (nobody) Summary: similar ignore-whitespace comparison fails incorrectly Initial Comment: consider the following control xml <a><b/></a> vs. the following test xml <a> <b/> </a> when XMLUnit has been configured to ignore whitespace by XMLUnit.setIgnoreWhitespace(true). if we are ignoring whitespace, then these two documents should be similar. on line 305 of DifferenceEngine.class for v1.1, the diff compares the number of child nodes of <a> and finds that the control xml has 1 child node and the test xml has 3 child nodes. the extra 2 child nodes on the text xml are whitespace-only, but this causes a DifferenceFoundException to be thrown simply because the count is different. this logic is too limited; it should only be thrown when whitespace is *not* being ignored. the fix is to first eliminate any all-whitespace nodes from the node list when ignoring whitespace *unless* the node has exactly one child node. in the latter case, the single child node can be a text node with whitespace which should be regarded as literal text, as in the following example: <a><b> </b></a> is not similar to <a><b/></a> ---------------------------------------------------------------------- Comment By: Stefan Bodewig (bodewig) Date: 2008-01-04 10:42 Message: Logged In: YES user_id=113148 Originator: NO there must be some other problem with your test since not only are the two pieces similar, they are even identical. I've just added a testcase for your report http://xmlunit.svn.sourceforge.net/viewvc/xmlunit/trunk/?view=log and it passes. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1863632&group_id=23187 |
From: SourceForge.net <no...@so...> - 2008-01-04 10:31:10
|
Bugs item #1860681, was opened at 2007-12-29 23:17 Message generated for change (Settings changed) made by bodewig You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1860681&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: jmeister (joerg-meister) >Assigned to: Stefan Bodewig (bodewig) Summary: DifferenceEngine.compareNodeList Initial Comment: Hello, it seems to me as if there is a bug in the non-deprecated version of the method DifferenceEngine.compareNodeList(). To illustrate what I mean, I have generated a small example for you. Let's say, we have the following test respectively control structure: ===[ testDoc ]================================ <books> <book> <title>Kabale und Liebe</title> </book> <book> <title>Schuld und Suehne</title> </book> </books> ===[ controlDoc ]============================= <books> <book> <title>Schuld und Suehne</title> </book> </books> Now, we want to compare these structures via XMLUnit. To do so, we generate a DetailedDiff and use a MultiLevelElementNameAndTextQualifier for a correct Node matching: Diff diff = new Diff(controlDoc, testDoc); diff.overrideElementQualifier(new MultiLevelElementNameAndTextQualifier(2)); DetailedDiff dd = new DetailedDiff(diff); Iterator i = dd.getAllDifferences().iterator(); while (i.hasNext()) System.err.println((Difference) i.next()); The result of the comparison are the following error messages (the structure of the messages are always "comparing <ctrl_node> to <test_node>" with their respective XPaths): Expected number of child nodes '1' but was '2' - comparing <books...> at /books[1] to <books...> at /books[1] Expected sequence of child nodes '0' but was '1' - comparing <book...> at /books[1]/book[1] to <book...> at /books[1]/book[2] Expected presence of child node 'null' but was 'book' - comparing at /books[1]/book[1] to <book...> at /books[1]/book[2] The first and the second message are OK. XMLUnit compared the node "Schuld und Suehne" of the control structure (/books[1]/book[1]) to "Schuld und Suehne" of the test structure (/books[1]/book[2]) and recognized, that the sequence of nodes is different. Now the problem arises: Since there are no more nodes in the control structure, but one node left in the test structure, the DifferenceEngine throws a "CHILD_NODE_NOT_FOUND" message for this node. The problem is, that the XpathNodeTracker for test and control structure are not updated in the source code, therefore they return the wrong XPath for the unmatched node "Kabale and Liebe" - it says it is "/books[1]/book[2]", but in reality it is "/books[1]/book[1]"... In this case (a node in the test structure has no counterpart in the control structure or the other way around), the XpathNodeTracker always return the XPaths to the last node matched in test respectively control structure... I have attached a proposal of how this problem may be solved. Therefore you would have to change the DifferenceEngine as well as the XpathNodeTracker. I have marked up the lines within the source code with the key word "CODE_CHANGE", so it should be easy for you to understand what I mean. If you realize it that way, the result for the example given above would be: Expected number of child nodes '1' but was '2' - comparing <books...> at /books[1] to <books...> at /books[1] Expected sequence of child nodes '0' but was '1' - comparing <book...> at /books[1]/book[1] to <book...> at /books[1]/book[2] Expected presence of child node 'null' but was 'book' - comparing at to <book...> at /books[1]/book[1] Why is it that important, that you fix this bug? Well, if you want to react on the "CHILD_NODE_NOT_FOUND" event in a DifferenceListener, then you will need the exact XPath for the node that has no counterpart. At the moment, the wrong XPath is returned. Besides that, the error message in its current form is confusing... I have used JUnit 3.8.1 Xerces 2.8.1 XMLUnit 1.1 Hope this helps, Joerg ---------------------------------------------------------------------- Comment By: Stefan Bodewig (bodewig) Date: 2008-01-04 11:29 Message: Logged In: YES user_id=113148 Originator: NO Hi Jörg, I've turned your test into a testcase and committed a disabled version of it (stating my expectations of what the XPaths should be) to svn: http://xmlunit.svn.sourceforge.net/viewvc/xmlunit?view=rev&revision=236 Later I'm going to review your changes and we'll see whether they also address the reverse case. It would help tremendously if you could provide your changes as patches (what "svn diff" would give you in a checked out copy) instead of full files in the future. Thanks for the report ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1860681&group_id=23187 |
From: SourceForge.net <no...@so...> - 2008-01-04 10:29:40
|
Bugs item #1860681, was opened at 2007-12-29 23:17 Message generated for change (Comment added) made by bodewig You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1860681&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: jmeister (joerg-meister) Assigned to: Nobody/Anonymous (nobody) Summary: DifferenceEngine.compareNodeList Initial Comment: Hello, it seems to me as if there is a bug in the non-deprecated version of the method DifferenceEngine.compareNodeList(). To illustrate what I mean, I have generated a small example for you. Let's say, we have the following test respectively control structure: ===[ testDoc ]================================ <books> <book> <title>Kabale und Liebe</title> </book> <book> <title>Schuld und Suehne</title> </book> </books> ===[ controlDoc ]============================= <books> <book> <title>Schuld und Suehne</title> </book> </books> Now, we want to compare these structures via XMLUnit. To do so, we generate a DetailedDiff and use a MultiLevelElementNameAndTextQualifier for a correct Node matching: Diff diff = new Diff(controlDoc, testDoc); diff.overrideElementQualifier(new MultiLevelElementNameAndTextQualifier(2)); DetailedDiff dd = new DetailedDiff(diff); Iterator i = dd.getAllDifferences().iterator(); while (i.hasNext()) System.err.println((Difference) i.next()); The result of the comparison are the following error messages (the structure of the messages are always "comparing <ctrl_node> to <test_node>" with their respective XPaths): Expected number of child nodes '1' but was '2' - comparing <books...> at /books[1] to <books...> at /books[1] Expected sequence of child nodes '0' but was '1' - comparing <book...> at /books[1]/book[1] to <book...> at /books[1]/book[2] Expected presence of child node 'null' but was 'book' - comparing at /books[1]/book[1] to <book...> at /books[1]/book[2] The first and the second message are OK. XMLUnit compared the node "Schuld und Suehne" of the control structure (/books[1]/book[1]) to "Schuld und Suehne" of the test structure (/books[1]/book[2]) and recognized, that the sequence of nodes is different. Now the problem arises: Since there are no more nodes in the control structure, but one node left in the test structure, the DifferenceEngine throws a "CHILD_NODE_NOT_FOUND" message for this node. The problem is, that the XpathNodeTracker for test and control structure are not updated in the source code, therefore they return the wrong XPath for the unmatched node "Kabale and Liebe" - it says it is "/books[1]/book[2]", but in reality it is "/books[1]/book[1]"... In this case (a node in the test structure has no counterpart in the control structure or the other way around), the XpathNodeTracker always return the XPaths to the last node matched in test respectively control structure... I have attached a proposal of how this problem may be solved. Therefore you would have to change the DifferenceEngine as well as the XpathNodeTracker. I have marked up the lines within the source code with the key word "CODE_CHANGE", so it should be easy for you to understand what I mean. If you realize it that way, the result for the example given above would be: Expected number of child nodes '1' but was '2' - comparing <books...> at /books[1] to <books...> at /books[1] Expected sequence of child nodes '0' but was '1' - comparing <book...> at /books[1]/book[1] to <book...> at /books[1]/book[2] Expected presence of child node 'null' but was 'book' - comparing at to <book...> at /books[1]/book[1] Why is it that important, that you fix this bug? Well, if you want to react on the "CHILD_NODE_NOT_FOUND" event in a DifferenceListener, then you will need the exact XPath for the node that has no counterpart. At the moment, the wrong XPath is returned. Besides that, the error message in its current form is confusing... I have used JUnit 3.8.1 Xerces 2.8.1 XMLUnit 1.1 Hope this helps, Joerg ---------------------------------------------------------------------- >Comment By: Stefan Bodewig (bodewig) Date: 2008-01-04 11:29 Message: Logged In: YES user_id=113148 Originator: NO Hi Jörg, I've turned your test into a testcase and committed a disabled version of it (stating my expectations of what the XPaths should be) to svn: http://xmlunit.svn.sourceforge.net/viewvc/xmlunit?view=rev&revision=236 Later I'm going to review your changes and we'll see whether they also address the reverse case. It would help tremendously if you could provide your changes as patches (what "svn diff" would give you in a checked out copy) instead of full files in the future. Thanks for the report ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1860681&group_id=23187 |
From: <bo...@us...> - 2008-01-04 10:24:03
|
Revision: 236 http://xmlunit.svn.sourceforge.net/xmlunit/?rev=236&view=rev Author: bodewig Date: 2008-01-04 02:24:02 -0800 (Fri, 04 Jan 2008) Log Message: ----------- add (disabled) test for bug 1860681 Modified Paths: -------------- trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java Modified: trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java =================================================================== --- trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java 2008-01-04 09:45:17 UTC (rev 235) +++ trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java 2008-01-04 10:24:02 UTC (rev 236) @@ -1,6 +1,6 @@ /* ****************************************************************** -Copyright (c) 2001-2007, Jeff Martin, Tim Bacon +Copyright (c) 2001-2008, Jeff Martin, Tim Bacon All rights reserved. Redistribution and use in source and binary forms, with or without @@ -42,6 +42,7 @@ import java.util.Iterator; import java.util.List; +import org.custommonkey.xmlunit.examples.MultiLevelElementNameAndTextQualifier; import org.w3c.dom.Document; import org.xml.sax.InputSource; @@ -243,6 +244,59 @@ assertEquals(3, changes.size()); } + /** + * Bug 1860681 + * @see https://sourceforge.net/tracker/index.php?func=detail&aid=1860681&group_id=23187&atid=377768 + */ + public void XtestXpathOfMissingNode() throws Exception { + String control = + "<books>" + + " <book>" + + " <title>Kabale und Liebe</title>" + + " </book>" + + " <book>" + + " <title>Schuld und Suehne</title>" + + " </book>" + + "</books>"; + String test = + "<books>" + + " <book>" + + " <title>Schuld und Suehne</title>" + + " </book>" + + "</books>"; + XMLUnit.setIgnoreWhitespace(true); + try { + Diff diff = new Diff(control, test); + diff.overrideElementQualifier(new MultiLevelElementNameAndTextQualifier(2)); + DetailedDiff dd = new DetailedDiff(diff); + List l = dd.getAllDifferences(); + assertEquals(3, l.size()); + // (0) number of children, (1) node not found, (2) order different + Difference d = (Difference) l.get(1); + assertEquals(DifferenceConstants.CHILD_NODE_NOT_FOUND_ID, + d.getId()); + assertEquals("/books[1]/book[1]", + d.getControlNodeDetail().getXpathLocation()); + assertNull(d.getTestNodeDetail().getXpathLocation()); + + // and reverse + diff = new Diff(test, control); + diff.overrideElementQualifier(new MultiLevelElementNameAndTextQualifier(2)); + dd = new DetailedDiff(diff); + l = dd.getAllDifferences(); + assertEquals(3, l.size()); + // (0) number of children, (1) order different, (2) node not found + d = (Difference) l.get(2); + assertEquals(DifferenceConstants.CHILD_NODE_NOT_FOUND_ID, + d.getId()); + assertEquals("/books[1]/book[1]", + d.getTestNodeDetail().getXpathLocation()); + assertNull(d.getControlNodeDetail().getXpathLocation()); + } finally { + XMLUnit.setIgnoreWhitespace(false); + } + } + protected Diff buildDiff(Document control, Document test) { return new DetailedDiff(super.buildDiff(control, test)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bo...@us...> - 2008-01-04 09:45:24
|
Revision: 235 http://xmlunit.svn.sourceforge.net/xmlunit/?rev=235&view=rev Author: bodewig Date: 2008-01-04 01:45:17 -0800 (Fri, 04 Jan 2008) Log Message: ----------- happy new year Modified Paths: -------------- trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_Diff.java Modified: trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_Diff.java =================================================================== --- trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_Diff.java 2008-01-04 09:39:29 UTC (rev 234) +++ trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_Diff.java 2008-01-04 09:45:17 UTC (rev 235) @@ -1,6 +1,6 @@ /* ****************************************************************** -Copyright (c) 2001-2007, Jeff Martin, Tim Bacon +Copyright (c) 2001-2008, Jeff Martin, Tim Bacon All rights reserved. Redistribution and use in source and binary forms, with or without This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SourceForge.net <no...@so...> - 2008-01-04 09:42:42
|
Bugs item #1863632, was opened at 2008-01-04 00:05 Message generated for change (Comment added) made by bodewig You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1863632&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: Forest (forestcarlisle) Assigned to: Nobody/Anonymous (nobody) Summary: similar ignore-whitespace comparison fails incorrectly Initial Comment: consider the following control xml <a><b/></a> vs. the following test xml <a> <b/> </a> when XMLUnit has been configured to ignore whitespace by XMLUnit.setIgnoreWhitespace(true). if we are ignoring whitespace, then these two documents should be similar. on line 305 of DifferenceEngine.class for v1.1, the diff compares the number of child nodes of <a> and finds that the control xml has 1 child node and the test xml has 3 child nodes. the extra 2 child nodes on the text xml are whitespace-only, but this causes a DifferenceFoundException to be thrown simply because the count is different. this logic is too limited; it should only be thrown when whitespace is *not* being ignored. the fix is to first eliminate any all-whitespace nodes from the node list when ignoring whitespace *unless* the node has exactly one child node. in the latter case, the single child node can be a text node with whitespace which should be regarded as literal text, as in the following example: <a><b> </b></a> is not similar to <a><b/></a> ---------------------------------------------------------------------- >Comment By: Stefan Bodewig (bodewig) Date: 2008-01-04 10:42 Message: Logged In: YES user_id=113148 Originator: NO there must be some other problem with your test since not only are the two pieces similar, they are even identical. I've just added a testcase for your report http://xmlunit.svn.sourceforge.net/viewvc/xmlunit/trunk/?view=log and it passes. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1863632&group_id=23187 |
From: <bo...@us...> - 2008-01-04 09:39:27
|
Revision: 234 http://xmlunit.svn.sourceforge.net/xmlunit/?rev=234&view=rev Author: bodewig Date: 2008-01-04 01:39:29 -0800 (Fri, 04 Jan 2008) Log Message: ----------- Add testcase for bug report 1833632 Modified Paths: -------------- trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_Diff.java Modified: trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_Diff.java =================================================================== --- trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_Diff.java 2007-11-27 12:27:27 UTC (rev 233) +++ trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_Diff.java 2008-01-04 09:39:29 UTC (rev 234) @@ -728,4 +728,20 @@ } } + /** + * Bug Report 1863632 + * @see http://sourceforge.net/tracker/index.php?func=detail&aid=1863632&group_id=23187&atid=377768 + */ + public void testBasicWhitespaceHandling() throws Exception { + String control = "<a><b/></a>"; + String test = "<a>\r\n <b/>\r\n</a>"; + XMLUnit.setIgnoreWhitespace(true); + try { + Diff diff = XMLUnit.compareXML(control, test); + assertTrue(diff.toString(), diff.identical()); + } finally { + XMLUnit.setIgnoreWhitespace(false); + } + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SourceForge.net <no...@so...> - 2008-01-03 23:04:57
|
Bugs item #1863632, was opened at 2008-01-03 15:05 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1863632&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: Forest (forestcarlisle) Assigned to: Nobody/Anonymous (nobody) Summary: similar ignore-whitespace comparison fails incorrectly Initial Comment: consider the following control xml <a><b/></a> vs. the following test xml <a> <b/> </a> when XMLUnit has been configured to ignore whitespace by XMLUnit.setIgnoreWhitespace(true). if we are ignoring whitespace, then these two documents should be similar. on line 305 of DifferenceEngine.class for v1.1, the diff compares the number of child nodes of <a> and finds that the control xml has 1 child node and the test xml has 3 child nodes. the extra 2 child nodes on the text xml are whitespace-only, but this causes a DifferenceFoundException to be thrown simply because the count is different. this logic is too limited; it should only be thrown when whitespace is *not* being ignored. the fix is to first eliminate any all-whitespace nodes from the node list when ignoring whitespace *unless* the node has exactly one child node. in the latter case, the single child node can be a text node with whitespace which should be regarded as literal text, as in the following example: <a><b> </b></a> is not similar to <a><b/></a> ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1863632&group_id=23187 |
From: SourceForge.net <no...@so...> - 2007-12-29 22:17:50
|
Bugs item #1860681, was opened at 2007-12-29 22:17 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1860681&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: jmeister (joerg-meister) Assigned to: Nobody/Anonymous (nobody) Summary: DifferenceEngine.compareNodeList Initial Comment: Hello, it seems to me as if there is a bug in the non-deprecated version of the method DifferenceEngine.compareNodeList(). To illustrate what I mean, I have generated a small example for you. Let's say, we have the following test respectively control structure: ===[ testDoc ]================================ <books> <book> <title>Kabale und Liebe</title> </book> <book> <title>Schuld und Suehne</title> </book> </books> ===[ controlDoc ]============================= <books> <book> <title>Schuld und Suehne</title> </book> </books> Now, we want to compare these structures via XMLUnit. To do so, we generate a DetailedDiff and use a MultiLevelElementNameAndTextQualifier for a correct Node matching: Diff diff = new Diff(controlDoc, testDoc); diff.overrideElementQualifier(new MultiLevelElementNameAndTextQualifier(2)); DetailedDiff dd = new DetailedDiff(diff); Iterator i = dd.getAllDifferences().iterator(); while (i.hasNext()) System.err.println((Difference) i.next()); The result of the comparison are the following error messages (the structure of the messages are always "comparing <ctrl_node> to <test_node>" with their respective XPaths): Expected number of child nodes '1' but was '2' - comparing <books...> at /books[1] to <books...> at /books[1] Expected sequence of child nodes '0' but was '1' - comparing <book...> at /books[1]/book[1] to <book...> at /books[1]/book[2] Expected presence of child node 'null' but was 'book' - comparing at /books[1]/book[1] to <book...> at /books[1]/book[2] The first and the second message are OK. XMLUnit compared the node "Schuld und Suehne" of the control structure (/books[1]/book[1]) to "Schuld und Suehne" of the test structure (/books[1]/book[2]) and recognized, that the sequence of nodes is different. Now the problem arises: Since there are no more nodes in the control structure, but one node left in the test structure, the DifferenceEngine throws a "CHILD_NODE_NOT_FOUND" message for this node. The problem is, that the XpathNodeTracker for test and control structure are not updated in the source code, therefore they return the wrong XPath for the unmatched node "Kabale and Liebe" - it says it is "/books[1]/book[2]", but in reality it is "/books[1]/book[1]"... In this case (a node in the test structure has no counterpart in the control structure or the other way around), the XpathNodeTracker always return the XPaths to the last node matched in test respectively control structure... I have attached a proposal of how this problem may be solved. Therefore you would have to change the DifferenceEngine as well as the XpathNodeTracker. I have marked up the lines within the source code with the key word "CODE_CHANGE", so it should be easy for you to understand what I mean. If you realize it that way, the result for the example given above would be: Expected number of child nodes '1' but was '2' - comparing <books...> at /books[1] to <books...> at /books[1] Expected sequence of child nodes '0' but was '1' - comparing <book...> at /books[1]/book[1] to <book...> at /books[1]/book[2] Expected presence of child node 'null' but was 'book' - comparing at to <book...> at /books[1]/book[1] Why is it that important, that you fix this bug? Well, if you want to react on the "CHILD_NODE_NOT_FOUND" event in a DifferenceListener, then you will need the exact XPath for the node that has no counterpart. At the moment, the wrong XPath is returned. Besides that, the error message in its current form is confusing... I have used JUnit 3.8.1 Xerces 2.8.1 XMLUnit 1.1 Hope this helps, Joerg ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377768&aid=1860681&group_id=23187 |
From: SourceForge.net <no...@so...> - 2007-12-29 18:01:28
|
Feature Requests item #1860491, was opened at 2007-12-29 10:01 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377771&aid=1860491&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: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: Notice about successful matchings of nodes? Initial Comment: Hello, at the moment, the user gets informed via DifferenceListener.differenceFound(), whenever a *difference* between two nodes is recognized. But as I understood XMLUnit, there is no chance to get informed about a successful *matching* of nodes. This could be helpful, too. Not that urgent, but maybe you could think about it. Thanks in advance, Joerg ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377771&aid=1860491&group_id=23187 |