Closed Bug 302869 Opened 19 years ago Closed 19 years ago

E4X in SpiderMonkey won't parse XML prolog

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 290525

People

(Reporter: egnor, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.9) Gecko/20050711 Firefox/1.0.5
Build Identifier: 

The XML processing instruction

  <?xml version="1.0"?>

and DOCTYPE declaration

  <!DOCTYPE ...>

both create parse errors when processed by E4X, e.g. with the new XML(string)
constructor.  In fact, the XML PI is specifically checked for and rejected by
the code.  This is super irritating, because it means that many totally
well-formed XML documents can't be parsed.

Unfortunately, I can't find any reference to the XML PI or DOCTYPE declarations
in ECMA-357, so I have no idea what the right treatment is.  Am I supposed to be
stripping these myself before feeding XML documents to E4X?  If so, I recommend
some documentation updates.

If the right behavior can be identified, I'm happy to make the change myself and
submit a patch for review.

Reproducible: Always

Steps to Reproduce:
1. Create an XML document with an XML PI and/or DOCTYPE declaration.
2. Use that document as the argument of a "new XML(...)" statement in an
E4X-enabled SpiderMonkey interpreter, e.g. "js -x".

Actual Results:  
Parse error.

Expected Results:  
Parse the document properly, as an XML processor is supposed to.  Ignoring the
XML PI and/or DOCTYPE entirely would be fine by me.
See bug 277683 comment 8 et seq.

/be
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---

*** This bug has been marked as a duplicate of 290525 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago19 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.