[scala-bts] #3368: Minimize escaping in CDATA sections

--------------------------------------+-------------------------------------
Reporter: acruise | Owner: scala-xml_team
Type: defect | Status: new
Priority: normal | Component: XML support
Keywords: xml cdata escape escaping |
--------------------------------------+-------------------------------------
Sort of defeats part of the purpose of using a CDATA...

{{{
scala>
res0: scala.xml.Elem = This & That
}}}

Re: [scala-bts] #3368: Preserve CDATA sections, don't convert th

--------------------------------------+-------------------------------------
Reporter: acruise | Owner: scala-xml_team
Type: defect | Status: new
Priority: normal | Component: XML support
Keywords: xml cdata escape escaping |
--------------------------------------+-------------------------------------

Comment(by acruise):

Good suggestion on the title, thanks.

Re: [scala-bts] #3368: Minimize escaping in CDATA sections

--------------------------------------+------------------------------------- Reporter: acruise | Owner: scala-xml_team Type: defect | Status: new Priority: normal | Component: XML support Keywords: xml cdata escape escaping | --------------------------------------+------------------------------------- Comment(by dimgel): The task is incorrectly formulated IMHO. I consulted with XML pros and here's the situation. 1. XML 1.0 [http://www.w3.org/TR/REC-xml/#sec-cdata-sect] says: "Within a CDATA section, only the CDEnd string is recognized as markup, so that left angle brackets and ampersands may occur in their literal form; they need not (and cannot) be escaped using "<" and "&". CDATA sections cannot nest." 2. DOM Level 3 Core [http://www.w3.org/TR/2004/REC-DOM- Level-3-Core-20040407/core.html#DOMConfiguration] defines DOMConfiguration parameter "cdata-sections" which determines whether CDATA must be converted to text nodes on serialization or not. There's also an entry in DOM FAQ for how this conversion must be done: [http://www.w3.org/DOM/faq.html#CDTA-text] Currently Scala converts CDATA nodes to Text nodes (cdata-sections=false). The behaviour I (and David Pollak for 3 years ;) advocate for is to see CDATA sections serialized unchanged (cdata-sections=true), because: 1. CDATA sections are necessary to embed Javascript code into XHTML pages; 2. One already can define text nodes in XML literals; 3. Generally, Scala should check XML literal wellformedness, but '''NOT''' perform any conversions. Same problem is tracked by ticket #1118 (
vs
). Latest comments there show that guys came to preserving element emptiness mode as specified in XML literal, and that's great. So I suggest ticket should be renamed to "Preserve CDATA sections".

Copyright © 2013 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland