Bug 47604 - [PATCH] Implementation of an XML to XLSX Importer using Custom XML Mapping
Summary: [PATCH] Implementation of an XML to XLSX Importer using Custom XML Mapping
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.5-dev
Hardware: PC Mac OS X 10.4
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2009-07-29 14:00 UTC by Roberto Manicardi
Modified: 2009-08-05 11:00 UTC (History)
0 users

The diff file (4.30 KB, patch)
2009-07-29 14:00 UTC, Roberto Manicardi
Details | Diff
New files (45.25 KB, patch)
2009-07-29 14:02 UTC, Roberto Manicardi
Details | Diff
Added this issue in status.xml file (855 bytes, text/plain)
2009-07-31 05:25 UTC, Roberto Manicardi

Note You need to log in before you can comment on or make changes to this bug.
Description Roberto Manicardi 2009-07-29 14:00:03 UTC
Created attachment 24061 [details]
The diff file

I've implemented a tool to import XML files into XLSX using the Custom XML Mapping defined in the XLSX.

This closes the loop I've started with the XML exporter (https://issues.apache.org/bugzilla/show_bug.cgi?id=47520).

I've added some use cases in the test file 
- src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFImportFromXML.java

To give a quick snippet of code on how to use the importer
    // gets one of the Custom XML mapping configured in the workbook
    XSSFMap map = workbook.getMapInfo().getXSSFMapByName("mapping name");
    // creates a new importer for the mapping
    XSSFImportFromXML importer = new XSSFImportFromXML(map);
    // imports the XML

I did also some little modifications to enable an easier access to the map info data:

  - XSSFMapInfo : added the new method getXSSFMapByName(String mapName)
  - XSSFWorkbook: added a new method to retreive the XSSFMapInfo object
  - XSSFSingleXmlCell: if the related XSSFCell doesn't exists, create a new one when tring to retreive it
  - XSSFXmlColumnPr : added new getId() and getXPath() methods
Comment 1 Roberto Manicardi 2009-07-29 14:02:23 UTC
Created attachment 24062 [details]
New files

Added the following files
-XSSFImportFromXML.java: Importer
-TestXSSFImportFromXML.java: Junit test
-CustomXMLMapping-singleattributenamespace.xlsx : used for testing purpose
Comment 2 Paolo Mottadelli 2009-07-30 06:25:29 UTC
Patch applied. Thanks
Comment 3 Roberto Manicardi 2009-07-31 05:25:53 UTC
Created attachment 24071 [details]
Added this issue in status.xml file
Comment 4 Roberto Manicardi 2009-07-31 05:27:11 UTC
I've forgot to set this issue in the status.xml file. I've attached a new patch, could you plese add it to the trunk?

Comment 5 Yegor Kozlov 2009-08-05 11:00:31 UTC
Added in r801342