Alex,
yes it seems that there's something a bit confusing happening in the
Exporter. Probably the easiest thing would be to debug with the source
jars and see what happens.
In any case, you can try a workaround:
Download http://svn.apache.org/repos/asf/jackrabbit/sandbox/inactive/jcr-ext/src/main/java/org/apache/jackrabbit/xml/DocumentViewExportVisitor.java
(yes, it's in the sandbox and inactive, but I believe it should
still work in JR 1.5) and create your own
Session.exportDocumentView(String, ContentHandler, boolean, boolean)
as explained in the comments (look at the beginning).
Be sure that in the method
private void exportNode(Node node, String prefix, String name)
throws IOException, SAXException, RepositoryException {
...
you comment out the following test (i.e uri should *not* be set to
null if empty):
if (uri.length() == 0) {
uri = null;
}
...
}
I hope it works for you.
Alessandro
Hello, Alessandro! Hello, colleagues!
I checked sources and saw that data[] in
org.xml.sax.helpers.AttributesImpl.getIndex(AttributesImpl.java:203)
can not be null because thre is no NPE in Exporter, be but it is
null anyway.
Then I checked namespaces of ssession before doing export with SAX
handler and found strange thing: there is namespace with empty
prefix and empy uri!
My namesapce and Jackrabbit's namespaces are presend and OK, but
this "empty" namespace is one candidate for NPE. It does not affect
export procedure that uses streams but I
think does affect export procedure using SAX handler.
Below is output of this piece of code:
String[] nsp = session.getNamespacePrefixes();
for (String ns : nsp) {
Logger
.getLogger(AbstractTypeResolver.class.getName()).log(Level.FINE,
"namespace: " + ns + " uri: " + ses.getNamespaceURI(ns));
}
----------- output ----------------
18 лист 2008 12:29:27
ua.org.dg.semaril.helpers.AbstractTypeResolver logNamespaces
FINE: namespace: jcr uri: http://www.jcp.org/jcr/1.0
18 лист 2008 12:29:27
ua.org.dg.semaril.helpers.AbstractTypeResolver logNamespaces
FINE: namespace: uri: <<<<<<<<<<<<<<<<<<<<<<<<< THIS NAMESPACE IS
VERY STRANGE!!!<<<<<<
18 лист 2008 12:29:27
ua.org.dg.semaril.helpers.AbstractTypeResolver logNamespaces
FINE: namespace: nt uri: http://www.jcp.org/jcr/nt/1.0
18 лист 2008 12:29:27
ua.org.dg.semaril.helpers.AbstractTypeResolver logNamespaces
FINE: namespace: pib uri: http://www.e-ukraine.org/datatypes/pib
18 лист 2008 12:29:27
ua.org.dg.semaril.helpers.AbstractTypeResolver logNamespaces
FINE: namespace: sv uri: http://www.jcp.org/jcr/sv/1.0
18 лист 2008 12:29:27
ua.org.dg.semaril.helpers.AbstractTypeResolver logNamespaces
FINE: namespace: xs uri: http://www.w3.org/2001/XMLSchema
18 лист 2008 12:29:27
ua.org.dg.semaril.helpers.AbstractTypeResolver logNamespaces
FINE: namespace: ocm uri: http://jackrabbit.apache.org/ocm
18 лист 2008 12:29:27
ua.org.dg.semaril.helpers.AbstractTypeResolver logNamespaces
FINE: namespace: xml uri: http://www.w3.org/XML/1998/namespace
18 лист 2008 12:29:27
ua.org.dg.semaril.helpers.AbstractTypeResolver logNamespaces
FINE: namespace: fn_old uri: http://www.w3.org/2004/10/xpath-functions
18 лист 2008 12:29:27
ua.org.dg.semaril.helpers.AbstractTypeResolver logNamespaces
FINE: namespace: fn uri: http://www.w3.org/2005/xpath-functions
18 лист 2008 12:29:27
ua.org.dg.semaril.helpers.AbstractTypeResolver logNamespaces
FINE: namespace: mix uri: http://www.jcp.org/jcr/mix/1.0
18 лист 2008 12:29:27
ua.org.dg.semaril.helpers.AbstractTypeResolver logNamespaces
FINE: namespace: rep uri: internal
----------------------
I do not have any idea where this empty namespace comes from... I am
sure I do not register it because it exists before I register my
namespace or OCM namespace.
It does exist in empty just inited repository.
Jukka, if you are reding this, please point me to source where
namespaces get registered in Jackrabbit. Sope piece of code
registers namespace with empty name and empty uri.
On Monday 17 November 2008 17:30:58 Alessandro Bologna wrote:
Hi Alex,
it's a bit of a shot in the dark, but looking at the code here
http://svn.apache.org/repos/asf/jackrabbit/trunk/jackrabbit-jcr-commons/src
/main/java/org/apache/jackrabbit/commons/xml/Exporter.java and here:
http://www.docjar.com/html/api/org/xml/sax/helpers/AttributesImpl.java.html
I feel inclined to think that the problem is caused by your
attributes to
be in no namespace. Would it be complicated (just to test) for you
to try
to see what happens if you set all your attributes (archiveDAte,
creator
etc) in some namespace (for instance, pib)?
Alessandro
--
SY, Alex Lukin
RIPE NIC HDL: LEXA1-RIPE