You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jonathan Melhuish <j....@signal.qinetiq.com> on 2004/06/18 18:25:10 UTC

Bizarre parse error

I've got a rather bizarre problem which I can't quite get my head
around, and was wondering if anybody might be able to help.

I'm using Xalan to transform XML into HTML4 using an XSLT stylesheet.
The page appears to be generated correctly, from looking at the source
code.  However, upon loading, Internet Explorer (5 and 6) gives the error:

        The character '>' was expected. Error processing resource
'http://www.w3.org/TR/html4/strict.dtd'. Line 81, Position 5
            -- media type, as per [RFC2045]
        ----^

The line number referenced is not related to the source code of my
page.  Mozilla, meanwhile gives the error "XML Parsing Error: mismatched
tag. Expected: </link>" which would imply that it is trying to parse it
as XHTML.  Changing the DOCTYPE declaration from Strict to Transitional
changes the line number in IE but not the error given by Mozilla.
Removing the DOCTYPE definition completely brings IE's error in line
with Mozilla's.

However, all of this would perhaps seem rather irrelevant, as I found
that saving the file to disk and re-opening it causes it to be displayed
correctly in both browsers.  Similarly, saving the resultant HTML and
serving it through Tomcat also works, regardless of whether the filename
extension is .html or .jsp.  My only suggestion was that perhaps it was
something to do with the MIME type, but presumably Tomcat would decide
that based on the filename extension if my JSP pages were not to contain
the line:

<%@ page language="java" contentType="text/html" %>

This presumption is supported by the fact that removing this line makes
no difference to either error.

Which leaves me completely out of ideas... help!

TIA,

Jon



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Bizarre parse error

Posted by Jonathan Melhuish <j....@signal.qinetiq.com>.
Sorry for wasting your time, I eventually tracked this down to a 
'response.setContentType("text/xml");' which was hidden inside the code 
that generated the XML content!  It took me far too long, really...

Cheers,

Jon

Jonathan Melhuish wrote:

> In the absence of any more logical suggestions, I've been randomly 
> fiddling and have found that:
>
>    * I only get the error when I successfully retreive XML from the 
> database and pass it to Xalan, it works or fails elegantly in all 
> other cases
>    * The XML data is returned correctly and is valid, because I can 
> output it, save it and parse it using Mozilla
>    * The simple XSL stylesheet that I have created (which just matches 
> the document root) is valid because I am using it successfully on 
> another very similar page that returns a smaller subset of the XML data
>    * If I copy and paste the outputted XML from the saved file into my 
> JSP page and assign it to a string, it works
>
> So, in summary:
>
>    * The bit that gets the XML from the database appears to work 
> correctly
>    * The bit that processes the XML (Xalan) appears to work correctly 
> when the above XML is hard-coded into a string
>    * It doesn't work when I try to pass the XML directly from one to 
> the other
>
> Any ideas?!
>
> Cheers,
>
> Jon
>
> Jonathan Melhuish wrote:
>
>> I've got a rather bizarre problem which I can't quite get my head
>> around, and was wondering if anybody might be able to help.
>>
>> I'm using Xalan to transform XML into HTML4 using an XSLT stylesheet.
>> The page appears to be generated correctly, from looking at the source
>> code.  However, upon loading, Internet Explorer (5 and 6) gives the 
>> error:
>>
>>        The character '>' was expected. Error processing resource
>> 'http://www.w3.org/TR/html4/strict.dtd'. Line 81, Position 5
>>            -- media type, as per [RFC2045]
>>        ----^
>>
>> The line number referenced is not related to the source code of my
>> page.  Mozilla, meanwhile gives the error "XML Parsing Error: mismatched
>> tag. Expected: </link>" which would imply that it is trying to parse it
>> as XHTML.  Changing the DOCTYPE declaration from Strict to Transitional
>> changes the line number in IE but not the error given by Mozilla.
>> Removing the DOCTYPE definition completely brings IE's error in line
>> with Mozilla's.
>>
>> However, all of this would perhaps seem rather irrelevant, as I found
>> that saving the file to disk and re-opening it causes it to be displayed
>> correctly in both browsers.  Similarly, saving the resultant HTML and
>> serving it through Tomcat also works, regardless of whether the filename
>> extension is .html or .jsp.  My only suggestion was that perhaps it was
>> something to do with the MIME type, but presumably Tomcat would decide
>> that based on the filename extension if my JSP pages were not to contain
>> the line:
>>
>> <%@ page language="java" contentType="text/html" %>
>>
>> This presumption is supported by the fact that removing this line makes
>> no difference to either error.
>>
>> Which leaves me completely out of ideas... help!
>>
>> TIA,
>>
>> Jon
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>


Re: Bizarre parse error

Posted by Jonathan Melhuish <j....@signal.qinetiq.com>.
Sorry for wasting your time, I eventually tracked this down to a 
'response.setContentType("text/xml");' which was hidden inside the code 
that generated the XML content!  It took me far too long, really...

Cheers,

Jon

Jonathan Melhuish wrote:

> In the absence of any more logical suggestions, I've been randomly 
> fiddling and have found that:
>
>    * I only get the error when I successfully retreive XML from the 
> database and pass it to Xalan, it works or fails elegantly in all 
> other cases
>    * The XML data is returned correctly and is valid, because I can 
> output it, save it and parse it using Mozilla
>    * The simple XSL stylesheet that I have created (which just matches 
> the document root) is valid because I am using it successfully on 
> another very similar page that returns a smaller subset of the XML data
>    * If I copy and paste the outputted XML from the saved file into my 
> JSP page and assign it to a string, it works
>
> So, in summary:
>
>    * The bit that gets the XML from the database appears to work 
> correctly
>    * The bit that processes the XML (Xalan) appears to work correctly 
> when the above XML is hard-coded into a string
>    * It doesn't work when I try to pass the XML directly from one to 
> the other
>
> Any ideas?!
>
> Cheers,
>
> Jon
>
> Jonathan Melhuish wrote:
>
>> I've got a rather bizarre problem which I can't quite get my head
>> around, and was wondering if anybody might be able to help.
>>
>> I'm using Xalan to transform XML into HTML4 using an XSLT stylesheet.
>> The page appears to be generated correctly, from looking at the source
>> code.  However, upon loading, Internet Explorer (5 and 6) gives the 
>> error:
>>
>>        The character '>' was expected. Error processing resource
>> 'http://www.w3.org/TR/html4/strict.dtd'. Line 81, Position 5
>>            -- media type, as per [RFC2045]
>>        ----^
>>
>> The line number referenced is not related to the source code of my
>> page.  Mozilla, meanwhile gives the error "XML Parsing Error: mismatched
>> tag. Expected: </link>" which would imply that it is trying to parse it
>> as XHTML.  Changing the DOCTYPE declaration from Strict to Transitional
>> changes the line number in IE but not the error given by Mozilla.
>> Removing the DOCTYPE definition completely brings IE's error in line
>> with Mozilla's.
>>
>> However, all of this would perhaps seem rather irrelevant, as I found
>> that saving the file to disk and re-opening it causes it to be displayed
>> correctly in both browsers.  Similarly, saving the resultant HTML and
>> serving it through Tomcat also works, regardless of whether the filename
>> extension is .html or .jsp.  My only suggestion was that perhaps it was
>> something to do with the MIME type, but presumably Tomcat would decide
>> that based on the filename extension if my JSP pages were not to contain
>> the line:
>>
>> <%@ page language="java" contentType="text/html" %>
>>
>> This presumption is supported by the fact that removing this line makes
>> no difference to either error.
>>
>> Which leaves me completely out of ideas... help!
>>
>> TIA,
>>
>> Jon
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Bizarre parse error

Posted by Jonathan Melhuish <j....@signal.qinetiq.com>.
In the absence of any more logical suggestions, I've been randomly 
fiddling and have found that:

    * I only get the error when I successfully retreive XML from the 
database and pass it to Xalan, it works or fails elegantly in all other 
cases
    * The XML data is returned correctly and is valid, because I can 
output it, save it and parse it using Mozilla
    * The simple XSL stylesheet that I have created (which just matches 
the document root) is valid because I am using it successfully on 
another very similar page that returns a smaller subset of the XML data
    * If I copy and paste the outputted XML from the saved file into my 
JSP page and assign it to a string, it works

So, in summary:

    * The bit that gets the XML from the database appears to work correctly
    * The bit that processes the XML (Xalan) appears to work correctly 
when the above XML is hard-coded into a string
    * It doesn't work when I try to pass the XML directly from one to 
the other

Any ideas?!

Cheers,

Jon

Jonathan Melhuish wrote:

> I've got a rather bizarre problem which I can't quite get my head
> around, and was wondering if anybody might be able to help.
>
> I'm using Xalan to transform XML into HTML4 using an XSLT stylesheet.
> The page appears to be generated correctly, from looking at the source
> code.  However, upon loading, Internet Explorer (5 and 6) gives the 
> error:
>
>        The character '>' was expected. Error processing resource
> 'http://www.w3.org/TR/html4/strict.dtd'. Line 81, Position 5
>            -- media type, as per [RFC2045]
>        ----^
>
> The line number referenced is not related to the source code of my
> page.  Mozilla, meanwhile gives the error "XML Parsing Error: mismatched
> tag. Expected: </link>" which would imply that it is trying to parse it
> as XHTML.  Changing the DOCTYPE declaration from Strict to Transitional
> changes the line number in IE but not the error given by Mozilla.
> Removing the DOCTYPE definition completely brings IE's error in line
> with Mozilla's.
>
> However, all of this would perhaps seem rather irrelevant, as I found
> that saving the file to disk and re-opening it causes it to be displayed
> correctly in both browsers.  Similarly, saving the resultant HTML and
> serving it through Tomcat also works, regardless of whether the filename
> extension is .html or .jsp.  My only suggestion was that perhaps it was
> something to do with the MIME type, but presumably Tomcat would decide
> that based on the filename extension if my JSP pages were not to contain
> the line:
>
> <%@ page language="java" contentType="text/html" %>
>
> This presumption is supported by the fact that removing this line makes
> no difference to either error.
>
> Which leaves me completely out of ideas... help!
>
> TIA,
>
> Jon
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Bizarre parse error

Posted by Jonathan Melhuish <j....@signal.qinetiq.com>.
In the absence of any more logical suggestions, I've been randomly 
fiddling and have found that:

    * I only get the error when I successfully retreive XML from the 
database and pass it to Xalan, it works or fails elegantly in all other 
cases
    * The XML data is returned correctly and is valid, because I can 
output it, save it and parse it using Mozilla
    * The simple XSL stylesheet that I have created (which just matches 
the document root) is valid because I am using it successfully on 
another very similar page that returns a smaller subset of the XML data
    * If I copy and paste the outputted XML from the saved file into my 
JSP page and assign it to a string, it works

So, in summary:

    * The bit that gets the XML from the database appears to work correctly
    * The bit that processes the XML (Xalan) appears to work correctly 
when the above XML is hard-coded into a string
    * It doesn't work when I try to pass the XML directly from one to 
the other

Any ideas?!

Cheers,

Jon

Jonathan Melhuish wrote:

> I've got a rather bizarre problem which I can't quite get my head
> around, and was wondering if anybody might be able to help.
>
> I'm using Xalan to transform XML into HTML4 using an XSLT stylesheet.
> The page appears to be generated correctly, from looking at the source
> code.  However, upon loading, Internet Explorer (5 and 6) gives the 
> error:
>
>        The character '>' was expected. Error processing resource
> 'http://www.w3.org/TR/html4/strict.dtd'. Line 81, Position 5
>            -- media type, as per [RFC2045]
>        ----^
>
> The line number referenced is not related to the source code of my
> page.  Mozilla, meanwhile gives the error "XML Parsing Error: mismatched
> tag. Expected: </link>" which would imply that it is trying to parse it
> as XHTML.  Changing the DOCTYPE declaration from Strict to Transitional
> changes the line number in IE but not the error given by Mozilla.
> Removing the DOCTYPE definition completely brings IE's error in line
> with Mozilla's.
>
> However, all of this would perhaps seem rather irrelevant, as I found
> that saving the file to disk and re-opening it causes it to be displayed
> correctly in both browsers.  Similarly, saving the resultant HTML and
> serving it through Tomcat also works, regardless of whether the filename
> extension is .html or .jsp.  My only suggestion was that perhaps it was
> something to do with the MIME type, but presumably Tomcat would decide
> that based on the filename extension if my JSP pages were not to contain
> the line:
>
> <%@ page language="java" contentType="text/html" %>
>
> This presumption is supported by the fact that removing this line makes
> no difference to either error.
>
> Which leaves me completely out of ideas... help!
>
> TIA,
>
> Jon
>
>
>
>