This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Reported by Björn Höhrmann: http://www.bjoernsworld.de/temp/chars-before-xmldecl.html is [...] <?xml version='1.0' encoding='iso-8859-1'?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>...</title> </head> <body> <p>...</p> </body> </html> [...] That's an invalid XHTML 1.0 Strict document (note the CRLF preceding the XML declaration). Now the HTML Validator <URL:http://validator.w3.org:8001/check?uri=http%3A%2F%2Fwww. bjoernsworld.de%2Ftemp%2Fchars-before-xmldecl.html> says it's valid. That's bad. The Site Valet XML Validator finds the error <URL:http://valet.webthing.com:8000/xmltest/val.so? url=http%3A%2F%2Fwww.bjoernsworld.de%2Ftemp%2Fchars-before-xmldecl.html>
This is a known issue with OpenSP and SP. For some reason they do not detect whitespace before the XML Declaration -- or at least do not report it -- and according to Arjun Ray it's "impossible" for them to do it. I'm afraid my C++-fu is a bit too weak to figure out exactly what's going on.
If it is of any use, Mozilla seems to give a well-formed error with this. Since it is open-source, perhaps you can investigate how it detects the issue.
xx
*** Bug 14 has been marked as a duplicate of this bug. ***
*** Bug 2785 has been marked as a duplicate of this bug. ***
I just want to add that since CSS validator detects incorrect placing of "<?xml...?>" then maybe the validator for XHTML should borrow some of it's code ;).
Created attachment 438 [details] invalid whitespace before xml declaration saved from http://www.bjoernsworld.de/temp/chars-before-xmldecl.html
our using XML::LibXML in 0.8.0 (currently beta) takes care of this issue.