javascript读取xml

<ROOT>
    <THROUGHPUT>
        <PBUFLEN64>
            <ITEMS>
                <Date>2018-7-9</Date>
                <TestItem>Dual port throughput and latency test</TestItem>
                <TestModule>2C2T</TestModule>
                <PktLen>64</PktLen>
                <Throughput>1.2</Throughput>
                <RxMinLatency>2</RxMinLatency>
                <RxAvgLatency>123</RxAvgLatency>
                <RxMaxLatency>1212</RxMaxLatency>
                <Reference>1.5</Reference>
                <RxAvgReference>133.00</RxAvgReference>
            </ITEMS>
            <ITEMS>
                <Date>2018-7-10</Date>
                <TestItem>Dual port throughput and latency test</TestItem>
                <TestModule>2C2T</TestModule>
                <PktLen>64</PktLen>
                <Throughput>1.2</Throughput>
                <RxMinLatency>2</RxMinLatency>
                <RxAvgLatency>123</RxAvgLatency>
                <RxMaxLatency>1212</RxMaxLatency>
                <Reference>1.5</Reference>
                <RxAvgReference>133.00</RxAvgReference>
            </ITEMS>
        </PBUFLEN64>
        <PBUFLEN128>
            <ITEMS>
                <Date>2018-7-9</Date>
                <TestItem>Dual port throughput and latency test</TestItem>
                <TestModule>2C2T</TestModule>
                <PktLen>128</PktLen>
                <Throughput>1.2</Throughput>
                <RxMinLatency>2</RxMinLatency>
                <RxAvgLatency>123</RxAvgLatency>
                <RxMaxLatency>1212</RxMaxLatency>
                <Reference>1.5</Reference>
                <RxAvgReference>133.00</RxAvgReference>
            </ITEMS>
            <ITEMS>
                <Date>2018-7-10</Date>
                <TestItem>Dual port throughput and latency test</TestItem>
                <TestModule>2C2T</TestModule>
                <PktLen>128</PktLen>
                <Throughput>1.2</Throughput>
                <RxMinLatency>2</RxMinLatency>
                <RxAvgLatency>123</RxAvgLatency>
                <RxMaxLatency>1212</RxMaxLatency>
                <Reference>1.5</Reference>
                <RxAvgReference>133.00</RxAvgReference>
            </ITEMS>
        </PBUFLEN128>
    </THROUGHPUT>
    <CYCLE>
        <PORT0PBUFLEN64>
            <ITEMS>
                <Date>2018-7-10</Date>
                <TestItem>Port receive and send packet cycle test</TestItem>
                <TestModule>2C2T</TestModule>
                <PortId>0</PortId>
                <PktLen>64</PktLen>
                <Rx>123</Rx>
                <Tx>123</Tx>
                <RxReference>133.00</RxReference>
                <TxReference>133.50</TxReference>
            </ITEMS>
            <ITEMS>
                <Date>2018-7-10</Date>
                <TestItem>Port receive and send packet cycle test</TestItem>
                <TestModule>2C2T</TestModule>
                <PortId>0</PortId>
                <PktLen>64</PktLen>
                <Rx>123</Rx>
                <Tx>123</Tx>
                <RxReference>133.00</RxReference>
                <TxReference>133.50</TxReference>
            </ITEMS>
        </PORT0PBUFLEN64>
        <PORT1PBUFLEN64>
            <ITEMS>
                <Date>2018-7-10</Date>
                <TestItem>Port receive and send packet cycle test</TestItem>
                <TestModule>2C2T</TestModule>
                <PortId>1</PortId>
                <PktLen>64</PktLen>
                <Rx>123</Rx>
                <Tx>123</Tx>
                <RxReference>133.00</RxReference>
                <TxReference>133.50</TxReference>
            </ITEMS>
            <ITEMS>
                <Date>2018-7-10</Date>
                <TestItem>Port receive and send packet cycle test</TestItem>
                <TestModule>2C2T</TestModule>
                <PortId>1</PortId>
                <PktLen>64</PktLen>
                <Rx>123</Rx>
                <Tx>123</Tx>
                <RxReference>133.00</RxReference>
                <TxReference>133.50</TxReference>
            </ITEMS>
        </PORT1PBUFLEN64>
        <PORT0PBUFLEN128>
            <ITEMS>
                <Date>2018-7-10</Date>
                <TestItem>Port receive and send packet cycle test</TestItem>
                <TestModule>2C2T</TestModule>
                <PortId>0</PortId>
                <PktLen>128</PktLen>
                <Rx>123</Rx>
                <Tx>123</Tx>
                <RxReference>133.00</RxReference>
                <TxReference>133.50</TxReference>
            </ITEMS>
            <ITEMS>
                <Date>2018-7-10</Date>
                <TestItem>Port receive and send packet cycle test</TestItem>
                <TestModule>2C2T</TestModule>
                <PortId>0</PortId>
                <PktLen>128</PktLen>
                <Rx>123</Rx>
                <Tx>123</Tx>
                <RxReference>133.00</RxReference>
                <TxReference>133.50</TxReference>
            </ITEMS>
        </PORT0PBUFLEN128>
        <PORT1PBUFLEN128>
            <ITEMS>
                <Date>2018-7-10</Date>
                <TestItem>Port receive and send packet cycle test</TestItem>
                <TestModule>2C2T</TestModule>
                <PortId>1</PortId>
                <PktLen>128</PktLen>
                <Rx>123</Rx>
                <Tx>123</Tx>
                <RxReference>133.00</RxReference>
                <TxReference>133.50</TxReference>
            </ITEMS>
            <ITEMS>
                <Date>2018-7-11</Date>
                <TestItem>Port receive and send packet cycle test</TestItem>
                <TestModule>2C2T</TestModule>
                <PortId>1</PortId>
                <PktLen>128</PktLen>
                <Rx>123</Rx>
                <Tx>123</Tx>
                <RxReference>133.00</RxReference>
                <TxReference>133.50</TxReference>
            </ITEMS>
        </PORT1PBUFLEN128>
    </CYCLE>

</ROOT>

第一组,Throughput,Reference的数据获取组成一个折线型,取遍所有ITEMS;PBUFLEN64和PBUFLEN128取值为BufLen 64字节、128字节,作为控件,图形数据切换

第二组,RxAvgLatency,RxAvgReference的数据获取组成一个折线型,与第一组相似要求

第三组,控件为RX/TX,BufLen为64/128,PortId 0/1切换,如Rx,64,0,那就取值PortId" value="0",PktLen" value="64"的Rx和RxRxReference值,取遍所有item,如上item为两个,画出折线形

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值