我有这个 xml 文件,我想将其转换为数据框:
数据.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <graph_data xmlns:ns2="http://www.w3.org/2005/Atom">
<graph_property name="calculation_method" value="Geo Mean" />
<graph_property name="graph_type" value="TIME" />
- <measurement id="521406">
<alias>site4</alias>
- <bucket_data>
- <bucket id="1" name="2013-MAY-14 07:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="21" />
<perf_data unit="seconds" value="3.102" />
</bucket>
- <bucket id="2" name="2013-MAY-14 08:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="13" />
<perf_data unit="seconds" value="3.052" />
</bucket>
- <bucket id="3" name="2013-MAY-14 09:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="15" />
<perf_data unit="seconds" value="3.387" />
</bucket>
- <bucket id="4" name="2013-MAY-14 10:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="15" />
<perf_data unit="seconds" value="3.338" />
</bucket>
- <bucket id="5" name="2013-MAY-14 11:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="10" />
<perf_data unit="seconds" value="2.149" />
</bucket>
- <bucket id="6" name="2013-MAY-14 12:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="13" />
<perf_data unit="seconds" value="3.202" />
</bucket>
- <bucket id="7" name="2013-MAY-14 01:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="18" />
<perf_data unit="seconds" value="2.883" />
</bucket>
- <bucket id="8" name="2013-MAY-14 02:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="11" />
<perf_data unit="seconds" value="2.582" />
</bucket>
- <bucket id="9" name="2013-MAY-14 03:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="15" />
<perf_data unit="seconds" value="2.769" />
</bucket>
- <bucket id="10" name="2013-MAY-14 04:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="12" />
<perf_data unit="seconds" value="2.669" />
</bucket>
- <bucket id="11" name="2013-MAY-14 05:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="17" />
<perf_data unit="seconds" value="2.830" />
</bucket>
- <bucket id="12" name="2013-MAY-14 06:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="12" />
<perf_data unit="seconds" value="2.591" />
</bucket>
- <bucket id="13" name="2013-MAY-14 07:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="17" />
<perf_data unit="seconds" value="3.213" />
</bucket>
- <bucket id="14" name="2013-MAY-14 08:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="10" />
<perf_data unit="seconds" value="2.653" />
</bucket>
- <bucket id="15" name="2013-MAY-14 09:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="15" />
<perf_data unit="seconds" value="2.935" />
</bucket>
- <bucket id="16" name="2013-MAY-14 10:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="18" />
<perf_data unit="seconds" value="2.495" />
</bucket>
- <bucket id="17" name="2013-MAY-14 11:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="10" />
<perf_data unit="seconds" value="3.169" />
</bucket>
- <bucket id="18" name="2013-MAY-15 12:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="16" />
<perf_data unit="seconds" value="2.789" />
</bucket>
- <bucket id="19" name="2013-MAY-15 01:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="16" />
<perf_data unit="seconds" value="3.245" />
</bucket>
- <bucket id="20" name="2013-MAY-15 02:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="17" />
<perf_data unit="seconds" value="3.281" />
</bucket>
- <bucket id="21" name="2013-MAY-15 03:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="12" />
<perf_data unit="seconds" value="3.773" />
</bucket>
- <bucket id="22" name="2013-MAY-15 04:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="21" />
<perf_data unit="seconds" value="2.648" />
</bucket>
- <bucket id="23" name="2013-MAY-15 05:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="11" />
<perf_data unit="seconds" value="3.291" />
</bucket>
- <bucket id="24" name="2013-MAY-15 06:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="12" />
<perf_data unit="seconds" value="3.084" />
</bucket>
</bucket_data>
- <graph_option>
<data_cell name="perfwarning" unit="seconds" value="-" />
<data_cell name="perfcritical" unit="seconds" value="-" />
<data_cell name="availwarning" unit="percent" value="-" />
<data_cell name="availcritical" unit="percent" value="-" />
<data_cell name="bucketsize" unit="seconds" value="3600" />
<data_cell name="rows" unit="#" value="24" />
<data_cell name="pagecomponent" unit="seconds" value="Total Time" />
<data_cell name="avg_perf" unit="seconds" value="2.949" />
<data_cell name="avg_avail" unit="percent" value="100.00" />
<data_cell name="total_datapoint_count" unit="#" value="347" />
<data_cell />
</graph_option>
</measurement>
- <measurement id="521406">
<alias>Site3</alias>
- <bucket_data>
- <bucket id="1" name="2013-MAY-14 07:00 AM">
<avail_data unit="percent" value="85.71" />
<data_count unit="#" value="18" />
<perf_data unit="seconds" value="6.503" />
</bucket>
- <bucket id="2" name="2013-MAY-14 08:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="13" />
<perf_data unit="seconds" value="6.330" />
</bucket>
- <bucket id="3" name="2013-MAY-14 09:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="15" />
<perf_data unit="seconds" value="7.242" />
</bucket>
- <bucket id="4" name="2013-MAY-14 10:00 AM">
<avail_data unit="percent" value="93.33" />
<data_count unit="#" value="14" />
<perf_data unit="seconds" value="7.083" />
</bucket>
- <bucket id="5" name="2013-MAY-14 11:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="10" />
<perf_data unit="seconds" value="7.087" />
</bucket>
- <bucket id="6" name="2013-MAY-14 12:00 PM">
<avail_data unit="percent" value="76.92" />
<data_count unit="#" value="10" />
<perf_data unit="seconds" value="6.197" />
</bucket>
- <bucket id="7" name="2013-MAY-14 01:00 PM">
<avail_data unit="percent" value="83.33" />
<data_count unit="#" value="15" />
<perf_data unit="seconds" value="6.772" />
</bucket>
- <bucket id="8" name="2013-MAY-14 02:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="11" />
<perf_data unit="seconds" value="5.832" />
</bucket>
- <bucket id="9" name="2013-MAY-14 03:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="15" />
<perf_data unit="seconds" value="8.513" />
</bucket>
- <bucket id="10" name="2013-MAY-14 04:00 PM">
<avail_data unit="percent" value="91.67" />
<data_count unit="#" value="11" />
<perf_data unit="seconds" value="7.190" />
</bucket>
- <bucket id="11" name="2013-MAY-14 05:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="17" />
<perf_data unit="seconds" value="6.373" />
</bucket>
- <bucket id="12" name="2013-MAY-14 06:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="12" />
<perf_data unit="seconds" value="8.440" />
</bucket>
- <bucket id="13" name="2013-MAY-14 07:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="17" />
<perf_data unit="seconds" value="6.318" />
</bucket>
- <bucket id="14" name="2013-MAY-14 08:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="10" />
<perf_data unit="seconds" value="6.374" />
</bucket>
- <bucket id="15" name="2013-MAY-14 09:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="15" />
<perf_data unit="seconds" value="6.773" />
</bucket>
- <bucket id="16" name="2013-MAY-14 10:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="18" />
<perf_data unit="seconds" value="6.274" />
</bucket>
- <bucket id="17" name="2013-MAY-14 11:00 PM">
<avail_data unit="percent" value="90.00" />
<data_count unit="#" value="9" />
<perf_data unit="seconds" value="5.881" />
</bucket>
- <bucket id="18" name="2013-MAY-15 12:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="16" />
<perf_data unit="seconds" value="5.630" />
</bucket>
- <bucket id="19" name="2013-MAY-15 01:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="16" />
<perf_data unit="seconds" value="6.585" />
</bucket>
- <bucket id="20" name="2013-MAY-15 02:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="17" />
<perf_data unit="seconds" value="7.394" />
</bucket>
- <bucket id="21" name="2013-MAY-15 03:00 AM">
<avail_data unit="percent" value="91.67" />
<data_count unit="#" value="11" />
<perf_data unit="seconds" value="6.427" />
</bucket>
- <bucket id="22" name="2013-MAY-15 04:00 AM">
<avail_data unit="percent" value="95.24" />
<data_count unit="#" value="20" />
<perf_data unit="seconds" value="7.140" />
</bucket>
- <bucket id="23" name="2013-MAY-15 05:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="11" />
<perf_data unit="seconds" value="7.152" />
</bucket>
- <bucket id="24" name="2013-MAY-15 06:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="12" />
<perf_data unit="seconds" value="6.474" />
</bucket>
</bucket_data>
- <graph_option>
<data_cell name="perfwarning" unit="seconds" value="-" />
<data_cell name="perfcritical" unit="seconds" value="-" />
<data_cell name="availwarning" unit="percent" value="-" />
<data_cell name="availcritical" unit="percent" value="-" />
<data_cell name="bucketsize" unit="seconds" value="3600" />
<data_cell name="rows" unit="#" value="24" />
<data_cell name="pagecomponent" unit="seconds" value="Total Time" />
<data_cell name="avg_perf" unit="seconds" value="6.729" />
<data_cell name="avg_avail" unit="percent" value="95.97" />
<data_cell name="total_datapoint_count" unit="#" value="347" />
<data_cell />
</graph_option>
</measurement>
- <measurement id="521406">
<alias>Site2</alias>
- <bucket_data>
- <bucket id="1" name="2013-MAY-14 07:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="18" />
<perf_data unit="seconds" value="2.247" />
</bucket>
- <bucket id="2" name="2013-MAY-14 08:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="13" />
<perf_data unit="seconds" value="2.382" />
</bucket>
- <bucket id="3" name="2013-MAY-14 09:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="15" />
<perf_data unit="seconds" value="2.232" />
</bucket>
- <bucket id="4" name="2013-MAY-14 10:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="14" />
<perf_data unit="seconds" value="2.223" />
</bucket>
- <bucket id="5" name="2013-MAY-14 11:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="10" />
<perf_data unit="seconds" value="2.265" />
</bucket>
- <bucket id="6" name="2013-MAY-14 12:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="10" />
<perf_data unit="seconds" value="2.130" />
</bucket>
- <bucket id="7" name="2013-MAY-14 01:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="15" />
<perf_data unit="seconds" value="2.153" />
</bucket>
- <bucket id="8" name="2013-MAY-14 02:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="11" />
<perf_data unit="seconds" value="2.005" />
</bucket>
- <bucket id="9" name="2013-MAY-14 03:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="15" />
<perf_data unit="seconds" value="2.322" />
</bucket>
- <bucket id="10" name="2013-MAY-14 04:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="11" />
<perf_data unit="seconds" value="1.918" />
</bucket>
- <bucket id="11" name="2013-MAY-14 05:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="17" />
<perf_data unit="seconds" value="1.992" />
</bucket>
- <bucket id="12" name="2013-MAY-14 06:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="12" />
<perf_data unit="seconds" value="2.423" />
</bucket>
- <bucket id="13" name="2013-MAY-14 07:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="17" />
<perf_data unit="seconds" value="2.327" />
</bucket>
- <bucket id="14" name="2013-MAY-14 08:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="10" />
<perf_data unit="seconds" value="2.605" />
</bucket>
- <bucket id="15" name="2013-MAY-14 09:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="15" />
<perf_data unit="seconds" value="2.533" />
</bucket>
- <bucket id="16" name="2013-MAY-14 10:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="18" />
<perf_data unit="seconds" value="2.077" />
</bucket>
- <bucket id="17" name="2013-MAY-14 11:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="9" />
<perf_data unit="seconds" value="2.356" />
</bucket>
- <bucket id="18" name="2013-MAY-15 12:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="16" />
<perf_data unit="seconds" value="2.506" />
</bucket>
- <bucket id="19" name="2013-MAY-15 01:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="16" />
<perf_data unit="seconds" value="2.422" />
</bucket>
- <bucket id="20" name="2013-MAY-15 02:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="17" />
<perf_data unit="seconds" value="2.220" />
</bucket>
- <bucket id="21" name="2013-MAY-15 03:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="11" />
<perf_data unit="seconds" value="2.669" />
</bucket>
- <bucket id="22" name="2013-MAY-15 04:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="20" />
<perf_data unit="seconds" value="2.274" />
</bucket>
- <bucket id="23" name="2013-MAY-15 05:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="11" />
<perf_data unit="seconds" value="2.277" />
</bucket>
- <bucket id="24" name="2013-MAY-15 06:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="12" />
<perf_data unit="seconds" value="2.180" />
</bucket>
</bucket_data>
- <graph_option>
<data_cell name="perfwarning" unit="seconds" value="-" />
<data_cell name="perfcritical" unit="seconds" value="-" />
<data_cell name="availwarning" unit="percent" value="-" />
<data_cell name="availcritical" unit="percent" value="-" />
<data_cell name="bucketsize" unit="seconds" value="3600" />
<data_cell name="rows" unit="#" value="24" />
<data_cell name="pagecomponent" unit="seconds" value="Total Time" />
<data_cell name="avg_perf" unit="seconds" value="2.269" />
<data_cell name="avg_avail" unit="percent" value="100.00" />
<data_cell name="total_datapoint_count" unit="#" value="333" />
<data_cell />
</graph_option>
</measurement>
- <measurement id="521406">
<alias>Site1</alias>
- <bucket_data>
- <bucket id="1" name="2013-MAY-14 07:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="18" />
<perf_data unit="seconds" value="1.431" />
</bucket>
- <bucket id="2" name="2013-MAY-14 08:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="13" />
<perf_data unit="seconds" value="1.559" />
</bucket>
- <bucket id="3" name="2013-MAY-14 09:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="15" />
<perf_data unit="seconds" value="1.378" />
</bucket>
- <bucket id="4" name="2013-MAY-14 10:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="14" />
<perf_data unit="seconds" value="1.307" />
</bucket>
- <bucket id="5" name="2013-MAY-14 11:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="10" />
<perf_data unit="seconds" value="1.458" />
</bucket>
- <bucket id="6" name="2013-MAY-14 12:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="10" />
<perf_data unit="seconds" value="1.345" />
</bucket>
- <bucket id="7" name="2013-MAY-14 01:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="15" />
<perf_data unit="seconds" value="1.317" />
</bucket>
- <bucket id="8" name="2013-MAY-14 02:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="11" />
<perf_data unit="seconds" value="1.465" />
</bucket>
- <bucket id="9" name="2013-MAY-14 03:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="15" />
<perf_data unit="seconds" value="1.398" />
</bucket>
- <bucket id="10" name="2013-MAY-14 04:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="11" />
<perf_data unit="seconds" value="1.509" />
</bucket>
- <bucket id="11" name="2013-MAY-14 05:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="17" />
<perf_data unit="seconds" value="1.284" />
</bucket>
- <bucket id="12" name="2013-MAY-14 06:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="12" />
<perf_data unit="seconds" value="1.759" />
</bucket>
- <bucket id="13" name="2013-MAY-14 07:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="17" />
<perf_data unit="seconds" value="1.434" />
</bucket>
- <bucket id="14" name="2013-MAY-14 08:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="10" />
<perf_data unit="seconds" value="1.402" />
</bucket>
- <bucket id="15" name="2013-MAY-14 09:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="15" />
<perf_data unit="seconds" value="1.452" />
</bucket>
- <bucket id="16" name="2013-MAY-14 10:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="18" />
<perf_data unit="seconds" value="1.216" />
</bucket>
- <bucket id="17" name="2013-MAY-14 11:00 PM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="9" />
<perf_data unit="seconds" value="1.381" />
</bucket>
- <bucket id="18" name="2013-MAY-15 12:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="16" />
<perf_data unit="seconds" value="1.236" />
</bucket>
- <bucket id="19" name="2013-MAY-15 01:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="16" />
<perf_data unit="seconds" value="1.327" />
</bucket>
- <bucket id="20" name="2013-MAY-15 02:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="17" />
<perf_data unit="seconds" value="1.465" />
</bucket>
- <bucket id="21" name="2013-MAY-15 03:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="11" />
<perf_data unit="seconds" value="1.529" />
</bucket>
- <bucket id="22" name="2013-MAY-15 04:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="20" />
<perf_data unit="seconds" value="1.354" />
</bucket>
- <bucket id="23" name="2013-MAY-15 05:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="11" />
<perf_data unit="seconds" value="1.372" />
</bucket>
- <bucket id="24" name="2013-MAY-15 06:00 AM">
<avail_data unit="percent" value="100.00" />
<data_count unit="#" value="12" />
<perf_data unit="seconds" value="1.219" />
</bucket>
</bucket_data>
- <graph_option>
<data_cell name="perfwarning" unit="seconds" value="-" />
<data_cell name="perfcritical" unit="seconds" value="-" />
<data_cell name="availwarning" unit="percent" value="-" />
<data_cell name="availcritical" unit="percent" value="-" />
<data_cell name="bucketsize" unit="seconds" value="3600" />
<data_cell name="rows" unit="#" value="24" />
<data_cell name="pagecomponent" unit="seconds" value="Total Time" />
<data_cell name="avg_perf" unit="seconds" value="1.387" />
<data_cell name="avg_avail" unit="percent" value="100.00" />
<data_cell name="total_datapoint_count" unit="#" value="333" />
<data_cell />
</graph_option>
</measurement>
<ns2:link href="www.example.com" rel="slotmetadata" type="application/xml" />
</graph_data>
我的数据框需要如下所示:
alias bucket_name avail_data perf_data
我试过这个:
doc1 = xmlParse("data.xml")
df<-xmlToDataFrame(nodes = getNodeSet(doc1, "//alias"))
我只在一个列数据框中获取别名。任何想法我在这里还缺少什么?
有文件