[xquery-talk] Constructing namespace nodes

David Lee dlee at calldei.com
Tue Feb 8 12:23:37 PST 2011


I agree that's the root of the problem.  (qnames/namespaces in content).
I suggest an alternative to changing the XML spec, is enhancing/changing the
spec of tools which make use of "namespaces in content" to have explicit
declarations to define these namespaces instead of piggybacking on the XML
namespace pseudoattributes.

A difficult problem with changing the XML spec (beyond the fact its
difficult to change the XML spec) is that exactly what part of "content"
should be parsed as a 'namespace in content' is very hard to define
generally.
Its application specific.   Would an XML parser have to correctly identify
the namespaces in this expression ? (and avoid what 'looks like'  a
namespace prefix but isn't ?)

   <xslt:copy-of select='concat(/foo:bar/@spam:bletch,"a:b/@d:e")' />

Ouch.
Its really only the application itself which has enough knowledge to do
this.




----------------------------------------
David A. Lee
dlee at calldei.com
http://www.xmlsh.org


-----Original Message-----
From: talk-bounces at x-query.com [mailto:talk-bounces at x-query.com] On Behalf
Of Ronald Bourret
Sent: Tuesday, February 08, 2011 12:11 PM
To: talk at x-query.com
Subject: Re: [xquery-talk] Constructing namespace nodes


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> 
_______________________________________________
talk at x-query.com
http://x-query.com/mailman/listinfo/talk



More information about the talk mailing list