Closed Bug 287911 Opened 20 years ago Closed 20 years ago

XML initializer with single CDATA section is not recognized

Categories

(Rhino Graveyard :: E4X, defect)

1.6R1
x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 257679

People

(Reporter: martin.honnen, Assigned: igor)

Details

Attachments

(1 file)

The section 11.1.4 XML Initialiser in the E4X specification says:

"An XML initialiser is an expression describing the initialization of an XML
object, written in a form of a literal. It may specify an XML element, an XML
comment, an XML PI, or a CDATA section using ordinary XML syntax."

That suggests to me that it should possible to write an XML initializer
representing a single CDATA section for instance. And indeed the test case

var cdataText = <![CDATA[Kibology for all.<br>All for Kibology.]]>;
if (cdataText) {
  print('nodeKind: ' + cdataText.nodeKind() + '; text: "' + cdataText + '"');
}
else {
  print('cdataText === undefined: ' + (cdataText === undefined));
}

is parsed and executed flawlessly with Spidermonkey:

js> load('mozillaBugs/e4x/singleCDATASection1.js');
nodeKind: text; text: "Kibology for all.<br>All for Kibology."


With Rhino however syntax errors are reported:

Rhino 1.6 release 1 2004 11 30
js> XML.ignoreComments
true
js> load('mozillaBugs/e4x/singleCDATASection1.js');
js: "C:\Dokumente und Einstellungen\All
Users\Dokumente\javascript\mozillaBugs\e4x\singleCDATASection1.js", line 3:
syntax error
js:   print('nodeKind: ' + cdataText.nodeKind() + '; text: "' + cdataText + '"')
;
js: ............................................................................
^
js: "C:\Dokumente und Einstellungen\All
Users\Dokumente\javascript\mozillaBugs\e4x\singleCDATASection1.js", line 4:
syntax error
js: }
js: ^
js: "C:\Dokumente und Einstellungen\All
Users\Dokumente\javascript\mozillaBugs\e4x\singleCDATASection1.js", line 1:
Compilation produced 2 syntax errors.

If the Spidermonkey behaviour is correct then Rhino has a bug.

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

Attachment

General

Creator:
Created:
Updated:
Size: