You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Jukka Zitting (JIRA)" <ji...@apache.org> on 2005/10/05 18:40:47 UTC

[jira] Created: (JCR-241) Remapping the default namespace

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


[jira] Commented: (JCR-241) Remapping the default namespace

Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-241?page=comments#action_12331567 ] 

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

I think Jukka's initial intent was to assign a prefix to the default (empty namespace). That is, names that previously had no prefix should then have the prefix 'foo'. Is that correct Jukka?

I can certainly see the use case Roy metioned, however I don't think that this can be or should be done with the namespace registry. While quickly defining a new namespace as the default one can be done quite easily in an xml document, re-mapping a namespace in JCR has a global effect on the whole repository. That is, not just the imported names would get a namespace (prefix) but also all other names that previously had no namespace must get one. Restricting a namespace mapping to just a certain scope (as you can do in an xml document) is not possible in JCR.

So, to assign a namespace to names that one has just imported in JCR, I think one has to actually *rename* the nodes and properties. Because that basically what it is about: a name without a namespace becomes a name with a namespace. In contrast to an xml document where you simply declare a new namespace for a certain scope, JCR namespaces are always global and changing them has a repository wide effect.

> 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


[jira] Commented: (JCR-241) Remapping the default namespace

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-241?page=comments#action_12331585 ] 

Jukka Zitting commented on JCR-241:
-----------------------------------

Actually I think that the use case of mapping the empty prefix to some normal namespace is much more interesting than assigning a prefix to the empty namespace. However you cannot do the former without the latter (first remap the empty namespace, then map another namespace to the now free empty prefix), thus the wording of the issue.

> 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


[jira] Commented: (JCR-241) Remapping the default namespace

Posted by "Roy T. Fielding (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-241?page=comments#action_12331517 ] 

Roy T. Fielding commented on JCR-241:
-------------------------------------

Jukka's comment is right on the mark.  It is typical for XML documents
to have one namespace declaration with an empty prefix, frequently
for the sake of backwards compatibility with tools that do not understand
namespaces at all.  It is also common for people to import XML that
has no declared namespaces and then want to go in and add namespaces to those elements after the fact.

So, I'd say we need the ability to assign the empty prefix to a namespace
and also the ability to change the namespace of individual names even if they have no current namespace assigned.  I don't know if Jackrabbit already supports those idioms, but they are so common that we will need to support them regardless of the specs.


> 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


[jira] Updated: (JCR-241) Remapping the default namespace

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-241?page=all ]

Jukka Zitting updated JCR-241:
------------------------------

    Fix Version: 1.1
                     (was: 1.0)

> 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.1

>
> 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


[jira] Commented: (JCR-241) Remapping the default namespace

Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
    [ 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


[jira] Commented: (JCR-241) Remapping the default namespace

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-241?page=comments#action_12331479 ] 

Jukka Zitting commented on JCR-241:
-----------------------------------

Hmm, you are right. However it should probably be possible to map some other namespace to the empty prefix. As in:

    session.setNamespacePrefix("", "some-namespace");

For example to work with XML documents like:

    <document xmlns="some-namespace"/>

This however is not possible if you cannot remap the empty namespace in the first place.

> 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


[jira] Commented: (JCR-241) Remapping the default namespace

Posted by "Roy T. Fielding (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-241?page=comments#action_12331518 ] 

Roy T. Fielding commented on JCR-241:
-------------------------------------

oops, reading backward it seems like the original question was confusing.  I think what Jukka wants is to change an existing prefix "foo" to the empty prefix "", not to set the URI of the namespace to "".

> 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