Bug in ssax:xml->sxml

Lindsay Smith <linsmi-AfxEtdRqmE/[email protected]> Mon, 20 Jun 2005 17:30:50 +1200
Newsgroups gmane.lisp.scheme.ssax-sxml
Message-ID <[email protected]>
I am trying to define my own namespace definitions before parsing an xml 
fragment.  It does not work.

Example:

#;> (define testxml "<foo><testns:tag>bar</testns:tag></foo>")

#;> (call-with-input-string testxml (lambda (port) (ssax:xml->sxml port 
'((testns . "replaced")))))
Error: [nsc-NSDeclared] broken; prefix

Possible solution:

inside ssax:xml->sxml :

(namespaces
    (map (lambda (el)
           (cons* #f (car el) (ssax:uri-string->symbol (cdr el))))
         namespace-prefix-assig))

This appears to incorrectly set up the namespace list for the 
user-supplied namespaces.  The #f on the front makes the assq call in  
ssax:resolve-name fail.

If I change it to:

(namespaces
    (map (lambda (el)
           (cons* (car el) (ssax:uri-string->symbol (cdr el)) #f))
         namespace-prefix-assig))

Then I get:

#;> (call-with-input-string testxml (lambda (port) (ssax:xml->sxml port 
'((testns . "replaced")))))
(*top* (|@@| (*namespaces* (testns "replaced")))
       (foo (replaced:tag "bar")))

which is the desired result. I don't really know if the #f belongs on 
the end of the association list, but I know from reading resolve-name 
that the cadr must be the thing to replace it with.

This has also been filed as a bug on sourceforge.

Lindsay


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click