Hi,<br>i learn with-handlers mechanism, and i don't understand what's wrong in this piece of code ?<br><br>#lang racket<br>(require xml)<br><br>(define a-good-string "<doc><bold>hi</bold> there!</doc>")<br>
(define a-bad-string "<doc><boooooold>hi</bold> there!</doc>")<br><br>(define (panoramix s)<br> (with-handlers ((exn:invalid-xexpr? (lambda (e) 'UFO)))<br> (string->xexpr s)))<br>
<br>(panoramix a-good-string)<br>; this is ok and returns > '(doc () (bold () "hi") " there!")<br><br>(panoramix a-bad-string)<br>; <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]<br>
<br>Why it returns an error and not UFO ?<br><br>thanks,<br>-mw<br>