将xml输出转换为c语言的表

时间:2018-02-14 10:00:25

标签: c linux xml-parsing data-conversion

我需要将xml输出转换为表格格式输出。 问题是我不知道如何在c中使用xml解析器,如果这是唯一的解决方案。我认为可以采用其他更简单的方法,因为下面的格式是固定的。

我希望你们中的任何人都可以帮助我用伪代码解决这个问题,或者在c中使用xml解析器。

pdfCalligraph

XML output
INPUT:
<nvme-subsystem-host-get-iter/>

OUTPUT:
<results status="passed">
    <attributes-list>
            <nvme-target-subsystem-host-info>
                    <host-nqn>nqn.2014-08.org.nvmexpress:nvmf:uuid:ef938fb1-1f35-421a-b31c-109014440371</host-nqn>
                    <io-queue-count>4</io-queue-count>
                    <io-queue-depth>18</io-queue-depth>
                    <subsystem>s1</subsystem>
                    <subsystem-uuid>ffede062-f762-11e7-ac91-00a098a3af76</subsystem-uuid>
                    <vserver>nv1</vserver>
                    <vserver-uuid>445abdde-f066-11e7-8053-00a098a3af76</vserver-uuid>
            </nvme-target-subsystem-host-info>
            <nvme-target-subsystem-host-info>
                    <host-nqn>nqn.2014-08.org.nvmexpress:nvmf:uuid:ef938fb1-1f35-421a-b31c-109014440371</host-nqn>
                    <io-queue-count>4</io-queue-count>
                    <io-queue-depth>18</io-queue-depth>
                    <subsystem>s2</subsystem>
                    <subsystem-uuid>98685d6c-f1d9-11e7-a0df-00a098a153c7</subsystem-uuid>
                    <vserver>nv1</vserver>
                    <vserver-uuid>445abdde-f066-11e7-8053-00a098a3af76</vserver-uuid>
            </nvme-target-subsystem-host-info>
            <nvme-target-subsystem-host-info>
                    <host-nqn>nqn.2014-08.org.nvmexpress:nvmf:uuid:6cfd4ef9-72f0-4ed1-9e96-45557d28462f</host-nqn>
                    <io-queue-count>4</io-queue-count>
                    <io-queue-depth>18</io-queue-depth>
                    <subsystem>s3</subsystem>
                    <subsystem-uuid>98b0643c-f1d9-11e7-a0df-00a098a153c7</subsystem-uuid>
                    <vserver>nv1</vserver>
                    <vserver-uuid>445abdde-f066-11e7-8053-00a098a3af76</vserver-uuid>
            </nvme-target-subsystem-host-info>
    </attributes-list>
    <num-records>3</num-records>

0 个答案:

没有答案