Closed Bug 290525 Opened 20 years ago Closed 20 years ago

e4x - 8.3 XML Initialiser Input Elements XMLPI

Categories

(Core :: JavaScript Engine, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: bc, Unassigned)

References

Details

You can define a XMLPI using a literal but not as an argument to new XML()

js> xml = <?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>

js> xml = new XML('<?xml version="1.0" encoding="UTF-8"?>')
1: SyntaxError: xml is a reserved identifier:
1: <parent xmlns=''><?xml version="1.0" encoding="UTF-8"?></parent>
1: .................^

You can define an xml-stylesheet PI by itself, but not if you try to define the
XMLPI and xml-stylesheet PI together.

js> xml = <?xml-stylesheet type="text/xsl" href="xslt.xsl" ?>
<?xml-stylesheet type="text/xsl" href="xslt.xsl" ?>

js> xml = <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl"
href="xslt.xsl" ?>
typein:24: SyntaxError: syntax error:
typein:24: xml = <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet
type="text/xsl" href="xslt.xsl" ?>
typein:24: .............................................^
This is invalid.  The ECMA-357 spec explicitly defines the XML constructor in
terms of wrapping string (and other types converted to string) inputs in a
<parent xmlns="...">...</parent> tag, and you cannot nest the <?xml...?>
pseudo-PI XML declaration -- doing so is malformed XML.

Other PIs of course can go at any level or after the prolog.

See http://www.w3.org/TR/REC-xml/#sec-prolog-dtd.

/be
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
*** Bug 302869 has been marked as a duplicate of this bug. ***
*** Bug 308701 has been marked as a duplicate of this bug. ***
Still, can we break from the spec here? I mean, this makes e4x hard to use to interoperate with other XML applications. For example, any web service.
(In reply to comment #4)
> Still, can we break from the spec here? I mean, this makes e4x hard to use to
> interoperate with other XML applications. For example, any web service.

Sure, we can prefigure the spec fix with a code fix, but it'll be a stretch arguing for this in 1.8.0.1 (Firefox 1.5.0.1).  Firefox 2, no problemo, but at that point (Q3 2007) how many users will have been burned by E4X as specified?

Anyway, please file a new bug citing this one, and I'll run it up the pole.  i'd like to keep this bug as a DUP magnet per the existing spec.

/be
Blocks: 321564
(In reply to comment #5)
> Firefox 2, no problemo, but at
> that point (Q3 2007) how many users will have been burned by E4X as specified?

Brendan means "Q3 2006", I'm pretty sure.
(In reply to comment #6)
> (In reply to comment #5)
> > Firefox 2, no problemo, but at
> > that point (Q3 2007) how many users will have been burned by E4X as specified?
> 
> Brendan means "Q3 2006", I'm pretty sure.

Of course (http://wiki.mozilla.org/Global:1.9_Trunk_1.8_Branch_Plan).

Darn laptop keyboard -- my weakness typing numbers blindly afflicts bug citations in checkin comments, too.

/be
You need to log in before you can comment on or make changes to this bug.