[xquery-talk] Constructing namespace nodes

Ronald Bourret rpbourret at rpbourret.com
Tue Feb 8 09:10:36 PST 2011

The real cause of this problem (and many others) is namespaces in 
content. This has been around almost as long as namespaces themselves, 
but has never been recognized in the spec.

Perhaps the solution is for the spec to finally deal with this. For 
example, (a) allow documents to declare that namespaces are used in 
content and (b) allow processors to modify any prefixes it finds in content.

-- Ron

David Lee wrote:
> This may work in theory but in practice its not that easy (atleast in my
> experience).
> <rant>
> In the Saxon world there are many places NamespaceReducer is put in the
> chain without being requested,
> For example Serializer.getXMLStreamWriter().
> There are many places in Saxon that do this without the user being able to
> avoid it easily.
> I'm not picking on Saxon, its just an API set I'm more familiar with than
> most.
> Other API's I find 'hit and miss'.   Sometimes they remove unused namespaces
> sometimes they don't.
> I've found I have to try a particular API to find out, its rarely documented
> and can often change from release to release.
> Its one of those 'dark holes' of implementation where I've learned one cant
> really rely on consistent behavior.
> In almost all cases I can think of (and thinking back to the zillions of
> "How can  remove these unused namespace from my document" posts,
> I think this is the correct and desired behavior (remove redundant or unused
> namespaces).    But sometimes its not.
> That's when you have QNames in Content and the tools require the XML
> namespace declarations instead of their own indicators..   
> A true 'black sheep' of XML practice, IMHO.  (not that I'm innocent in this
> regards either )
> And I don't think you can just 'blame the user' ... Its really a dark and
> scary part of XML processing realities ... you never know really what's
> going on under-the-hood wrt namespaces and frequently cant control it even
> if you do.
> </rant> 

More information about the talk mailing list