如何从R中的XML中提取数据

时间:2018-06-07 11:32:34

标签: r xml

<?xml version="1.0" encoding="UTF-8"?>
<logs 
<log School="ABC" SchoolNo="6KF" SchoolLog="232KKJH14" SchoolSource="Server">
<Type>Education</Type>
<SchoolNo>School3</SchoolNo>
<nameLog>StudentsSchool</nameLog>
<logHeader>
  <serviceCompany>ServiceCompany</serviceCompany>
  <runNumber>10</runNumber>
  <creationDate>2007-02-17T10:07:18.0000000+01:00</creationDate>
  <indexType>RollNo</indexType>
  <startIndex>1</startIndex>
  <endIndex>200</endIndex>
  <direction>Increasing</direction>
  <indexCurve>RollNo</indexCurve>
  <stepIncrement>0</stepIncrement>
  <indexUnits>m</indexUnits>
  <logCurveInfo>
    <mnemonic>RollNo</mnemonic>
    <unit>m</unit>
    <startIndex>1</startIndex>
    <endIndex>200</endIndex>
    <columnIndex>1</columnIndex>
    <Description>Students Roll No.</Description>
    <typeLogData>Double</typeLogData>
  </logCurveInfo>
  <logCurveInfo>
    <mnemonic>StudentWeight</mnemonic>
    <unit>m</unit>
    <startIndex>1</startIndex>
    <endIndex>200</endIndex>
    <columnIndex>2</columnIndex>
    <Description>Weight of the Students</Description>
    <typeLogData>Double</typeLogData>
  </logCurveInfo>
  <logCurveInfo>
    <mnemonic>StudentMarks</mnemonic>
    <unit>n</unit>
    <startIndex>1</startIndex>
    <endIndex>200</endIndex>
    <columnIndex>3</columnIndex>
    <Description>Marks secured by the Students</Description>
    <typeLogData>Double</typeLogData>
  </logCurveInfo>
</logHeader>
<logData>
<data>1,56,89
</data>
</logData>
</log>
</logs>

如何从上面给出的XML文件中提取数据。 我希望数据采用这种格式I want my data to be extracted and to get it in this tabular form

我想创建一个包含RollNo,StudentWeight,StudentMarks列的R数据框

感谢您的帮助

0 个答案:

没有答案