Comparing DOM trees 2003-01-29 - By Mucha, Dietrich 3861 S-PN-RD6
>> I'm trying to find out the best way to compare 2 DOM trees. Have a look at xmlUnit < http://xmlunit.sourceforge.net/>. >From the web page: XMLUnit allows you to assertXMLEquals("<stuff></stuff>", "<stuff/>"); or and you can do this assertXMLEquals(xmlFile, anotherXmlFile); and this assertXMLEquals(xmlStream, xmlFile);
Compare XML in files, or in Strings. Extract specific content using XPath expressions or perform XSL transformations. Even treat badly formed HTML as XML so it can be tested too. Hope this helps Dietrich
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1126" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Arial><FONT size=2><SPAN class=518342414-29012003><FONT color=#0000ff> >> </FONT></SPAN>I'm trying to find out the best way to compare 2 DOM trees. <SPAN class=518342414-29012003><FONT color=#0000ff> </FONT></SPAN></FONT></FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><SPAN class=518342414-29012003><FONT face=Arial color=#0000ff size=2>Have a look at xmlUnit <<A href="http://xmlunit.sourceforge.net/">http://xmlunit.sourceforge.net/</A>>. </FONT></SPAN></DIV> <DIV><SPAN class=518342414-29012003><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV> <DIV><SPAN class=518342414-29012003><FONT face=Arial color=#0000ff size=2>From the web page:</FONT></SPAN></DIV> <DIV><SPAN class=518342414-29012003><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV> <DIV><SPAN class=518342414-29012003><FONT face=Arial color=#0000ff size=2>XMLUnit allows you to </FONT></SPAN></DIV> <DIV><SPAN class=518342414-29012003><FONT face=Arial color=#0000ff size=2> assertXMLEquals("<stuff></stuff>", "<stuff/>"); </FONT></SPAN></DIV> <DIV><SPAN class=518342414-29012003><FONT face=Arial color=#0000ff size=2>or and you can do this </FONT></SPAN></DIV> <DIV><SPAN class=518342414-29012003><FONT face=Arial color=#0000ff size=2> assertXMLEquals(xmlFile, anotherXmlFile); </FONT></SPAN></DIV> <DIV><SPAN class=518342414-29012003><FONT face=Arial color=#0000ff size=2>and this </FONT></SPAN></DIV> <DIV><SPAN class=518342414-29012003><FONT face=Arial color=#0000ff size=2> assertXMLEquals(xmlStream, xmlFile);</FONT></SPAN></DIV><SPAN class=518342414-29012003> <DIV><BR><FONT face=Arial color=#0000ff size=2>Compare XML in files, or in Strings.<BR>Extract specific content using XPath expressions or perform XSL transformations.<BR>Even treat badly formed HTML as XML so it can be tested too . </FONT></DIV> <DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV> <DIV><SPAN class=518342414-29012003><FONT face=Arial color=#0000ff size=2>Hope this helps</FONT></SPAN></DIV> <DIV><SPAN class=518342414-29012003><FONT face=Arial color=#0000ff size=2>Dietrich</FONT></SPAN></SPAN></DIV></BODY></HTML>
--------------------------------------------------------------------- To unsubscribe, e-mail: xerces-j-user-unsubscribe@(protected) For additional commands, e-mail: xerces-j-user-help@(protected)
|
|