[plt-scheme] SSAX and error messages

From: Dave Gurnell (d.j.gurnell at gmail.com)
Date: Mon Oct 15 08:55:26 EDT 2007

Hi all,

The messages provided by SSAX when it can't parse a document seem to  
be rather unhelpful.

For example, running the following module:

   (module example mzscheme

     (require (planet "ssax.ss" ("lizorkin" "ssax.plt" 1 3)))

     (define bad-xml
       "<test><xml><file>There's no closing file tag.</xml></test>")

     (with-handlers ([(lambda (exn) #t)
                      (lambda (exn) (printf "Exception: ~s~n" exn))])
       (let ([input (open-input-string bad-xml)])
         (printf "SXML: ~s~n" (ssax:xml->sxml input null))))


prints the following on standard error:

   Error at position 51
   ([GIMatch] broken for  (END . xml)  while expecting  END file)

and the following on standard out:

   Exception: -1

There doesn't seem to be a simple way of getting hold of the error  
message or source location from within the code. This is causing  
problems for the Schematics XMLRPC library and for an Untyped  
contract. Does anyone know of a solution?


-- Dave

Posted on the users mailing list.