[Phoenix] Implementing support for XML documents with unprefixed default namespaces

Andreas Wuest awuest at student.ethz.ch
Fri Sep 22 20:12:31 CEST 2006


Hi Thomas

On 22.9.2006 19:42 Uhr, Thomas Comiotto wrote:

> Hi Andi
> 
> Am 22.09.2006 um 19:00 schrieb Thomas Comiotto:
> 
>> Hi
>>>
>>> The only drawback to this approach is that the XPath toolbar will 
>>> display location paths with strange prefixes (i.e, our generated 
>>> prefixes). The user might get confused by those because he can't see 
>>> them in the actual source.
>>>
>>>
> 
> I think there's one more thing to consider: the stylepatcher copies 
> nodeValue selectors that later make for location paths segments! This 
> means that location paths will contain prefixes as defined by the 
> stylesheet.

Or rather no prefixes, in the case of default namespaces. Equally as bad 
though. :(

> Besides that documentDOM is unaware of these prefixes (and therfore 
> xpath querys will fail) the stylesheet must resolve all default 
> namespaces to corresponding prefixes. So I think a cleaner approach 
> would be to copy over prefix resolvers from the stylesheet to the root 
> element of documentDOM (and to remove this data before sync'ing the 
> model) and in turn to pass these prefixes to the sourcetagger.

I am not sure what you mean by "prefix resolvers from the stylesheet". 
Are you referring to the namespace declaration attributes (xmlns:X="Y") 
in the <xsl:stylesheet> element here?

And if so, is there no chance of intereference with prefixes declared in 
the documentDOM?

> The sourcetagger would have to be extended to support default namespace 
> switching (inserting multiple prefixes to multiple default namespaces). 
> Currently it only supports one default namespace.
> 
> A.
> 
> <foo xmlns="foo.org">
>   <bar xmlns="bar.org"/>
> </foo>
> 
> 
> B.
> <xsl:stylesheet xmlns:foo="foo.org" xmlns:bar="bar.org">
> 
> ..
> 
> </xsl:stylesheet>
> 
> C.
> <foo xmlns="foo.org* xmlns:foo="foo.org" xmlns:bar="bar.org">
>   <bar xmlns="bar.org"/>
> </foo>
> 
> You see, there's a hell lot to consider - maybe we just should implement 
> ns unaware mode first. This will cover 99.9% of all documents while 
> keeping the code simple and clean :)

Yay, there seems to be no easy solution. What would we have to do in 
order to implement namespace-unawareness?

-- 
Kind regards,
Andi



More information about the Phoenix mailing list