diff options
author | Som Snytt <som.snytt@gmail.com> | 2014-12-20 02:28:44 -0800 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2015-04-08 09:20:24 -0700 |
commit | 4df81aab315e587d9c7e319c7a2ece0f0f6fbaf3 (patch) | |
tree | d83454b666d54549d88f52bd800cddb66bd46041 /test/files/pos/t3368.scala | |
parent | 476eef82dfed90278de45739ca72819b1b4be5a4 (diff) | |
download | scala-4df81aab315e587d9c7e319c7a2ece0f0f6fbaf3.tar.gz scala-4df81aab315e587d9c7e319c7a2ece0f0f6fbaf3.tar.bz2 scala-4df81aab315e587d9c7e319c7a2ece0f0f6fbaf3.zip |
SI-3368 CDATA gets a Node
XML Parser uses `scala.xml.PCData`.
A compiler flag `-Yxml:coalescing`, analogous to
`DocumentBuilderFactory.setCoalescing`, turns `PCData`
nodes into `Text` nodes and coalesces sibling text nodes.
This change also fixes parse errors such as rejecting a
sequence of CDATA sections.
A sequence of "top level" nodes are not coalesced.
```
scala> <a><b/>start<![CDATA[hi & bye]]><c/>world<d/>stuff<![CDATA[red & black]]></a>
res0: scala.xml.Elem = <a><b/>start<![CDATA[hi & bye]]><c/>world<d/>stuff<![CDATA[red & black]]></a>
scala> :replay -Yxml:coalescing
Replaying: <a><b/>start<![CDATA[hi & bye]]><c/>world<d/>stuff<![CDATA[red & black]]></a>
res0: scala.xml.Elem = <a><b/>starthi & bye<c/>world<d/>stuffred & black</a>
```
Diffstat (limited to 'test/files/pos/t3368.scala')
-rw-r--r-- | test/files/pos/t3368.scala | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/files/pos/t3368.scala b/test/files/pos/t3368.scala new file mode 100644 index 0000000000..c8e861a899 --- /dev/null +++ b/test/files/pos/t3368.scala @@ -0,0 +1,5 @@ + +trait X { + // error: in XML literal: name expected, but char '!' cannot start a name + def x = <![CDATA[hi & bye]]> <![CDATA[red & black]]> +} |