When you make a full response [1], you give the web server a [byte] string rather than an Xexpr. A substring of this string could be a user provided string.<br><br>If you want to write your application with Xexprs and contain the user's string in it, then make a new data structure and catch the error xml->string throws, kind of like this:
<br><br>(define-struct dave-gurnell-strings (the-user-string))<br><br>(make-response/full<br> ....<br>(with-handlers ([exn:invalid-xexpr? <br> (lambda (exn)<br> (if (dave-gurnell-strings? (exn:invalid-xexpr-code exn))
<br> (dave-gurnell-strings-the-user-string (exn:invalid-xexpr-code exn))<br> (raise exn)))])<br> (xml->string the-xexpr+dgstrings))<br> .....)<br><br>Jay<br><br>1.
<a href="http://download.plt-scheme.org/doc/301/html/web-server/web-server-Z-H-12.html#node_sec_10.1.3">http://download.plt-scheme.org/doc/301/html/web-server/web-server-Z-H-12.html#node_sec_10.1.3</a><br><br><div><span class="gmail_quote">
On 3/21/06, <b class="gmail_sendername">Dave Gurnell</b> <<a href="mailto:d.j.gurnell@gmail.com">d.j.gurnell@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Dear Schemers,<br><br>I'm trying to write a simple (!!) CMS-style page editor using web-<br>server. I have a web form containing a textarea into which the user<br>types some HTML. I want to take said HTML, store it in a database,
<br>and then write it out as part of a web page later on.<br><br>I am using the htmlprag package for the convenience of its (write-<br>shtml-as-html ...) procedure. I originally thought said procedure<br>might allow me to output raw, unadulterated HTML as a string. This is
<br>not the case, however.<br><br>I suppose I *could* use htmlprag to parse the user's input into<br>XSHTML before it is stored in the database. However, I don't like the<br>idea of a user typing something in, saving their page, and then
<br>coming back to edit it again and finding it changed because htmlprag<br>has "corrected" mistakes in the structure. I would prefer the user to<br>make mistakes and leave them in the page.<br><br>Does anyone have any suggestions or recommendations?
<br><br>Many thanks,<br><br>-- Dave<br><br>_________________________________________________<br> For list-related administrative tasks:<br> <a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme">http://list.cs.brown.edu/mailman/listinfo/plt-scheme
</a><br></blockquote></div><br><br clear="all"><br>-- <br>Jay McCarthy <<a href="mailto:jay@cs.brown.edu">jay@cs.brown.edu</a>><br><a href="http://jay.makeoutcity.com/">http://jay.makeoutcity.com/</a>