<div>What do you think of changing the behavior so that the cdata-string contains data without the cdata section wrapper? </div><div><br></div><div>It looks like the two main code are as follows:</div><div><font class="Apple-style-span" face="'courier new', monospace"><br>
</font></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><font class="Apple-style-span" face="'courier new', monospace">;; /collects/xml/private/reader.rkt </font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><div><font class="Apple-style-span" face="'courier new', monospace">(define (lex-tag-cdata-pi-comment in pos)</font></div>
</div><div><div><font class="Apple-style-span" face="'courier new', monospace"> ... </font></div></div><div><div><font class="Apple-style-span" face="'courier new', monospace"> [(#\[) (read-char in)</font></div>
</div><div><div><font class="Apple-style-span" face="'courier new', monospace"> (unless (string=? (read-string 6 in) "CDATA[")</font></div></div><div><div><font class="Apple-style-span" face="'courier new', monospace"> (lex-error in pos "expected CDATA following <["))</font></div>
</div><div><div><font class="Apple-style-span" face="'courier new', monospace"> (let ([data (lex-cdata-contents in pos)])</font></div></div><div><div><font class="Apple-style-span" face="'courier new', monospace"> (make-cdata start (pos) <b>(format "<![CDATA[~a]]>" data)</b>))]</font></div>
</div><div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div></div><div><font class="Apple-style-span" face="'courier new', monospace">;; /collects/xml/private/writer.rkt </font></div>
<div><div><font class="Apple-style-span" face="'courier new', monospace">;; write-xml-cdata : Cdata Nat (Nat Output-Stream -> Void) Output-Stream -> Void</font></div></div><div><div><font class="Apple-style-span" face="'courier new', monospace">(define (write-xml-cdata cdata over dent out)</font></div>
</div><div><div><font class="Apple-style-span" face="'courier new', monospace"> ;; XXX: Different kind of quote is needed, for assume the user includes the <![CDATA[...]]> with proper quoting</font></div></div>
<div><div><font class="Apple-style-span" face="'courier new', monospace"> (write-xml-base<b> (format "~a" (cdata-string cdata)) </b>over dent out))</font></div></div></blockquote><div><br></div><div>So the reader already parse out the cdata without the wrapper, but add it back it for whatever reason. Perhaps switching the two? </div>
<div><br></div><div>Grepping through the collects dir and the following uses make-cdata besides xml/private/reader.rkt: </div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div><div>/Applications/plt-5.0/collects/scribble/html-render.rkt: </div></div></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div><div><font class="Apple-style-span" face="'courier new', monospace">(lambda strings (xml:make-cdata loc loc (string-append* strings)))))</font></div></div></blockquote></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div><div>/Applications/plt-5.0/collects/web-server/default-web-root/htdocs/servlets/examples/template-xexpr.rkt: </div></div></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div><font class="Apple-style-span" face="'courier new', monospace">,(make-cdata #f #f (include-template "static.html"))))</font></div>
</div></blockquote></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div>/Applications/plt-5.0/collects/web-server/private/xexpr.rkt: </div>
</div></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div><div><font class="Apple-style-span" face="'courier new', monospace">,(make-cdata #f #f (format-xexpr/errors val))))))])</font></div></div></blockquote></blockquote><div><div><br></div></div><div>and these do not look like they provide their own <![CDATA[...]]> as instructed in the cdata documentation. </div>
<div><br></div><div>Thoughts? Thanks, </div><div>yc</div><div><br></div><div class="gmail_quote">On Tue, Nov 9, 2010 at 9:06 PM, Jay McCarthy <span dir="ltr"><<a href="mailto:jay.mccarthy@gmail.com" target="_blank">jay.mccarthy@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
It is documented that way:<br>
<br>
<a href="http://docs.racket-lang.org/xml/index.html#(def._((lib._xml/main..rkt)._cdata))" target="_blank">http://docs.racket-lang.org/xml/index.html#(def._((lib._xml/main..rkt)._cdata))</a><br>
<br>
I'm not sure why it was originally written that way.<br>
<br></blockquote></div>