We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Load Word DOCX Document with Large Image in Memory (Java) | Avoid XMLStreamException: Improper GE/element Nesting

Hello Team.

I have a word document that contains a large image (41.6 MB): https://drive.google.com/file/d/1SalVzpYWmJFnvwW94cIrC8I4A-mDiovz/view?usp=sharing

I cannot open it using Aspose.Word java version 21.2.0:

com.aspose.words.Document asposeDocument = new com.aspose.words.Document("example.docx");

The error is:

com.aspose.words.FileCorruptedException: The document appears to be corrupted and cannot be loaded.
Caused by: java.lang.IllegalStateException: XMLStreamException: Improper GE/element nesting: entity &null contains closing tag for <w:document>
 at [row,col {unknown-source}]: [2,20463207]
	at com.aspose.words.internal.zzZYQ.zzZ(Unknown Source)
	at com.aspose.words.internal.zzZYQ.read(Unknown Source)

But the file is not corrupted. I can open it in Word.

I was wondering if there is something wrong with the image (document)?
Or Aspose.Word has a restriction about embedded images?

Thank you in advance, Svetlana.

@skorpusova,

We have logged this problem in our issue tracking system with ID WORDSJAVA-2620. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSJAVA-2620) have been fixed in this Aspose.Words for Java 21.12 update.