[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MIT-Scheme-devel] checking for legal XML characters

From: Taylor R Campbell
Subject: [MIT-Scheme-devel] checking for legal XML characters
Date: Wed, 26 Jul 2006 21:16:04 +0000
User-agent: IMAIL/1.21; Edwin/3.116; MIT-Scheme/7.7.90.+

Is there a better way to check whether a string consists solely of
legal XML characters than this?  What I really want is a way to walk
across UTF-8 strings, with which UTF8-STRING-IN-ALPHABET? could be
implemented, I suppose.  (OK, what I *really* want is to see my
alternative string API implemented -- module system first, though.)

   (let ((port (open-input-string string)))
     (port/set-coding port 'UTF-8)
     (let loop ()
       (let ((char (read-char port)))
         (or (eof-object? char)
             (and (char-in-alphabet? char alphabet:xml-char)

The XML-RPC string encoder in xml/xml-rpc.scm fails to check for this,
and I was just bitten by another XML-RPC implementation sending XML
with form feed characters in entity references, which is disallowed by
the XML specification and therefore rejected by MIT Scheme's XML
parser.  The XML output and structure routines don't check for this
either, but perhaps they should.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]