jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg (JIRA)" <j...@apache.org>
Subject [jira] Closed: (JCR-77) importXML ignores registered namespaces
Date Mon, 21 Mar 2005 15:51:24 GMT
     [ 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


Mime
View raw message