Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#5 User-supplied namespaces broken

closed-invalid
nobody
None
5
2005-12-06
2005-06-20
Anonymous
No

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 bug report is also being sent to the sxml mailing
list.

Contact lindsay@coretech.co.nz

Discussion

  • Oleg Kiselyov
    Oleg Kiselyov
    2005-12-06

    Logged In: YES
    user_id=4017

    That is not a bug. Please see the message on the SSAX-SXML mailing list
    posted on Mon, 20 Jun 2005 13:55:30 -0700.

     
  • Oleg Kiselyov
    Oleg Kiselyov
    2005-12-06

    • status: open --> closed-invalid