chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] Strange SSAX parse errors


From: obscuroloconato
Subject: [Chicken-users] Strange SSAX parse errors
Date: Wed, 14 Dec 2011 22:14:58 +0100

I have a threaded server making SSL connections to another server and
parsing the HTTP response with SSAX.

Sometimes I get strange exceptions in my logs:

[GIMatch] broken for (END . employee) while expecting ENDresuoyee
[GIMatch] broken for (END . line-manager) while expecting ENDresult-sager
[GIMatch] broken for (END . result-seger) while expecting ENDline-manager
[GIMatch] broken for (END . resloyee) while expecting ENDemployee
[GIMatch] broken for (END . 203ult-set) while expecting ENDresult-set
[GIMatch] broken for (END . result-setlationship) while expecting
ENDworking-relationship
[GIMatch] broken for (END . 2esult-set) while expecting ENDresult-set
[GIMatch] broken for (END . resuoyee) while expecting ENDemployee
[GIMatch] broken for (END . result-setla) while expecting ENDline-manager

The error message itself seems to be broken, too.

The error occurs in the following function:

(define/e exn (parse-xml xml)
          (let ((id (+ 100000 (random 900000))))
            (logger prio/err
                    "Error while parsing XML " id ": "
                    (format-exception exn))
            (let ((port (open-output-file
                         (fmt #f "/tmp/people-bridge." id ".xml"))))
              (display xml port)
              (flush-output port))
            ;;(ssax:xml->sxml (open-input-string xml) '())
            #f
            )
  (ssax:xml->sxml (open-input-string xml) '()))

The macro define/e is only a wrapper for handle-exceptions:

(define-syntax define/e
  (syntax-rules ()
    ((_ exn (arg ...)
        handler
        body ...)
     (define (arg ...)
       (handle-exceptions exn
         handler
         (begin
           body ...))))))

The error occurs in the ssax:xml->sxml function. My first idea was,
that the XML is actually broken. So I stored the XML in a temp file to
be able to analyze it. But there is everything fine with the XML data.
After that I changed only one single line in my code: instead of
returning #f in the exception handler I ran the XML parser once again.
And than it works. But how can this be? How can the call to
ssax:xml->sxml in the exception handler be successful if it fails just
a moment before on the same data?



reply via email to

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