- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Ampersands are escaped inside <![CDATA[ ... ]]> literals.
Wed, 2010-04-28, 16:42
Hello everyone.
I'd like to write javascript code inside XML literals. But I get:
scala> val x =
x: scala.xml.Elem = Hello & world
This is 2.8.0.RC1. Is that correct? I'm not sure about W3C specs but
CDATA is a most common way to escape javascript code to maintain HTML
validness:
//
Same happens when I use scala.xml.PCData. So I can use only
scala.xml.Unparsed.
Wed, 2010-04-28, 17:17
#2
Re: Ampersands are escaped inside <![CDATA[ ... ]]> literals.
On 04/28/2010 07:46 PM, David Pollak wrote:
> Yeah, this is a problem with Scala not liking CDATA. The
> discussion/debate about this goes back more than 3 years. In Lift-land,
> we implemented our own parser for XML and our own tool to emit XML
> correctly (preserving CDATA). That code is in lift-util and you're
> welcome to it. There's not much that can be done with the compiler.
Hm, then it's obviously a compiler bug. Why guys keep it unfixed? I use
scala's XML literals (not external templates) so external XML
parser/serializer is no way, unfortunately.
Wed, 2010-04-28, 17:37
#3
Re: Re: Ampersands are escaped inside <![CDATA[ ... ]]> literal
On Wed, Apr 28, 2010 at 07:54:50PM +0400, Dmitry Grigoriev wrote:
> Hm, then it's obviously a compiler bug. Why guys keep it unfixed? I
> use scala's XML literals (not external templates) so external XML
> parser/serializer is no way, unfortunately.
If it's "obviously" a compiler bug I will fix it. Is it? If it's
unfixed to this point I assume someone thinks otherwise. I find that
when I try to find out about such things, I often either get no answer
or multiple-page specification legalese about why some or other
undesirable behavior is a critical feature of xml conformance.
In other words, I'm willing to fix XML code but I'm unwilling to resolve
any ambiguities about what fix if any is the correct one.
Wed, 2010-04-28, 20:37
#4
Re: Ampersands are escaped inside <![CDATA[ ... ]]> literals.
On 04/28/2010 08:07 PM, Paul Phillips wrote:
> In other words, I'm willing to fix XML code but I'm unwilling to resolve
> any ambiguities about what fix if any is the correct one.
Since I promised to answer to you here, I afford one more message to
scala@ ML. I explained situation here:
https://lampsvn.epfl.ch/trac/scala/ticket/3368#comment:1
Sorry.
On Wed, Apr 28, 2010 at 8:41 AM, Dmitry Grigoriev <mail@dimgel.ru> wrote:
--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics