This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 2406 - when link tag is ended with / in header validator parses off by one
Summary: when link tag is ended with / in header validator parses off by one
Status: RESOLVED INVALID
Alias: None
Product: Validator
Classification: Unclassified
Component: Parser (show other bugs)
Version: 0.7.0
Hardware: PC Linux
: P2 minor
Target Milestone: ---
Assignee: Terje Bless
QA Contact: qa-dev tracking
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-21 15:18 UTC by arl (Ari Lemmke)
Modified: 2007-02-28 03:07 UTC (History)
0 users

See Also:


Attachments

Description arl (Ari Lemmke) 2005-10-21 15:18:05 UTC
-	tested with https page
-	noticed validator parses off by one (validator thinks attributes
	are "loose" content.

original page:
	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
	<html>
	<head>
	<meta name="robots" content="noindex,nofollow">	
	<link rel="stylesheet" type="text/css" href="../themes/css/XP_BlueSky.css" />
	...
	</head>
	<title>FOO</title>

output:
	1.Error Line 7 column 76: character data is not allowed here.

parse three:
<HTML>
  <HEAD>
      ANAME TOKEN ROBOTS
      ACONTENT CDATA noindex,nofollow
    <META>
    </META>
      AHREF CDATA ../themes/css/XP_BlueSky.css
      ATYPE CDATA text/css
      AREL CDATA stylesheet
    <LINK>
    </LINK>
     > 
    <TITLE>
       FOO
    </TITLE>

	...

Validator version: 0.7.1 (missing within Bugzilla...)
Comment 1 Bj 2005-10-21 15:22:29 UTC
The /> syntax is not allowed in HTML documents, use it only for XHTML 
documents. Please have a look at the www-validator mailing list archives for 
further details, good keywords are e.g. SHORTTAG and "empty element". 
http://www.cs.tut.fi/~jkorpela/html/empty.html might also help.
Comment 2 arl (Ari Lemmke) 2005-10-21 15:32:52 UTC
The whole error message:

----

Below are the results of attempting to parse this document with an SGML parser. 

1.Error Line 7 column 76: character data is not allowed here.

       ...ss" href="../themes/css/XP_BlueSky.css" />

       You have used character data somewhere it is not permitted to appear.
Mistakes that can cause this error include putting text directly in the
       body of the document without wrapping it in a container element (such as
a <p>aragraph</p>) or forgetting to quote an attribute value
       (where characters such as "%" and "/" are common, but cannot appear
without surrounding quotes). 
Comment 3 Christopher Johnson 2007-02-27 22:12:41 UTC
This sounds like the problem I have.  I am using the Link tag for a CSS stylesheet and am trying to be both HTML 4.01 Strict and XHTML 1.0 Strict compliant.  The Link tag reads as follows in my document:

<link rel="stylesheet" type="text/css" href="../mysitestyle.css"/>

This is XHTML 1.0 Strict compliant (and validates properly).  However, when validating for HTML 4.01 Strict (as is what the page is presently designed to use), it returns the error described by "arl (Ari Lemmke)".

It is obvious to me that this is a Header field parsing error, as the Link tag is the only tag within my documents' Headers that use the "/>" to end the tag, while I use "<br/>" throughout my documents and none of those tags result in an error.
Comment 4 Olivier Thereaux 2007-02-28 03:07:44 UTC
(In reply to comment #3)
> This sounds like the problem I have.  I am using the Link tag for a CSS
> stylesheet and am trying to be both HTML 4.01 Strict and XHTML 1.0 Strict
> compliant. 

You can't do that. It's like saying you want to say a sentence that will make sense in both Italian and Spanish. That may be possible, but in most cases, it won't.

> <link rel="stylesheet" type="text/css" href="../mysitestyle.css"/>

 /> is a tag ending specific to XML (and thus XHTML), but in HTML 4.01, it means something totally different: it means end of tag followed by the angle bracket. That's invalid in <head>, where character data (outside of tags) is not allowed.

> This is XHTML 1.0 Strict compliant (and validates properly).

Yes.

  However, when
> validating for HTML 4.01 Strict (as is what the page is presently designed to
> use), it returns the error described by "arl (Ari Lemmke)".

Yes, and that's correct. 

You have to choose one document type and stick to it.