Issue 55 in daisydiff: error on line 6 at column 8: Opening and ending tag mismatch: link line 0 and head

20 views
Skip to first unread message

codesite...@google.com

unread,
Aug 12, 2013, 7:30:13 AM8/12/13
to dais...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 55 by jignesh....@gmail.com: error on line 6 at column 8: Opening
and ending tag mismatch: link line 0 and head
http://code.google.com/p/daisydiff/issues/detail?id=55

What steps will reproduce the problem?
1. I am using daisydiff 1.2 jar file and I have added that into my Maven
Repository.
2. I am trying to generate html comparison output directly to new tab and I
pass ServletOutputStream to do that.
3.

What is the expected output? What do you see instead?
I should see the difference between two html that I pass to InputSource in
String format. But I get "error on line 6 at column 8: Opening and ending
tag mismatch: link line 0 and head" this error. please look at the
attachment.

What version of the product are you using? On what operating system?
product version = daisydiff-1.2
OS = Windows 7

Please provide any additional information below.
If I create a standalone java application and use daisydiff jar then it
successfully produces difference between two html. and places the output
into daisydiff.htm file. Problem starts here: I added daisydiff 1.2 jar
file into my maven repo. and I am using that in my web application. I pass
old and new html as a String to the code below that I have taken from
Main.java file and twisted according to my need.



public class DaisyDiffImpl
{
boolean htmlOut = true;

public void generateProgrammeDifference(String newHtml, String oldHtml,
OutputStream outputStream)
{
try
{
SAXTransformerFactory tf = (SAXTransformerFactory)
TransformerFactory.newInstance();
TransformerHandler result = tf.newTransformerHandler();
result.setResult(new StreamResult(outputStream)); // can assign output
stream or writer object instead of file. in our case.
XslFilter filter = new XslFilter();
ContentHandler postProcess = htmlOut?
filter.xsl(result, "org/outerj/daisy/diff/htmlheader.xsl"):result;
Locale locale = Locale.getDefault();
String prefix = "diff";
HtmlCleaner cleaner = new HtmlCleaner();
InputSource oldSource = new InputSource(new StringReader(oldHtml));
InputSource newSource = new InputSource(new StringReader(newHtml));
System.out.println("new Html = "+newHtml);
System.out.println("old html =" + oldHtml);
System.out.println("old source = "+oldSource);
System.out.println("new Source "+newSource);

DomTreeBuilder oldHandler = new DomTreeBuilder();
System.out.println("cleaner = "+cleaner);
cleaner.cleanAndParse(oldSource, oldHandler);
System.out.print(".");
TextNodeComparator leftComparator = new TextNodeComparator(
oldHandler, locale);

DomTreeBuilder newHandler = new DomTreeBuilder();
cleaner.cleanAndParse(newSource, newHandler);
System.out.print(".");
TextNodeComparator rightComparator = new TextNodeComparator(
newHandler, locale);

postProcess.startDocument();
postProcess.startElement("", "diffreport", "diffreport",
new AttributesImpl());
// doCSS(css, postProcess);
postProcess.startElement("", "diff", "diff",
new AttributesImpl());
HtmlSaxDiffOutput output = new HtmlSaxDiffOutput(postProcess,
prefix);

HTMLDiffer differ = new HTMLDiffer(output);
differ.diff(leftComparator, rightComparator);
System.out.print(".");
postProcess.endElement("", "diff", "diff");
postProcess.endElement("", "diffreport", "diffreport");
postProcess.endDocument();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}


I pass ServletOutputStream from my Spring application so it should generate
output directly to new tab. But instead of getting comparison output. I get
the error (attached file). When I do 'view page source' on the page where I
get this error. I can see it has generated html comparison output but I
can't see output on the page.
Let me know if I am missing anything. or what should I do to resolve this
issue.



--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

codesite...@google.com

unread,
Aug 12, 2013, 7:33:55 AM8/12/13
to dais...@googlegroups.com

Comment #1 on issue 55 by jignesh....@gmail.com: error on line 6 at column
8: Opening and ending tag mismatch: link line 0 and head
http://code.google.com/p/daisydiff/issues/detail?id=55

sorry forgot to attach file. so attaching in the comment.

Attachments:
daisydiff_issue.png 11.6 KB

codesite...@google.com

unread,
Aug 12, 2013, 7:39:26 AM8/12/13
to dais...@googlegroups.com

Comment #2 on issue 55 by jignesh....@gmail.com: error on line 6 at column
8: Opening and ending tag mismatch: link line 0 and head
http://code.google.com/p/daisydiff/issues/detail?id=55

I just had a look at the line number 6 of page source and I found that the
<link rel="stylesheet" type="text/css" href="css/diff.css">
does not have end tag. That can be this error. I think it's daisydiff
generated. Please let me know how to solve this error.

Full generated html Page source:

<?xml version="1.0" encoding="UTF-8"?>
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/diff.css">
</head>
<body>
<script type="text/javascript"
src="js/tooltip/wz_tooltip.js"></script><script type="text/javascript"
src="js/tooltip/tip_balloon.js"></script><script type="text/javascript"
src="js/dojo/dojo.js"></script><script type="text/javascript"
src="js/diff.js"></script><script>
htmlDiffInit();
</script>
<div class="diff-topbar">
<table class="diffpage-html-firstlast">
<tr>
<td style="text-align: left;"><a class="diffpage-html-a"
onclick="scrollToEvent(event)" id="first-diff" href="#changed-diff-0"
next="changed-diff-0"><img title="Go to first change."
src="images/diff-first.gif" class="diff-icon"></a><a
class="diffpage-html-a" onclick="scrollToEvent(event)"
href="#changed-diff-0">&nbsp;first</a></td><td style="text-align: center;
font-size: 140%;"><a href="http://code.google.com/p/daisydiff/"
class="diffpage-html-a" style="font-size: 100%;">Daisy Diff</a> compare
report.<br>
<span style="font-style: italic; font-size: 70%;">Click on the changed
parts for a detailed description. Use the left and right arrow keys to walk
through the modifications.</span></td><td style="text-align: right;"><a
class="diffpage-html-a" onclick="scrollToEvent(event)"
href="#removed-diff-1">
last&nbsp;</a><a class="diffpage-html-a"
onclick="scrollToEvent(event)" id="last-diff" href="#removed-diff-1"
previous="removed-diff-1"><img title="Go to last change."
src="images/diff-last.gif" class="diff-icon"></a></td>
</tr>
</table>
</div>
<span class="diff-html-changed" id="changed-diff-0" changes="Moved out of a
<b>heading (level 1)</b>." previous="first-diff" changeId="changed-diff-0"
next="removed-diff-0" onclick="return tipC(constructToolTipC(this));">This
is </span><span class="diff-html-removed" id="removed-diff-0"
previous="changed-diff-0" changeId="removed-diff-0" next="added-diff-0"
onclick="return tipR(constructToolTipR(this));">h1 </span><span
class="diff-html-added" id="added-diff-0" previous="removed-diff-0"
changeId="added-diff-0" next="changed-diff-1" onclick="return
tipA(constructToolTipA(this));">normal </span><span
class="diff-html-changed" id="changed-diff-1" changes="Moved out of a
<b>heading (level 1)</b>." previous="added-diff-0"
changeId="changed-diff-1" next="removed-diff-1" onclick="return
tipC(constructToolTipC(this));">heading</span><span
class="diff-html-removed" id="removed-diff-1" previous="changed-diff-1"
changeId="removed-diff-1" next="last-diff" onclick="return
tipR(constructToolTipR(this));"></span>
</body>
</html>

codesite...@google.com

unread,
Aug 12, 2013, 9:51:16 AM8/12/13
to dais...@googlegroups.com

Comment #3 on issue 55 by jignesh....@gmail.com: error on line 6 at column
8: Opening and ending tag mismatch: link line 0 and head
http://code.google.com/p/daisydiff/issues/detail?id=55

This is what I get when I try to run the same in Firefox.

Please find attached image file.

Attachments:
daisydiff2.png 9.5 KB

codesite...@google.com

unread,
Aug 12, 2013, 9:56:58 AM8/12/13
to dais...@googlegroups.com

Comment #4 on issue 55 by jignesh....@gmail.com: error on line 6 at column
8: Opening and ending tag mismatch: link line 0 and head
http://code.google.com/p/daisydiff/issues/detail?id=55

This is what I get when I try to do the same in firefox.
File attache.

Attachments:
daisydiff2.png 11.1 KB

codesite...@google.com

unread,
Aug 12, 2013, 1:22:20 PM8/12/13
to dais...@googlegroups.com

Comment #6 on issue 55 by kkape...@gmail.com: error on line 6 at column 8:
Opening and ending tag mismatch: link line 0 and head
http://code.google.com/p/daisydiff/issues/detail?id=55

The link line is created in file htmlheader.xsl

There however it IS correctly closed.

<head>
<xsl:apply-templates select="diffreport/css/node()"/>
<link href="css/diff.css" type="text/css" rel="stylesheet"/>
</head>

So perhaps this is not the whole problem...

codesite...@google.com

unread,
Aug 12, 2013, 2:36:11 PM8/12/13
to dais...@googlegroups.com

Comment #7 on issue 55 by jignesh....@gmail.com: error on line 6 at column
8: Opening and ending tag mismatch: link line 0 and head
http://code.google.com/p/daisydiff/issues/detail?id=55

Thanks for your reply.
It should come the way you have mentioned.
i.e.
<link href="css/diff.css" type="text/css" rel="stylesheet"/>

but what I get is
<link rel="stylesheet" type="text/css" href="css/diff.css">
there is no closing />
it only has >
and I guess because of that I am getting no end tag error.
Ok. I will look into what I have in htmlheader.xsl and will update the
status.

codesite...@google.com

unread,
Aug 13, 2013, 4:39:08 AM8/13/13
to dais...@googlegroups.com

Comment #8 on issue 55 by jignesh....@gmail.com: error on line 6 at column
8: Opening and ending tag mismatch: link line 0 and head
http://code.google.com/p/daisydiff/issues/detail?id=55

Hi, I got it working in my case. but you might want to read whole comment.
there is still issue with link tag.

how it is fixed: I thought my servletoutstream may be looking for content
type application/xml so I set outputstream content type to text/html.
in HTML it's not compulsary to have end tag like </link> or />. but in XML
it is. because of that reason I was getting this error. so I changed my
content type to text/html and it worked.
response.setContentType("text/html; charset=utf-8");

However, I would like to specify that: despite I have <link
href="css/diff.css" type="text/css" rel="stylesheet"/> with end tag in file
htmlheader.xsl in daisydiff jar file, I always get output without end tag.
I have tried by all means: 1> hosted my two html files and then tried to
generate difference by executing jar file from command prompt.
2> run a standalone program to generate HTML difference
3> uploaded daisydiff jar file in my maven repo. and used jar file in web
application and generated output in in servletoutputstream but still I get
link without end tag.

It's ok if someone is expecting html as output but if it's xml then it will
throw the same error that I was getting.
You might want to check that.
By the way Thanks a lot for fantastic daisydiff project. It helps a lot to
developers like us. Much Appreciated.
Reply all
Reply to author
Forward
0 new messages