Hello Peter,
I suspect that the reason you got very few replies - well OK, I admit it
none - was because users of POI tend not to use the API in just that manner.
I think it is safe to say they would probably do something like the
following;
FileInputStream fis = new FileInputStream(new File("MyFile.docx"));
XWPFDocument doc = new XWPFDocument(fis);
That is not going to be the case for 100% of the API's users of course but I
suspect it is the most common idiom. Therefore, there are few with the
knowledge or expertise to respond to your question - and I count myself in
that group. I fear you will have to wait for one of the developers to pick
up your question and I would ask you to bear in mind that many will be at
ApacheCon in the coming week.
Yours
Mark B
Peter Loft wrote:
>
> Sorry if this goes against forum posting rules but having not had any
> replies to my initial message I thought that I would repost.
>
> I 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 (tried 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 given deprecation of 'Package'):
>
> 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 versussax, 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.
>
> -----------------------------------------------------------------------------------
>
>
--
View this message in context:
http://www.nabble.com/Null-pointer-exception-when-reading-docx-package---Retry-tp26116157p26119508.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]