This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
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>
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