{"action":"created","issue":{"url":"https://api.github.com/repos/xmlunit/user-guide/issues/6","repository_url":"https://api.github.com/repos/xmlunit/user-guide","labels_url":"https://api.github.com/repos/xmlunit/user-guide/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/xmlunit/user-guide/issues/6/comments","events_url":"https://api.github.com/repos/xmlunit/user-guide/issues/6/events","html_url":"https://github.com/xmlunit/user-guide/issues/6","id":171868600,"number":6,"title":"Compare results are wrong if child node count is different in both the xml files.","user":{"login":"ravikumarpeta","id":5136356,"avatar_url":"https://avatars.githubusercontent.com/u/5136356?v=3","gravatar_id":"","url":"https://api.github.com/users/ravikumarpeta","html_url":"https://github.com/ravikumarpeta","followers_url":"https://api.github.com/users/ravikumarpeta/followers","following_url":"https://api.github.com/users/ravikumarpeta/following{/other_user}","gists_url":"https://api.github.com/users/ravikumarpeta/gists{/gist_id}","starred_url":"https://api.github.com/users/ravikumarpeta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ravikumarpeta/subscriptions","organizations_url":"https://api.github.com/users/ravikumarpeta/orgs","repos_url":"https://api.github.com/users/ravikumarpeta/repos","events_url":"https://api.github.com/users/ravikumarpeta/events{/privacy}","received_events_url":"https://api.github.com/users/ravikumarpeta/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/xmlunit/user-guide/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-08-18T10:26:08Z","updated_at":"2016-09-29T09:18:44Z","closed_at":"2016-09-16T20:08:59Z","body":"XML1\r\n...................\r\n```\r\n<flowers>\r\n<flower>Daisy</flower>\r\n<flower>Roses</flower>\r\n<flower>Daisy1</flower>\r\n</flowers>\r\n```\r\nXML2\r\n............................\r\n```\r\n<flowers>\r\n<flower>Roses</flower>\r\n<flower>Daisy1</flower>\r\n</flowers>\r\n```\r\n\r\n```\r\n var myDiff = DiffBuilder.Compare(controlXml).WithTest(testXml).CheckForSimilar()\r\n                  .WithNodeMatcher(new DefaultNodeMatcher(ElementSelectors.ByName)).Build();\r\n```\r\n\r\n**Expected difference is 1, but it is giving 4 differences.**\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/xmlunit/user-guide/issues/comments/250414125","html_url":"https://github.com/xmlunit/user-guide/issues/6#issuecomment-250414125","issue_url":"https://api.github.com/repos/xmlunit/user-guide/issues/6","id":250414125,"user":{"login":"ravikumarpeta","id":5136356,"avatar_url":"https://avatars.githubusercontent.com/u/5136356?v=3","gravatar_id":"","url":"https://api.github.com/users/ravikumarpeta","html_url":"https://github.com/ravikumarpeta","followers_url":"https://api.github.com/users/ravikumarpeta/followers","following_url":"https://api.github.com/users/ravikumarpeta/following{/other_user}","gists_url":"https://api.github.com/users/ravikumarpeta/gists{/gist_id}","starred_url":"https://api.github.com/users/ravikumarpeta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ravikumarpeta/subscriptions","organizations_url":"https://api.github.com/users/ravikumarpeta/orgs","repos_url":"https://api.github.com/users/ravikumarpeta/repos","events_url":"https://api.github.com/users/ravikumarpeta/events{/privacy}","received_events_url":"https://api.github.com/users/ravikumarpeta/received_events","type":"User","site_admin":false},"created_at":"2016-09-29T09:18:43Z","updated_at":"2016-09-29T09:18:43Z","body":"Thanks you for your update , it working as i expected.\r\nand \r\ni came across another scenario which not giving results as expected.\r\n\r\nCompare :\r\n\r\n```\r\n<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<Details>\r\n  <Students>\r\n\r\n    <Student>\r\n      <Id>2</Id>\r\n      <Name>RK</Name>\r\n      <Marks>\r\n        <English>90</English>\r\n        <Maths>100</Maths>\r\n        <Science>95</Science>\r\n      </Marks>\r\n    </Student>\r\n    <Student>\r\n      <Id>1</Id>\r\n      <Name>sample</Name>\r\n      <Marks>\r\n        <English>90</English>\r\n        <Maths>100</Maths>\r\n        <Science>95</Science>\r\n      </Marks>\r\n    </Student>\r\n \r\n  </Students>\r\n</Details>\r\n```\r\n\r\nTest :+1: \r\n\r\n<Details>\r\n  <Students>\r\n    <Student>\r\n      <Id>1</Id>\r\n      <Name>sample1</Name>\r\n     \r\n    </Student>\r\n    <Student>\r\n      <Id>2</Id>\r\n      <Name>RK</Name>\r\n      <Marks>\r\n        <English>90</English>\r\n        <Maths>100</Maths>\r\n        <Science>95</Science>\r\n      </Marks>\r\n    </Student>\r\n  </Students>\r\n</Details>\r\n\r\n```\r\n var selector = ElementSelectors.ConditionalBuilder().WhenElementIsNamed(\"Student\").ThenUse(ElementSelectors.ByXPath(\"./Id\", ElementSelectors.ByNameAndText))\r\n            .ElseUse(ElementSelectors.ByNameAndAllAttributes).Build();\r\n            var result = DiffBuilder.Compare(compare).WithTest(test).CheckForSimilar().WithNodeMatcher(new DefaultNodeMatcher(selector)).Build();\r\n\r\n```\r\nExpected Result \r\n<English> missing\r\n<Maths>missing\r\n <Science>missing\r\n\r\n\r\nActual Result\r\n\r\n{Expected child 'Marks' but was '' - comparing <Marks...> at /Details[1]/Students[1]/Student[2]/Marks[1] to <NULL> (DIFFERENT)}\r\n\r\n\r\n"}}
{"actor":{"display_login":"ravikumarpeta"}}