[XML-SIG] Namespace support for DOM

Andrew M. Kuchling akuchlin@cnri.reston.va.us
Mon, 28 Dec 1998 17:07:56 -0500 (EST)


Paul writes:
>> 	  1) Get a dictionary mapping namespace prefixes to URIs, and
>> vice versa; this would be done by walking up the tree looking at
>> xmlns:* attributes.
>
>I don't think that the programmer needs access to this dictionary. 
>Internally you need it, but I don't think that the programmer should.

>I think that this would be better:
>uri, name = namespace_divide( node.tagName )

	Talking about this with Fred at lunch today, I realized that
this is probably not sufficient, and that you really do need access to
the dictionary.  Consider an Element node with no namespace prefix;
its namespace is therefore assumed to be the default one.  Take that
node out of the tree, and insert it somewhere else, where the default
namespace is *different*.  Assume that this behaviour isn't what you
want; instead, you want to keep the element in the same namespace as
it was originally in.

	This may mean adding the right prefix for the namespace's URI,
which means you need some way of getting at the prefixes and URIs
availabe at the new location. (It could also be done by adding an
xmlns="URI" attribute to the element, but that makes solving this
problem too easy. :) More seriously, there might be applications where
adding the NS prefix is the only way to go.)

	I like the idea of the namespace canonicalizer as a demo app,
BTW.

-- 
A.M. Kuchling			http://starship.skyport.net/crew/amk/
I must be strong. And in my head a voice says, Yes, Dear, you must. And in my
head another voice is muttering Oh that I were a man, or that I had power to
execute my apprehended wishes: I would whip some with scorpions... And a voice
says, You know what you must do.
    -- Lyta is told her son is dead, in SANDMAN #59: "The Kindly Ones:3"