Created attachment 29319 [details] Test file FileInputStream is = new FileInputStream(fileName); m_book = WorkbookFactory.create(is); The simple programe code fales with error: org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:62) at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:403) at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:408) at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:155) at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:183) at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:73) at ru.otr.core.Document.<init>(Document.java:21) at ru.otr.EnergyLoader.main(EnergyLoader.java:175) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:60) ... 7 more Caused by: org.apache.xmlbeans.XmlException: error: duplicate attribute 'o:relid' at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3511) at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1277) at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1264) at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345) at org.apache.xmlbeans.XmlObject$Factory.parse(XmlObject.java:688) at org.apache.poi.xssf.usermodel.XSSFVMLDrawing.read(XSSFVMLDrawing.java:107) at org.apache.poi.xssf.usermodel.XSSFVMLDrawing.<init>(XSSFVMLDrawing.java:102) ... 12 more Caused by: org.xml.sax.SAXParseException: duplicate attribute 'o:relid' at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.reportFatalError(Piccolo.java:1038) at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:723) at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3479) ... 18 more
The stack trace tells that the file contains invalid xml. I checked the attached file and it is indeed so: /xl/drawings/vmlDrawing1.vml contains duplicate attributes which is not allowed, have a look at the following fragemnt: <v:fill o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" I don't see a problem with POI here. What is the origin of this file? Make sure that this application writes correct XML. Yegor
Hi. Yegor. Thank you for your comment. This file in attachment is originally created with Microsoft Excel (Ver: 14.0.6123.5001 32-bit) Anton. (In reply to comment #1) > The stack trace tells that the file contains invalid xml. I checked the > attached file and it is indeed so: > /xl/drawings/vmlDrawing1.vml contains duplicate attributes which is not > allowed, > have a look at the following fragemnt: > > <v:fill o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" > o:relid="rId1" > o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" > o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" > o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" > o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" > > > I don't see a problem with POI here. What is the origin of this file? Make > sure that this application writes correct XML. > > Yegor
POI follows the OOXML spec which requires all package parts to be well-formed XML. If a part is malformed then it is a bug (or a weird feature) of MS Office. POI works with XML via XmlBeans and its Piccolo parser does not allow duplicate attributes. I appears that it is a general behavior: - Xerces (the standard XML parser from JDK) cannot parse it either - Chrome browser can't parse it - msxml.dll (Windows-wide XML parser) cannot parse it. So I don't see a problem with POI here. Yegor (In reply to comment #2) > Hi. Yegor. > > Thank you for your comment. > This file in attachment is originally created with Microsoft Excel (Ver: > 14.0.6123.5001 32-bit) > > Anton. > > > > (In reply to comment #1) > > The stack trace tells that the file contains invalid xml. I checked the > > attached file and it is indeed so: > > /xl/drawings/vmlDrawing1.vml contains duplicate attributes which is not > > allowed, > > have a look at the following fragemnt: > > > > <v:fill o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" > > o:relid="rId1" > > o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" > > o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" > > o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" > > o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" o:relid="rId1" > > > > > > I don't see a problem with POI here. What is the origin of this file? Make > > sure that this application writes correct XML. > > > > Yegor