The Print() method of Ft.Xml.Domlette in 'optimizing'
the location of namespaces attributes moves them to
places that would need to be moved back (e.g. via exc
c14n) by applications that are sensitive to the
location of namespace declarations like xml signatures
and encryption.
Uche has pondered on adding such a 'no optimize' option
in the following posts:
http://lists.fourthought.com/pipermail/4suite/2003-July/005673.html
http://lists.fourthought.com/pipermail/4suite/2003-October/005959.html
IMHO, a serilization method that moves namespaces (even
if to other correct locations) is suspicious behavior.
I'd like to at least see the possibility of a
'straight' serialization.
A possible compromise between my and the exiting view
(based on XPath's model of multiplexing namespaces all
over the place, I assume) might be to have the
optimization move the declarations not to the 'highest'
possible location, but to the 'lowest' possible
location in the dom tree.
Attached is a script which demonstrates the how the
'bar' namespace declaration is moved to a node 'higher'
than it was declared (or needs to be) whether
constructed as a dom or parsed as a string.
Demonstration of Print() moving namespace declarations