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 17597 - "StartTag: invalid element name" for XHTML 1.0
Summary: "StartTag: invalid element name" for XHTML 1.0
Status: RESOLVED INVALID
Alias: None
Product: Validator
Classification: Unclassified
Component: check (show other bugs)
Version: HEAD
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: qa-dev tracking
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-26 11:45 UTC by Rolf Walter
Modified: 2012-06-26 19:33 UTC (History)
0 users

See Also:


Attachments

Description Rolf Walter 2012-06-26 11:45:14 UTC
For XHTML 1.0 (but not for HTML 4.01):
We get the warning:
"character "<" is the first character of a delimiter but occurred as data"
and the error:
"StartTag: invalid element name"
for the following:
.........
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>TEST</title>
<script type="text/javascript">
function test(){
for (i=0; i < length; i++){
} 
}
</script>
</head><body></body>
</html>
.........
However, with "<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>" the code is passed.

Regards,
Rolf Walter
Comment 1 Ville Skyttä 2012-06-26 16:56:56 UTC
I don't see a bug here; XHTML gets validated by XML rules which are stricter/different than SGML rules which are used for HTML.
Comment 2 Rolf Walter 2012-06-26 18:09:31 UTC
(In reply to comment #1)
> I don't see a bug here; XHTML gets validated by XML rules which are
> stricter/different than SGML rules which are used for HTML.

Pasting the lines between the "........" into http://validator.w3.org/#validate_by_input yields the error mentioned. The error points to code within the script tag, which is, in this case, corect JS.

Besides, normally, the validator does not react on erroneous JS code within a script tag.

/Rolf
Comment 3 Ville Skyttä 2012-06-26 19:16:20 UTC
Sure it does, as it should. That's not a bug in the validator, that's an issue in the document which the validator correctly flags, and it even says in the explanation below the error message:

| You tried to include the "<" character in your page:
| you should escape it as "&lt;"

Even if your JS is "correct", it is incorrectly embedded in the XHTML doc.
More info:

http://www.w3.org/TR/xhtml1/#h-4.8
http://www.w3.org/TR/xhtml1/#C_4
Comment 4 Rolf Walter 2012-06-26 19:33:21 UTC
(In reply to comment #3)
Thanks a lot, I didn't realize this.