Bug 56479

Summary: Hardcoded dcterms namespace prefix name in the check for OPC compliance
Product: POI Reporter: Sebastien Schneider <sebastien.schneider>
Component: OPCAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: major CC: sebastien.schneider
Priority: P2    
Version: 3.11-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: opc archive to reproduce this bug

Description Sebastien Schneider 2014-05-01 16:55:14 UTC
I've an issue when parsing generated OPC document that use a dcterms prefix different than 'dcterms'. 

For instance 'dc' is used and I get org.apache.poi.openxml4j.exceptions.InvalidFormatException: The element 'created' must have the 'xsi:type' attribute with the value 'dcterms:W3CDTF' because of this different prefix name.

In file PackagePropertiesUnmarshaller.checkElementForOPCCompliance() line 372 you should build the xsi:type string to check by taking into account the namespace prefix name currently used.
Comment 1 Nick Burch 2014-05-01 18:43:17 UTC
Any chance of a sample file which shows the problem, and ideally too a patch and a unit test? :)
Comment 2 Sebastien Schneider 2014-05-01 18:55:32 UTC
Created attachment 31582 [details]
opc archive to reproduce this bug

opc archive to reproduce this bug which is located in core.xml file.
Comment 3 Sebastien Schneider 2014-05-01 18:58:25 UTC
I attached an empty sample opc archive file to reproduce this issue and to help to code a unit test.

I've no time for now to install a dev env for POI ooxml to test a patch but I think that the fix is quite simple to implement (3 to 4 line of code I guess).

Thank you for your help.
Comment 4 Dominik Stadler 2015-08-11 05:40:59 UTC
This is fixed via r1695212, we now compare against the namespace-prefix from the element.