[racket] with-handlers string->xexpr fail
Hi,
i learn with-handlers mechanism, and i don't understand what's wrong in this
piece of code ?
#lang racket
(require xml)
(define a-good-string "<doc><bold>hi</bold> there!</doc>")
(define a-bad-string "<doc><boooooold>hi</bold> there!</doc>")
(define (panoramix s)
(with-handlers ((exn:invalid-xexpr? (lambda (e) 'UFO)))
(string->xexpr s)))
(panoramix a-good-string)
; this is ok and returns > '(doc () (bold () "hi") " there!")
(panoramix a-bad-string)
; <unsaved editor>::6: read-xml: parse-error: start tag `boooooold' at
[1.5/6 1.16/17] doesn't match end tag `bold' at [1.18/19 1.25/26]
Why it returns an error and not UFO ?
thanks,
-mw
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101022/a45743d4/attachment.html>