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

From: [email-masked]
Date: Wed, 13 Jul 2016 20:08:54 +0200

On Wed, Jul 13, 2016 at 03:24:03PM +0200, [email-masked] wrote:

[...]

> What is missing? From my point of view:
> 
>  - At xml->sxml time, the user doesn't know which namespaces
>    are in the xml. So it would be nice if the XML parser
>    could provide that.
> 
>  - It would be super-nice if the XML parser could put that
>    into the same nodes it found it, as described in [1]
>    (i.e. in the (*NAMESPACES* ...) pseudo-attribute).
>    This way we wouldn't have a global mapping, but one
>    that resembles the original XML, even with the same
>    prefixes. Less surprises overall. The round trip
>    xml -> sxml -> xml would be (nearly) the identity.
> 
>    With Ricardo's patch it would lump all the namespace
>    declarations up in the top node, which formally is
>    correct, but might scare XML people a bit :-)
> 
>  - At sxml->xml time there should be a way to somehow
>    generate prefixex for "new" namespaces. I don't know
>    at the moment how this would work, that depends on
>    how the user is supposed to insert new nodes in the
>    SXML. Does she specify the namespace? Both prefix
>    (aka namespace-id, under my current assumption) *and*
>    namespace? (note that the namespace-id/prefix alone
>    wouldn't be sufficient).

Argh. First post, then think, sorry.

Actually ditch the last point. I think it would be OK
to make the user responsible to keep the *NAMESPACES*
pseudo-attribute up-to-date whenever she adds nodes
with new namespaces to the SXML.

regards

[1] http://okmij.org/ftp/papers/SXML-paper.pdf

- -- tomás