Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contradiction in Language Spec w.r.t. XML Processing Instructions #5109

Closed
scabug opened this issue Oct 24, 2011 · 6 comments
Closed

Contradiction in Language Spec w.r.t. XML Processing Instructions #5109

scabug opened this issue Oct 24, 2011 · 6 comments

Comments

@scabug
Copy link

scabug commented Oct 24, 2011

The Scala Language Specification v. 2.9, in section 10.1, 3rd paragraph (towards the end of page 131) reads:

"[...] Scala does not support [...], CDATA sections or processing instructions. [...]"

But the syntax section following this paragraph contains a production XMLContent using non-terminals "CDSect" and "PI", which refer to CDATA sections and processing instructions respectively.

Indeed, both CDATA and Processing Instructions are supported by the 2.9 versions of the language:

Welcome to Scala version 2.9.0.1 (Java HotSpot(TM) Server VM, Java 1.6.0_24).
Type in expressions to have them evaluated.
Type :help for more information.

scala> <?hi world?><t><![CDATA[text]]></t>
res0: scala.xml.NodeBuffer = ArrayBuffer(<?hi world?>, <t>text</t>)
@scabug
Copy link
Author

scabug commented Oct 24, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5109?orig=1
Reporter: @jsalvata
Affected Versions: 2.9.0, 2.9.0-1, 2.9.1
See #3368

@scabug
Copy link
Author

scabug commented Nov 2, 2011

@jsalvata said (edited on Nov 2, 2011 11:52:56 PM UTC):
Also note that non-terminals "PI" and "CDSect" are not defined anywhere. They should be added to the production declaring elements to be "as in W3C XML".

@scabug
Copy link
Author

scabug commented Apr 14, 2015

@som-snytt said:
Support as in child support.

@ashawley
Copy link
Member

ashawley commented Feb 6, 2018

Agree, CDATA and PI are accepted by the compiler:

scala> <![CDATA[text]]>
res0: scala.xml.PCData = <![CDATA[text]]>

scala> <?x y?>
res1: scala.xml.ProcInstr = <?x y?>

Declarations are not, though:

scala> <!DOCTYPE html>
<console>:1: error: in XML literal: '-' expected instead of 'D'
       <!DOCTYPE html>
         ^

@som-snytt
Copy link

My comment from 2015 was from when I fixed the related issue #3368 for CDATA support; I think it was supposed to remind me to update the spec, but I forgot. Or possibly, I felt I couldn't top "child support."

@ashawley
Copy link
Member

ashawley commented Feb 7, 2018

I read your comment twice, earlier, but didn't catch the humor until now. The joke holds up, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants