Thank you again Stefan, this is very helpful, I am all set with this.
could you pl. let me know how if there is a way to run a xmlunit test case from
the command line (I have been running my testcases through the NetBeans IDE.
Thanks.
Anamika.
Abhin: I wrote the following (in case this is still helpful):
public int differenceFound(Difference d) {
Node controlN = d.getControlNodeDetail().getNode();
Node testN = d.getTestNodeDetail().getNode();
String controlNodeName = controlN.getNodeName();
String testNodeName = testN.getNodeName();
String testXpathLoc = d.getTestNodeDetail().getXpathLocation();
String conXpathLoc = d.getControlNodeDetail().getXpathLocation();
String foo = "/abcd[1]/efgh[1]/ijk[1]/text()[1]";
if(conXpathLoc.equals(foo) && testXpathLoc.equals(foo))
return RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
else return RETURN_ACCEPT_DIFFERENCE;
}----------------------------------------------------------
> To: [email protected]> From: [EMAIL PROTECTED]> Date:
> Tue, 8 May 2007 06:42:34 +0200> CC: [EMAIL PROTECTED]> Subject: Re:
> [Xmlunit-general] Comparing two XML documents while skipping certain nodes> >
> On Fri, 4 May 2007, Anamika Majumder <[EMAIL PROTECTED]>> wrote:> > > The
> method int differenceFound(org.custommonkey.xmlunit.Difference> > difference)
> in the DifferenceListener interface needs a Difference> > object, while the
> Difference class has only protected constructors.> > The tests I am writing
> are in a different package and do not have> > access to any protected
> constructors in the package> > "org.custommonkey.xmlunit", am I missing the
> point entirely??> > If you are you trying to to test your custom
> implementation of> DifferenceListener, this is a problem, I agree.> > What I
> suggested was that you write a DifferenceListener like> (untested code, I
> didn't try to even compile it):> > public class MyDiffListener implements
> DifferenceListener {> > public int differenceFound(Difference d) {> if
> (d.getId() == DifferenceConstants.ELEMENT_TAG_NAME_ID> &&
> d.getControlNodeDetail().getValue().equals("foo")> &&
> d.getTestNodeDetail().getValue().equals("bar")) {> return
> RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;> }> return
> RETURN_ACCEPT_DIFFERENCE;> }> > public void skippedComparison(Node control,
> Node test) {}> }> > and use Diff.overrideDifferenceListener() with an
> instance of your> class.> > I know you cannot write tests for MyDiffListener,
> but it is pretty> easy to validate and using the approach outlined above,
> your XMLUnit> tests should skip over differences between "foo" and "bar"
> nodes.> > Stefan> >
> ------------------------------------------------------------------------->
> This SF.net email is sponsored by DB2 Express> Download DB2 Express C - the
> FREE version of DB2 express and take> control of your XML. No limits. Just
> data. Click to get it now.> http://sourceforge.net/powerbar/db2/>
> _______________________________________________> Xmlunit-general mailing
> list> [email protected]>
> https://lists.sourceforge.net/lists/listinfo/xmlunit-general
_________________________________________________________________
See what you’re getting into…before you go there.
http://newlivehotmail.com/?ocid=TXT_TAGWL_migration_HM_viral_preview_0507-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Xmlunit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xmlunit-general