Forum Discussion
divman
11 years agoContributor
Sorry for late response. I read your requirement. Once i had the same requirement in my project and was found a solution. But i am not sure if that is a proper solution or not. Still you can use that. See this below link.
http://groovy.329449.n5.nabble.com/How-to-compare-2-XMLs-by-ignoring-set-of-elements-inside-it-tt5719438.html
http://groovy.329449.n5.nabble.com/How-to-compare-2-XMLs-by-ignoring-set-of-elements-inside-it-tt5719438.html
nmrao
11 years agoCommunity Hero
@divman, thank you for sharing the link. As it was mentioned in the previous post, xmlunit was pointed with additional information that if there are complex list, then xmlunit does not handle unless one can input sorted xmls to it.
- divman11 years agoContributor
Hi Rao,
Thanks for your reply. Could you please help me understand here, what do you mean "input sorted xmls"?. Sorry if this is a basic question.
- nmrao11 years agoCommunity HeroXml Schema Definition contains repeating element which again complex one, then xmlunit does not sort, then mismatch happens on comparison.
- divman11 years agoContributor
Sorry if i am not understood properly. But would like to clarify. I tested the code in my project stuff and here is the my xml will look like.
<AcctBal xmlns="http://www.ifxforum.org/IFX_150"> <BalType>AvgLedger</BalType> <CurAmt> <Amt>422583.92</Amt> <CurCode>USD</CurCode> <UpDt xmlns="http://www.ifxforum.org/IFX_150">2014-04-11T00:00:00-04:00</UpDt> <LastStmtDt xmlns="http://www.ifxforum.org/IFX_150">2014-04-17</LastStmtDt> <EffDt>2014-04-29T14:46:49.514000-04:00</EffDt> </CurAmt> </AcctBal>and this section will have repeated number of times in my xml wsdl schema and the tags 'UpDt', 'LastStmtDt' and 'EffDt' will come atleast 20 times in one of my soap response. I have tested this comparison code for this kind of XML and i was success at all times.
Could you please help me what could be the possible scenario or case, where you are saying this will not work for 'input sorted xmls'.