Export Data from excel to an XML schema has nested lists within nested lists

混江龙づ霸主 提交于 2020-01-24 13:16:30

问题


Is it possible to export Excel Data to an XML Files where the XML schema has nested lists within other nested lists?

What I have tried so far: Googling - I have found one thread that states it can not be done as Excel is inherently a flat table: https://social.msdn.microsoft.com/Forums/vstudio/en-US/8ded1f7a-2f9c-4c5a-aec5-c7bd6c594976/convert-data-from-excel-to-xml-when-schema-includes-list-of-lists?forum=vsto

Setting up fake data of two nested lists in an XML file and importing it into Excel. Excel's automatic recognition system works, but even if I do not change any of the displayed data, Excel doesn't allow me to export the file back into XML.

Here my sample XML Data:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Daten>
    <Mitarbeiter>
        <Vorname>Lukas</Vorname>
        <Name>Rohr</Name>
        <Department>BDTP</Department>
        <Points>206</Points>
    </Mitarbeiter>
    <Workdays>
        <Holiday>1</Holiday>
        <Days>1</Days>
        <Days>1</Days>
        <Days>1</Days>
        <Days>1</Days>
        <Days>0</Days>
        <Days>0</Days>
        <Days>0</Days>
        <Sickdays>
            <Holiday>1</Holiday>
            <Days>1</Days>
            <Days>1</Days>
            <Days>1</Days>
            <Days>1</Days>
            <Days>0</Days>
            <Days>0</Days>
            <Days>0</Days>
        </Sickdays>
    </Workdays>
</Daten>

回答1:


After having looked into this question for a considerable amount of time I have reached the following conclusion: it is NOT possible to export data from Excel into a XML Format using the onboard XML tools.

The only way to do it is be either coding an XML export format in VBA or using a dedicated XML tool to read out an Excel file.

Neither option is very good and i eventually abandonded my efforts to solve the problem in Excel at all.



来源:https://stackoverflow.com/questions/46565825/export-data-from-excel-to-an-xml-schema-has-nested-lists-within-nested-lists

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!