You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Felix Röthenbacher (JIRA)" <ji...@apache.org> on 2005/03/21 13:55:27 UTC

[jira] Created: (JCR-77) importXML ignores registered namespaces

importXML ignores registered namespaces
---------------------------------------

         Key: JCR-77
         URL: http://issues.apache.org/jira/browse/JCR-77
     Project: Jackrabbit
        Type: Bug
  Components: xml  
    Reporter: Felix Röthenbacher


Importing xml data with Session.importXML() does not use prefix of registered namespace. A workaround is to call Session.setNamespacePrefix() after import.

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Reopened: (JCR-77) importXML ignores registered namespaces

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-77?page=history ]
     
Stefan Guggisberg reopened JCR-77:
----------------------------------

     Assign To: Stefan Guggisberg

> importXML ignores registered namespaces
> ---------------------------------------
>
>          Key: JCR-77
>          URL: http://issues.apache.org/jira/browse/JCR-77
>      Project: Jackrabbit
>         Type: Bug
>   Components: xml
>     Reporter: Felix Röthenbacher
>     Assignee: Stefan Guggisberg

>
> Importing xml data with Session.importXML() does not use prefix of registered namespace. A workaround is to call Session.setNamespacePrefix() after import.

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JCR-77) importXML ignores registered namespaces

Posted by "David Nuescheler (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-77?page=comments#action_61328 ]
     
David Nuescheler commented on JCR-77:
-------------------------------------

works as expected for me.

here is what i did:

1) registered the xhtml namespace

2) modified it permanently to "myxhtml:" on the namespace registry using .registerNamespace() 

3) mapped it transiently on my session using .setNamespacePrefix() to "blaxhtml:"

4) imported the xml example from the "first steps"
http://incubator.apache.org/jackrabbit/firststeps.html

5) listed all the imported content, which shows
"blaxhtml:" for my session and "myxhtml:" for any other session

i am not sure what you are trying to achieve... you can check my tests on http://jcr.day.com, maybe you can do your tests on there too, so we can see what you are doing?

namespace registry is here:
http://jsr170tools.day.com/crx/nodetypes/namespaces.jsp

content import is here:
http://jsr170tools.day.com/crx/loader/index.jsp

please login first with admin/admin to get write access.

regards,
david

> importXML ignores registered namespaces
> ---------------------------------------
>
>          Key: JCR-77
>          URL: http://issues.apache.org/jira/browse/JCR-77
>      Project: Jackrabbit
>         Type: Bug
>   Components: xml
>     Reporter: Felix Röthenbacher
>     Assignee: Stefan Guggisberg

>
> Importing xml data with Session.importXML() does not use prefix of registered namespace. A workaround is to call Session.setNamespacePrefix() after import.

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Closed: (JCR-77) importXML ignores registered namespaces

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-77?page=history ]
     
Stefan Guggisberg closed JCR-77:
--------------------------------

    Resolution: Invalid

sorry, works as expected.

i imported this xml document

<?xml version="1.0"?>
<P1:root P1:blah="blahblahblah" xmlns:P1="http://test.org" />

using the following code:

    NamespaceRegistry nsReg = wsp.getNamespaceRegistry();
    try {
        nsReg.getPrefix("http://test.org");
    } catch (NamespaceException nse) {
        nsReg.registerNamespace("P", "http://test.org");
    }
    Node target;
    if (!root.hasNode("import")) {
        target = root.addNode("import");
    } else {
        target = root.getNode("import");
    }
    session.importXML(target.getPath(), new FileInputStream("d:/temp/nstest.xml"));
    NodeIterator ni = target.getNodes("P:*");
    long cnt = ni.getSize();
    // cnt == 1
    ni = target.getNodes("P1:*");
    cnt = ni.getSize();
    // cnt == 0

note that session.importXML() does not alter any session-local
prefix mappings. it does however register a new namespace if such
is encountered on import.

ps: also note that the second step in your instructions is unnecessary


> importXML ignores registered namespaces
> ---------------------------------------
>
>          Key: JCR-77
>          URL: http://issues.apache.org/jira/browse/JCR-77
>      Project: Jackrabbit
>         Type: Bug
>   Components: xml
>     Reporter: Felix Röthenbacher
>     Assignee: Stefan Guggisberg

>
> Importing xml data with Session.importXML() does not use prefix of registered namespace. A workaround is to call Session.setNamespacePrefix() after import.

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JCR-77) importXML ignores registered namespaces

Posted by "Felix Röthenbacher (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-77?page=comments#action_61322 ]
     
Felix Röthenbacher commented on JCR-77:
---------------------------------------

1. Register a prefix P with a namespace N.
2. Set namespace prefix setNamespacePrefix(P, N);
2. Import XML data with Session.importXML() which
   uses the registered namespace but with a different
   prefix than registered.
3. Try to get an iterator I by Session.getRootNode().getNodes("P:*");
   It will not contain any nodes!
4. Try to get an iterator I by Session.getRootNode().getNodes();
   Use I to iterate over all nodes X and print their path:
   X.getPath() will print the prefix used in the original
   xml document and not the prefix previously registered 
   with that namespace.

Summary: the importXML() method does not map the prefix
of the imported XML data to the registered prefix.
   

> importXML ignores registered namespaces
> ---------------------------------------
>
>          Key: JCR-77
>          URL: http://issues.apache.org/jira/browse/JCR-77
>      Project: Jackrabbit
>         Type: Bug
>   Components: xml
>     Reporter: Felix Röthenbacher

>
> Importing xml data with Session.importXML() does not use prefix of registered namespace. A workaround is to call Session.setNamespacePrefix() after import.

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (JCR-77) importXML ignores registered namespaces

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-77?page=history ]
     
Stefan Guggisberg resolved JCR-77:
----------------------------------

    Resolution: Incomplete

please be more specific in describing the problem. please provide instructions and test data  to reproduce the issue.

> importXML ignores registered namespaces
> ---------------------------------------
>
>          Key: JCR-77
>          URL: http://issues.apache.org/jira/browse/JCR-77
>      Project: Jackrabbit
>         Type: Bug
>   Components: xml
>     Reporter: Felix Röthenbacher

>
> Importing xml data with Session.importXML() does not use prefix of registered namespace. A workaround is to call Session.setNamespacePrefix() after import.

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira