[plt-scheme] comments in xexpr - how to preserve?
The x-expressions of the xml library support user-created documents
including comments: just use (make-comment <string>). For example:
---
> (define xpr `(hello () (world ,(make-comment "this is a comment"))))
> (write-xml/content (xexpr->xml xpr))
<hello><world><!--this is a comment--></world></hello>
---
-jacob
On Wed, 6 Aug 2003, Benjamin Simon wrote:
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> Howdy,
>
> I'm currently trying to combine HtmlPrag [1] with PLT Scheme servlets.
> This means that I need to convert the sxml output of HtmlPrag to an
> xexpr format that will produce meaningful output for the Scheme servlet.
>
> I've been working an sxml->xexpr function, and for the most part it
> hasn't been bad to write.
>
> However, as far as I can tell, xexpr ignores XML comments, while sxml
> allows you to represent them as (*comment* ...). Usually it wouldn't be
> a big deal to strip out comments, however, I'm parsing HTML that follows
> the practice of doing:
>
> <script ...>
> <!--
> ...javascript code...
> // -->
> </script>
>
> So, if I strip out comments, as xexpr seems to require, I lose all the
> javascript on the page. Ugh.
>
> Any suggestions on how to deal with this? Is there any thoughts about
> how xexpr may support comments?
>
> I guess a broader question may be, how can I take advantage of tools
> that deal with sxml, while inside of PLT scheme, which prefers to work
> with xexpr. Any tips for this?
>
> Thanks,
> Ben
>
> [1] http://www.neilvandyke.org/htmlprag/
>
> --
> Ben Simon Amazing Media, Inc.
> (703) 234-5342 (work) (703) 937-7779 (cell)
>
>