Table is distorted while comparing HTML data using daisydiff.jar

98 Views Asked by At

Left side table is distorted while comparing two HTML table data using daisydiff.jar.

I need your support to fix this issue. Thanks in advance

Using below code

StringWriter finalResult = new StringWriter();
SAXTransformerFactory tf = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); TransformerHandler result = tf.newTransformerHandler(); 
        result.getTransformer().setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); 
result.getTransformer().setOutputProperty(OutputKeys.INDENT, "no");
result.getTransformer().setOutputProperty(OutputKeys.METHOD, "html");
result.getTransformer().setOutputProperty(OutputKeys.ENCODING, "UTF-8");
result.setResult(new StreamResult(finalResult));

ContentHandler postProcess = result;
Locale locale = Locale.getDefault();
String prefix = "diff";

NekoHtmlParser cleaner = new NekoHtmlParser();

InputSource oldSource = new InputSource (new String reader(html1));
InputSource newSource = new InputSource (new String reader(html2));

DomTreeBuilder oldHandler = new DomTreeBuilder ();
cleaner.parse(oldSource, oldHandler);
TextNodeComparator leftComparator = new TextNodeComparator (oldHandler, locale);

DomTreeBuilder newHandler = new DomTreeBuilder ();
cleaner.parse(newSource, newHandler);
TextNodeComparator rightComparator = new TextNodeComparator (newHandler, locale);

HtmlSaxDiffOutput output = new HtmlSaxDiffOutput (postProcess, prefix);

HTMLDiffer differ = new HTMLDiffer(output);
differ.diff(leftComparator, rightComparator); 
0

There are 0 best solutions below