namespaces reloaded
All this time I've subconsciously been ignoring a big namespace-related problem. I'm afraid the correct solution slows down the conversion between XML and SXML, and that I have to use the correct solution.
Consider the example:
<a xmlns:ns="x:y:z"> <b> <ns:c> </b> </a>
Suppose you want to copy a subtree defined by the element "b" into some other tree. But what happens then to the element "ns:c"?
Unfortunately, you get a "free" entrance of the namespace prefix "ns". In this case, collisions or other troubles may happen.
At the moment I see the only solution is to scan subtree for free namespace prefixes and add namespace definitions for the free prefixes.
To make things worse, at the moment I don't know how to make it in SXML to XML conversion. There are no parent pointers in S-expressions, so it's impossible to find namespace definitions for a namespaced node.