Bug 57890 - [PATCH] XSSFImportFromXML does not consider data types
Summary: [PATCH] XSSFImportFromXML does not consider data types
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.9-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2015-05-05 08:24 UTC by Sandra
Modified: 2015-09-17 18:31 UTC (History)
0 users



Attachments
Patch including fix and test case (10.26 KB, application/x-gtar)
2015-05-05 09:29 UTC, Sandra
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sandra 2015-05-05 08:24:23 UTC
When importing an XML into xlsx spreadsheet (using XSSFImportFromXML) the data type isn't considered when setting the cell values. All values are saved as string.

The data type (getXmlDataType: STXmlDataType.Enum) should be considered. The possible values are available on STXmlDataType as constants.

Patch including fix and a test will follow shortly.

Additional info:
- used POI version: 3.9
- used Excel version: 2010
Comment 1 Sandra 2015-05-05 09:29:50 UTC
Created attachment 32714 [details]
Patch including fix and test case
Comment 2 Sandra 2015-05-05 10:30:12 UTC
Description of the changes made in the patch:

XSSFImportFromXML will now consider the data type defined in the XML schema when filling the data of the xml into cells. It differentiates between Boolean, Integer, Data and String. Any unknown data types are handled as Strings. If the string value can't be parsed into the required data type (e.g. Integer or Date) it will result in a IllegalArgumentException. 
Currently not all STXmlDataTypes are handled.
For an example refer to the test and test data in the patch.
Comment 3 Dominik Stadler 2015-09-17 18:31:44 UTC
Thanks for the patch, this is now applied via SVN r1703665