You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Jonathan Melhuish <j....@signal.qinetiq.com> on 2004/06/18 17:58:34 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

Re: Bizarre parse error

Posted by Jonathan Melhuish <j....@signal.qinetiq.com>.
Jeff Greif wrote:

>Re: IE's error:  This is coming from the DTD, not from your source.  IE is
>objecting to the SGML comment
>  -- media type, as per [RFC2045] --
>appearing within a DTD directive (it's right there in the dtd file mentioned
>in the error message), and repeats in similar fashion on many of the
>following lines.
>
That's what I figured, but presumably it's not a mistake in the W3Cs DTD?!

>  IE might do this if it thought it should be using an XML
>parser instead of an SGML parser for the DTD.  Perhaps it might do this if
>the media type produced by Xalan were text/xhtml instead of text/html or
>something.
>
If it were, but it isn't.  Here's the first part of the resulting HTML:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
		"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">

What I have just noticed, though, which may be of significance, is that the source of the saved page is in XHTML rather than HTML4.  Viewing the source of the "live" JSP page shows HTML4 (even though the original XSLT stylesheet is written in XHTML).  Is Mozilla converting it when I save it?  Whatever's happening, I'm royally confused :-(

Thanks for your help!

Cheers,

Jon

>
>----- Original Message ----- 
>From: "Jonathan Melhuish" <j....@signal.qinetiq.com>
>To: <to...@jakarta.apache.org>; <xa...@xml.apache.org>
>Sent: Friday, June 18, 2004 8:58 AM
>Subject: 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
>>
>>    
>>
>
>
>
>
>  
>


Re: Bizarre parse error

Posted by Jeff Greif <jg...@alumni.princeton.edu>.
Re: IE's error:  This is coming from the DTD, not from your source.  IE is
objecting to the SGML comment
  -- media type, as per [RFC2045] --
appearing within a DTD directive (it's right there in the dtd file mentioned
in the error message), and repeats in similar fashion on many of the
following lines  IE might do this if it thought it should be using an XML
parser instead of an SGML parser for the DTD.  Perhaps it might do this if
the media type produced by Xalan were text/xhtml instead of text/html or
something.

Jeff

----- Original Message ----- 
From: "Jonathan Melhuish" <j....@signal.qinetiq.com>
To: <to...@jakarta.apache.org>; <xa...@xml.apache.org>
Sent: Friday, June 18, 2004 8:58 AM
Subject: 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
>



Re: Bizarre parse error

Posted by Joseph Kesselman <ke...@us.ibm.com>.



If the -- occurs in a comment, this is a valid error; that pair of
characters is illegal in comments.
If it appears outside a comment, IE is probably in error.

Without seeing the document, I can't comment beyond that.
Since IE is complaining, ask Microsoft what it's complaining about?

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk