Bug 56730

Summary: [Patch] NPE occurs when exporting a xslx as an XML if attached schema contains ref elements
Product: POI Reporter: Marc <hae>
Component: XSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal Keywords: PatchAvailable
Priority: P2    
Version: 3.11-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Fixes NPE when exporting xml schema containing elements with ref attributes
This is the right attachment

Description Marc 2014-07-16 14:48:23 UTC
A NPE occurs when exporting a xslx as an XML document if the attached schema contains ref elements. 

Here is an example of a xml schema which POI can't handle beacause of the xs:element ref attribute

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xs:element name="Entry" type="Type_Entry"/>
    <xs:complexType name="Type_Entry">
        <xs:sequence>
             <xs:element ref="REFELEMENT" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>
    
    <xs:element name="REFELEMENT" type="xs:double"/>

</xs:schema>

I'm going to provide a patch for this issue.
Comment 1 Marc 2014-07-16 14:50:13 UTC
Created attachment 31819 [details]
Fixes NPE when exporting xml schema containing elements with ref attributes
Comment 2 Marc 2014-07-16 15:00:26 UTC
Created attachment 31820 [details]
This is the right attachment
Comment 3 Dominik Stadler 2014-08-28 21:41:58 UTC
Thanks for the patch, this is fixed for 3.11 via r1621209.