[ 
http://issues.apache.org/jira/browse/JCR-241?page=comments#action_12331476 ] 

Marcel Reutegger commented on JCR-241:
--------------------------------------

IMO the spec is not very clear about terms like 'default namespace' and 'empty 
namespace' (which means no namespace).

So, this is what I understand:

The XML namespace specification actually does not allow the empty String as a 
namespace URI [1]. That is, JCR names without a prefix do not have a namespace 
assigned. The last statement is not 100% consistent with the JCR spec, because 
sometimes the spec states that names without a prefix belong to the default 
namespace. But because the default namespace is the empty namespace I assume my 
statement is true.

Furthermore, an empty namespace cannot be remapped! If a name does not have a 
namespace, then you cannot assign it a different prefix. It simply doesn't have 
a prefix or namespace you can remap.

In that sense the call:
session.setNamespacePrefix("foo", "");
is not possible and must throw in any case. Assigning a prefix to the empty 
namespace does not make sense. Translating this into an xml document, this 
would actually remove the namespace mapping to the prefix "foo" [2].

Does this all make sense? Do we have a XML expert on this list? Please raise 
your voice ;)

[1] http://www.w3.org/TR/xml-names11/#iri-use
[2] http://www.w3.org/TR/xml-names11/#scoping (last example)

> Remapping the default namespace
> -------------------------------
>
>          Key: JCR-241
>          URL: http://issues.apache.org/jira/browse/JCR-241
>      Project: Jackrabbit
>         Type: Wish
>     Reporter: Jukka Zitting
>     Priority: Minor
>      Fix For: 1.0

>
> I'm not sure if this is a bug, feature or standard behaviour, but currently 
> it is not possible to remap the default namespace to some other prefix. The 
> following code throws a NamespaceException:
>     session.setNamespacePrefix("foo", "");
> At least the Session.setNamespacePrefix() javadoc doesn't seem to prohibit 
> changing the prefix of the default namespace and I couldn't find anything 
> more specific in the JCR specification document. Restrictions are only placed 
> on remapping the xml namespace.
> Note that the current nodetype code is actually relying on the default 
> namespace being mapped to the empty prefix, so changing this would require 
> small changes there as well.
> I haven't really run into any cases where I'd have needed such functionality, 
> but it would be nice to clarify this issue.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to