Bug 47616

Summary: Schema element is saved without standard namespace
Product: POI Reporter: Roberto Manicardi <roberto.manicardi>
Component: XSSFAssignee: POI Developers List <dev>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P2    
Version: 3.5-dev   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X 10.4   
Attachments: The original XLSX file
The file modified by POI

Description Roberto Manicardi 2009-07-31 07:55:24 UTC
Created attachment 24073 [details]
The original XLSX file

Hi,

I've tried the new tool to import XML into XSLSX files using the Custom XML mapping and I found a problem.

If you load an XSLS file, import data from XML and then save the XLSX back to file, the xmlMaps.xml part becomes corrupted.

I've attached two XLSX file to show the problem.

If you open the original xmlMaps.xml file it looks like this:

<Schema 
   ID="Schema13" 
   Namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
   
  <xsd:schema 
    targetNamespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
    elementFormDefault="qualified"
    xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"  
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">


while the file saved from POI looks like this:

<Schema 
   ID="Schema13" 
   Namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
   <xsd:schema 
      targetNamespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
      elementFormDefault="qualified" 
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">


It seems that the xmlns attribute of the inner xsd:schema element is removed by XMLBeans (I don't know if it's not saved or not readed from the original file).
Comment 1 Roberto Manicardi 2009-07-31 07:55:47 UTC
Created attachment 24074 [details]
The file modified by POI
Comment 2 Yegor Kozlov 2009-08-13 10:49:51 UTC
Roberto,

please post a complete example how to reproduce the problem - I don't quite understand what is wrong. 

Load / Save of the attached file works OK. 
I tried to apply the code from TestXSSFImportFromXML.testMultiTable() to the attached file and it produced a valid xlsx output.

Basically, you need to tell XmlBeans that you are saving a file with additional namespaces. A good example how to do it is XSSFDrawing.commit().

Yegor
Comment 3 Dominik Stadler 2015-07-07 20:04:50 UTC
No update since a long time and the bug is not reproducible, therefore closing this WORKSFORME for now, please post more information if you still think there is a bug.