java - Ignore those elements that are commented out in one xml file using xmlunit -


i want compare 2 xml files. using xmlunit compare. having problem while comparing following xml snippets.

expected:

<detail>     <participant>         <personalinfo>         <ssn>405018111</ssn>         <!--<title>mr</title>-->     </personalinfo>     <!--<personaldemo>         <email>someemail@email.com</email>         <edeliveryflag>true</edeliveryflag>     </personaldemo>--> </detail> 

actual:

<detail>     <participant>         <personalinfo>         <ssn>405018111</ssn>         <title>mr</title>     </personalinfo>     <personaldemo>         <email>someemail@email.com</email>         <edeliveryflag>false</edeliveryflag>     </personaldemo> </detail> 
  1. it fail, because "title" tag missing (because commented out) in expected while present in actual
  2. it fail, because "personaldemo" tag missing (because commented out) in expected while present in actual
  3. it fail, because, "ppsdetails" has different number of child nodes (because commented out nodes not considered) in expected , in actual

what need want ignore elements in actual commented out in expected

any please

i suggest have write own xml parser can see tags want ignore. in task remove ignored tags expected , actual xml , match others tags validation or comparison.

i think have 2 options here either use 1 of them between 2 parsers:

dom parser sax parser 

i know it's not best solution, other thoughts welcome...

edit

i believe need write wrapper on xmluint. take xml input after removing of ignored tags(wrapper task) , rest of functionality same.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -