我正在尝试使用R中的XMLToDataFrame命令来导入xml文件。该命令适用于某些xml文件,但不适用于此文件:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<reservationDetailsResponse xmlns="http://webservices.sixt.de/webservices/franchise/1.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<reservation>
<reservationNo>983647001</reservationNo>
<securityCode>381f0977</securityCode>
<reference1 xsi:nil="true"/>
<reference2 xsi:nil="true"/>
<status>RS</status>
<revision xsi:nil="true"/>
<language>en_US</language>
<group>CDM</group>
<duration>3</duration>
<voucherDays xsi:nil="true"/>
<isLongterm>false</isLongterm>
<hasOwnInsurance>false</hasOwnInsurance>
<vipStatus xsi:nil="true"/>
<customerRemark xsi:nil="true"/>
<stationRemark xsi:nil="true"/>
<flightNo xsi:nil="true"/>
<bonusProgramNo xsi:nil="true"/>
<hasOnlinePaymentGuarantee>false</hasOnlinePaymentGuarantee>
<origin>
<dateTime>2016-3-01T01:36:14</dateTime>
<channel>INTERNET</channel>
</origin>
<rate>
<code>ISU000</code>
<plan>1</plan>
<rebate>0</rebate>
<isPrepaid>false</isPrepaid>
<corpNo xsi:nil="true"/>
</rate>
<pickup>
<dateTime>2014-07-04T10:00:00</dateTime>
<station>
<stationID>895</stationID>
<name>Reykja</name>
</station>
</pickup>
<return>
<dateTime>2014-07-07T10:00:00</dateTime>
<station>
<stationID>895</stationID>
<name>Reykjavik</name>
</station>
</return>
<delivery xsi:nil="true"/>
<collection xsi:nil="true"/>
<firstDriver>
<birthday>1957-05-08</birthday>
<passportNo>462825</passportNo>
<contact>
<phone>+1-508-59156</phone>
<mobile xsi:nil="true"/>
<email>maria.ursen@gmail.com</email>
<fax xsi:nil="true"/>
</contact>
<license>
<licenseNo>S658872</licenseNo>
<date>2014-04-11</date>
<city>Massetts</city>
<country xsi:nil="true"/>
</license>
<name1>NICSEN</name1>
<name2>BE</name2>
<address>
<street>145 Souttreet</street>
<zipCode>068</zipCode>
<city>Upton</city>
<state>MA</state>
<country>US</country>
</address>
</firstDriver>
<secondDriver>
<birthday xsi:nil="true"/>
<passportNo xsi:nil="true"/>
<contact xsi:nil="true"/>
<license xsi:nil="true"/>
<name1>ADD_DRIVER</name1>
<name2 xsi:nil="true"/>
<address xsi:nil="true"/>
</secondDriver>
<forbidden xsi:nil="true"/>
<included xsi:nil="true"/>
<booked>
<extra>
<code>T</code>
<name>Rentaays</name>
<booked>1</booked>
<charged>3</charged>
<price>
<currency>EUR</currency>
<netAmount>62.54</netAmount>
<vatPercent>24.00</vatPercent>
</price>
</extra>
<extra>
<code>AD</code>
<name>Additional driver</name>
<booked>1</booked>
<charged>3</charged>
<price>
<currency>EUR</currency>
<netAmount>4.03</netAmount>
<vatPercent>24.00</vatPercent>
</price>
</extra>
</booked>
<total>
<dueAmount>0.00</dueAmount>
<grossAmount>247.64</grossAmount>
<vatAmount>47.93</vatAmount>
<currency>EUR</currency>
<netAmount>199.71</netAmount>
<vatPercent>24.00</vatPercent>
</total>
<payment>
<type>VI</type>
<corpNo xsi:nil="true"/>
<expressNo xsi:nil="true"/>
<taxNo xsi:nil="true"/>
<pickupNativeCurrency xsi:nil="true"/>
<ccNativeCurrency xsi:nil="true"/>
</payment>
<invoice xsi:nil="true"/>
<split xsi:nil="true"/>
<prepaid xsi:nil="true"/>
<voucher xsi:nil="true"/>
<beneficiary xsi:nil="true"/>
</reservation>
xml文件中还有许多保留(重复),但我只粘贴了第一部分。我得到的错误是:
Error in `[<-.data.frame`(`*tmp*`, i, names(nodes[[i]]), value = c("9836472687", :
duplicate subscripts for columns
这是我使用命令的方式:
xmlToDataFrame("C:/Users/Davíð Freyr/Documents/xml_file.xml", c("integer", "integer", "numeric"))
我的计划是将多个xml文件导入到R中的一个data.frame中。使用R中的数据并最终将其导入到excel中。他们可能是一个命令,我可以将多个xml文件合并到一个R data.frame吗?
提前致谢