Subject: bug#20339: sxml simple: sxml->xml mishandles namespaces?

From: Ricardo Wurmus <[email-masked]>
Date: Tue, 05 Feb 2019 10:12:06 +0100

Hi John,

> The trouble with that is that XML rnamespaces are lexically scoped, like
> Scheme
> local variables.  It is perfectly valid to map a prefix to more than one
> URL,
> as long as the namespace declarations are in either disjoint or nested
> elements.  So you don't know what the absolute name of the element
> or attribute is from just the prefix and the local part.
>
> Furthermore, it is also legal to define more than one prefix for
> the same URL, in which case names using either prefix are normally
> treated as equivalent (however, you can't have elements like
> <a:foo>...</b:foo>
> even if a and b map to the same namespace).
>
> * Is the value for “namespaces” that’s passed in to the
>>   FINISH-ELEMENT procedure always the same?
>>
>> * Will the second return value of the final call to FINISH-ELEMENT
>>   really always be the complete list of *all* namespaces that have been
>>   encountered?
>>
>
> Definitely not, only the namespaces that are currently in scope.

Thanks for the clarifications!

In that case we coud have FINISH-ELEMENT add all namespace declarations
that are in scope to the current node that is about to be returned.  It
would be a little verbose, but more correct.

What do you think?

-- 
Ricardo