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 7073 - Changing document type works incorrectly when document has internal subset
Summary: Changing document type works incorrectly when document has internal subset
Status: NEW
Alias: None
Product: Validator
Classification: Unclassified
Component: Parser (show other bugs)
Version: HEAD
Hardware: PC Windows NT
: P3 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: 2009-07-01 18:24 UTC by major
Modified: 2009-12-14 18:31 UTC (History)
0 users

See Also:


Attachments

Description major 2009-07-01 18:24:23 UTC
When I select some document type in 'More options' menu and the document already contains <!DOCTYPE>, the validator should enclose full <!DOCTYPE> into <!-- comment --> and add new <!DOCTYPE> declaration. It doesn't work fine, when I try to validate document with an internal subset:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" [
	<!ENTITY foo "bar">
]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title/>
</head>
<body>
	<p>&foo;</p>
</body>
</html>

After selecting XHTML 1.0 Strict Document type in More Options menu and checking Show source, I have expected Valid XHTML 1.0 Strict and following code displayed:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" [
	<!ENTITY foo "bar">
]> -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title/>
</head>
<body>
	<p>&foo;</p>
</body>
</html>

But I have had got 4 Errors, 2 warning(s) and following code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" [
	<!ENTITY foo "bar"> -->
]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title/>
</head>
<body>
	<p>&foo;</p>
</body>
</html>
Comment 1 Ville Skyttä 2009-12-14 18:31:09 UTC
Doctype override is currently implemented using HTML::Parser, which unfortunately has problems in scenarios such as this one.

http://search.cpan.org/dist/HTML-Parser/Parser.pm#declaration