Getting document.xml from a docx file using ZipInputStream
- by meenakshik
Hello,
I have a inputStream of a docx file and I need to get hold of the document.xml which lies inside the docx.
I am using ZipInputStream to read my stream and my code is something like
ZipInputStream docXFile = new ZipInputStream(fileName);
ZipEntry zipEntry;
while ((zipEntry = docXFile.getNextEntry()) != null) {
if(zipEntry.getName().equals("word/document.xml"))
{
System.out.println(" --> zip Entry is "+zipEntry.getName());
}
}
As you can see The output for zipEntry.getName comes as "word/document.xml" at some point. I need to pass this document.xml as a stream and unlike the ZipFile method where you can easily pass this on calling .getInputStream, I am wondering how can I do this docXFile?
Thanks in advance,
Meenakshi