Android development implements the method of reading Excel data and saving it as XML
This paper describes the method of reading Excel data and saving it as XML in Android development. Share with you for your reference, as follows:
A while ago, the company asked outsiders to translate some strings in values in Android. However, they are saved in Excel format. If you simply paste the data in Excel into the specified XML, the workload is very heavy. Therefore, you wrote a simple demo to read and save the data in Excel as the data corresponding to XML. The following demo and pictures are shown:
1. The data is saved in beanvalue, including key and value, to facilitate subsequent data reading
2. Data analysis, including testing, is carried out directly in the main method
Tips:
1. Packages to be imported: Excel (JXL. Jar) XML (dom4j-1.6.1. Jar), and excel can also parse poi-3.11-20141221.jar;
2. There will be garbled code when reading excel. You can convert the encoding format through workbooksettings;
3. The above demo is OK for the test of the EXCEL form I read. You can make corresponding changes according to the contents in your excel,
But the general parsing process is the same!
Excel source data table:
Save as XML table:
PS: here are some online tools on XML operation for your reference:
Online XML / JSON conversion tool: http://tools.jb51.net/code/xmljson
Format XML online / compress XML online: http://tools.jb51.net/code/xmlformat
XML online compression / formatting tool: http://tools.jb51.net/code/xml_ format_ compress
XML code online formatting and beautification tool: http://tools.jb51.net/code/xmlcodeformat
More readers interested in Android related content can view the special topics of this site: summary of Android operation XML data skills, summary of activity operation skills of Android programming, summary of Android resource operation skills, summary of Android file operation skills, introduction and advanced tutorial of Android development, summary of Android view skills, and Android control usage summary
I hope this article will help you in Android programming.