Re: Bugzilla issue 10, was: Plan to resolve issues in 2518bis

Cullen Jennings wrote:
> 
> I'm not sure I understand what you mean by namespace preservation. Take the
> example portion of some XML:
> 
> <h:html xmlns:xdc="http://www.xml.com/books"
>         xmlns:h="http://www.w3.org/HTML/1998/html4">
>  <h:head><h:title>Book Review</h:title></h:head>
>  <h:body>
>   <xdc:bookreview>
>    <xdc:title>XML: A Primer</xdc:title>
> 
> Is it the "http://www.xml.com/books" that gets preserved or the "xdc". What
> I'm trying to ask is if would be OK if the above XML got transformed to
> 
> <h:html xmlns:foo-xdc="http://www.xml.com/books"
>         xmlns:h="http://www.w3.org/HTML/1998/html4">
>  <h:head><h:title>Book Review</h:title></h:head>
>  <h:body>
>   <foo-xdc:bookreview>
>    <foo-xdc:title>XML: A Primer</xdc:title>
 >
 > I suspect you are saying this is not OK and the namespace prefix (ie the
 > xdc) needs to be preserved and not changed to foo-xdc. If this is 
what you
 > mean, then I am not sure what you mean by this is important for XSLT 
and XML
 > Schema, can you provide a bit more of an example.
 >

The namespace URI definitively needs to preserved, I don't think there's 
any question about that.

What this issue is about is whether if it's a problem to get

	<xyz:title xmlns:xyz="http://www.xml.com/books">XML: A Primer</xyz:title>

or

	<title xmlns="http://www.xml.com/books">XML: A Primer</title>

instead.

*Usually* that doesn't make a difference, and in a perfect world, it 
never would. Unfortunately, this isn't a perfect world and a long time 
ago, XML vocabularies have started to leak prefixes into text content 
and attribute values.

Consider:

	<xsl:template match="D:propfind" xmlns:D="DAV:">

In this case, loosing the "D" prefix actually breaks the semantics of 
the document, such as in:

	<xsl:template match="D:propfind" xmlns:ns0="DAV:">

This is an example from XSLT/XPath, similar cases can be constructed 
with documents that use XML Schema, such as in

	<count xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xsi:type="xs:integer">123</count>

For the record, the XML Infoset spec includes prefixes.

So no, rewriting namespace prefixes is *not* without problems, and 
*will* break semantics of XML content. Thus, we should either require 
prefixes to be preserved, or at least state that this part of the XML 
Infoset may not round-trip through WebDAV properties.

> Thanks for educating me on this - I'm not really going to end up with much
> of an opinion on any of this but I am making sure I know enough to at least
> understand the argument. Also, I suspect I might not be the only one of the
> list that does not understand as much about XML as I wish I did :-)

Sure :-)

Best regards, Julian

Received on Wednesday, 5 October 2005 21:52:51 UTC