default namespaces force new changes

I decided to make sure that default namespaces are not a problem for the converter, and I found that actually it is the problem.

Consider the following XML:

<doc xmlns="lalala">

I decided that SXML representation would be:

`(:doc (@ (@ (*NAMESPACES* (,(string->symbol "") "lalala")))) "data" (:subdoc)))

But when I tested it, I got such XML:

<:doc xmlns:="lalala">

Note the colon in name.

The next idea was not to have colons in SXML:

`(doc (@ (@ (*NAMESPACES* (,(string->symbol "") "lalala")))) "data" (subdoc)))

It looks very like the XML. But then I though about amount of problems with converting such data. The converter believes that if there is no colon in a element name, then the element is not namespaced. Fortunately, a message from the ssax-sxml mailing list relaxed me:

SXML does not have any notion of a default namespace because all namespace references are already resolved. If an element name in SXML is a colon-less symbol, the corresponding XML element was _definitely_ local.

Then I found another message. According to it, the SXML may look so:

(z:doc (@ (@ (*NAMESPACES* (z "lalala" *DEFAULT*)))) "data" (z:subdoc)))

Quite a good solution. But it uses the "original prefix" feature from the SXML specification, and earlier I wrote:

The only uncovered thing is the "original prefix". I'm ignoring it because it needs some effort to implement, but it should not appear in normal SXML<->libxml2 mapping.

Well, I was too naive, and now I have to invent something new.

Categories: Generative XML