Closed
Bug 488337
Opened 16 years ago
Closed 8 years ago
whitespace before <?xml makes parser barf - interop issue
Categories
(Core :: XML, defect)
Core
XML
Tracking
()
RESOLVED
INVALID
People
(Reporter: zwol, Unassigned)
Details
If a document served with an XML content-type, that begins with has any whitespace at the beginning of the document, before the <?xml version="1.0">, the parser barfs: e.g. if I create a.html like this
----
<?xml version="1.0">
<html xmlns="http://www.w3.org/1999/xhtml"></html>
----
I get this:
XML Parsing Error: XML or text declaration not at start of entity
Location: file:///tmp/a.xhtml
Line Number 1, Column 2:
<?xml version="1.0"?>
-^
I recognize that the XML 'document' production does not permit anything before the leading <?; however, I think this is taking draconian error handling to the absurd extreme, and for interoperability's sake, the rule should be relaxed to discard leading white space. [Opera also objects to this construction, but IE doesn't.]
Note that to avoid this with XML generated by server-side PHP, one has to make sure that all PHP files that might be included prior to the point in the driver file that generates the XML declaration do not *end* with a newline. This is contrary to standard practice for text files; it is difficult or even impossible to do in some text editors, and version control systems also don't like it.
Comment 1•8 years ago
|
||
This is just how XML works.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•