On 2010-09-28, Miguel wrote: > I have a doubt though: I'm trying to compare 2 XML files for their > content. This means that:
> <primarysource> > <reportertitle>Dr</reportertitle> > <reportergivename>Antonio</reportergivename> > <reportermiddlename></reportermiddlename> > <reporterfamilyname>Perez</reporterfamilyname> > <primarysource> > and > <primarysource> > <reportertitle>Dr</reportertitle> > <reportergivename>Antonio</reportergivename> > <reporterfamilyname>Perez</reporterfamilyname> > <primarysource> > Are similar, because the non-null/empty content is essentially the same. > Is there an option on xmlunit to make the Diff engine ignore empty tags > so that these XML are calculated to be similar? No, no built-in option. You could write an implementation of DifferenceListener <http://xmlunit.sourceforge.net/userguide/html/ar01s03.html#DifferenceListener> which would check whether the Node that is part of a CHILD_NODE_NOT difference has an empty text content and return RETURN_IGNORE_DIFFERENCE_NODES_SIMILAR in that case. You will also want to disable compareUnmateched <http://xmlunit.sourceforge.net/userguide/html/ar01s03.html#Comparison%20of%20Unmatched%20Elements> Stefan ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Xmlunit-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/xmlunit-general
