0
<?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>

How do I extract data from the above given XML file. I want the data to be in this format I want my data to be extracted and to get it in this tabular form

I want to create an R data frame with the columns of RollNo, StudentWeight, StudentMarks

Thanks for the help

Tappy
  • 1
  • 1
  • See: https://www.tutorialspoint.com/r/r_xml_files.htm – NoChance Jun 07 '18 at 11:34
  • Thank You @NoChance but I had gone through this post. My problem is that the value/data I want to fill in the different columns are at different nodes. The values are present in the node and My column names are present in the node. I have gone through these links https://stackoverflow.com/questions/13579996/how-to-create-an-r-data-frame-from-a-xml-file and https://stackoverflow.com/questions/17198658/how-to-parse-xml-to-r-data-frame, but when I am trying to extract the values and keep it in R dataframe, its showing "no rows,no columns" – Tappy Jun 07 '18 at 11:42
  • Are there other `` nodes? For XML questions, always post a sequence, 1-3 repetitions of nodes, so we can decipher pattern. Also, your xml has a broken tag at the start. – Parfait Jun 07 '18 at 14:04

0 Answers0