You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Peter Loft <Pe...@softwareimaging.com> on 2009/10/22 16:45:31 UTC

Null pointer exception when reading docx package

OK, this is my first post and have just started to try and use Apache POI, specifically openxml4j part of it to read the parts of a docx file.
The following is how I'm trying to do this and the problems that I'm getting:

IDE: Eclipse 3.4.2.
POI Version: 3.5 Final.

I've created a Java project for POI (both all of it and just openxml4j part).
I've created an Android project which simply makes the following call (I've also tried OPCPackage):

Package pkg = Package.open(aFilePathAndName, PackageAccess.READ);

I'm getting a null pointer exception in: ContentTypeManager::parseContentTypesFile.
Specifically when trying to get the ContentType attribute.
Examination of the element reveals that it has two 'Extension' attributes but no ContentType one, hence the exception.

Now if I perform the above with beta openxml4j downloaded from sourceforge then it works OK. Obviously there are changes in the way the XML is parsed between the two versions, dom versus sax, but given the triviality of what I'm trying to do I must be doing something obviously wrong.

Any help would be appreciated, thanks in advance.

Peter.



-----------------------------------------------------------------------------------
Software Imaging: At the Forefront of Innovation in Printing and Imaging Software.
Providing Solutions for the Printer Industry and Mobile Phone Market.

Software Imaging Limited is a limited company registered in England and Wales.
Registered Office: 9400 Garsington Road, Oxford Business Park, Oxford, OX4 2HN, UK.
Registered No: 01755090

This message is strictly private and contains confidential information intended 
only for the use of the person named above. If you have received this e-mail in 
error and are not the intended recipient you must not disclose, copy or distribute 
it to anyone else. Please immediately advise the sender and delete this email and 
all attachments.

-----------------------------------------------------------------------------------