On May 22, 2012, at 12:16 , rm@tuxteam.de wrote:
On Tue, May 22, 2012 at 10:43:27AM +0200, Raymond Wiker wrote:
I'm using cxml-stp to build XML responses for a web service that implements Microsoft's "Research" API (actually, this is just a generalised search interface). While building this, I found something that looks like a bug in cxml-stp. If this is _not_ a bug, I'd be happy for any hint about what I'm doing wrong :-)
The attachment contains a small test case which builds an XML document and serializes it. The attachment should be compiled and loaded after cxml-stp has been loaded, and the commented-out test form at the end of the file should then be evaluated.
The test uses two implementations of cxml-stp-impl::collect-local-namespaces. With the original implementation, the "Status" and "Providers" elements get incorrect xmlns attributes. With the modified version, this is not the case.
Sorry, I don't have much time to investigate your example, but I think your "fixup" is wrong. Your code (add-element ...) will put the new element into the namespace with namespace name "", but your "fixup" will emit xml that puts the element into the _default_ namespace (which, in your example will be "urn:Microsoft.Search.Registration.Response"). A namespace of "" is _not_ the same as no declaration.
add-element calls cxml-stp:make-element, which sets the namespace to "" if it is not supplied (or nil). Thus, setting namespace-uri to "" if no uri is supplied should not make any difference (and it does not seem to do so - I just checked by defaulting namespace-uri to nil instead of "").