title: XML data to R dataframes
body: <p>I have a XML file which was returned by a java application to find the optimal route in a transportation problem. Want to use this output file in R. I have used "XML" package in R. IN the XML file there is a node called "VehicleList", if possible just the path of each vehicle is also sufficient.</p>
  
  <p>XML FILE:</p>
  
  <pre><code>&lt;VrpVehicleRoutingSolution id="1"&gt;
    &lt;id&gt;0&lt;/id&gt;
    &lt;name&gt;A-n33-k6&lt;/name&gt;
    &lt;distanceType&gt;AIR_DISTANCE&lt;/distanceType&gt;
    &lt;distanceUnitOfMeasurement&gt;distance&lt;/distanceUnitOfMeasurement&gt;
    &lt;locationList id="2"&gt;
      &lt;VrpAirLocation id="3"&gt;
        &lt;id&gt;1&lt;/id&gt;
        &lt;latitude&gt;34.0&lt;/latitude&gt;
        &lt;longitude&gt;31.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="4"&gt;
        &lt;id&gt;2&lt;/id&gt;
        &lt;latitude&gt;45.0&lt;/latitude&gt;
        &lt;longitude&gt;55.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="5"&gt;
        &lt;id&gt;3&lt;/id&gt;
        &lt;latitude&gt;70.0&lt;/latitude&gt;
        &lt;longitude&gt;80.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="6"&gt;
        &lt;id&gt;4&lt;/id&gt;
        &lt;latitude&gt;81.0&lt;/latitude&gt;
        &lt;longitude&gt;70.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="7"&gt;
        &lt;id&gt;5&lt;/id&gt;
        &lt;latitude&gt;85.0&lt;/latitude&gt;
        &lt;longitude&gt;61.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="8"&gt;
        &lt;id&gt;6&lt;/id&gt;
        &lt;latitude&gt;59.0&lt;/latitude&gt;
        &lt;longitude&gt;55.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="9"&gt;
        &lt;id&gt;7&lt;/id&gt;
        &lt;latitude&gt;45.0&lt;/latitude&gt;
        &lt;longitude&gt;60.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="10"&gt;
        &lt;id&gt;8&lt;/id&gt;
        &lt;latitude&gt;50.0&lt;/latitude&gt;
        &lt;longitude&gt;64.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="11"&gt;
        &lt;id&gt;9&lt;/id&gt;
        &lt;latitude&gt;80.0&lt;/latitude&gt;
        &lt;longitude&gt;64.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="12"&gt;
        &lt;id&gt;10&lt;/id&gt;
        &lt;latitude&gt;75.0&lt;/latitude&gt;
        &lt;longitude&gt;90.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="13"&gt;
        &lt;id&gt;11&lt;/id&gt;
        &lt;latitude&gt;25.0&lt;/latitude&gt;
        &lt;longitude&gt;40.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="14"&gt;
        &lt;id&gt;12&lt;/id&gt;
        &lt;latitude&gt;9.0&lt;/latitude&gt;
        &lt;longitude&gt;66.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="15"&gt;
        &lt;id&gt;13&lt;/id&gt;
        &lt;latitude&gt;1.0&lt;/latitude&gt;
        &lt;longitude&gt;44.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="16"&gt;
        &lt;id&gt;14&lt;/id&gt;
        &lt;latitude&gt;50.0&lt;/latitude&gt;
        &lt;longitude&gt;54.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="17"&gt;
        &lt;id&gt;15&lt;/id&gt;
        &lt;latitude&gt;35.0&lt;/latitude&gt;
        &lt;longitude&gt;45.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="18"&gt;
        &lt;id&gt;16&lt;/id&gt;
        &lt;latitude&gt;71.0&lt;/latitude&gt;
        &lt;longitude&gt;84.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="19"&gt;
        &lt;id&gt;17&lt;/id&gt;
        &lt;latitude&gt;1.0&lt;/latitude&gt;
        &lt;longitude&gt;9.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="20"&gt;
        &lt;id&gt;18&lt;/id&gt;
        &lt;latitude&gt;25.0&lt;/latitude&gt;
        &lt;longitude&gt;54.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="21"&gt;
        &lt;id&gt;19&lt;/id&gt;
        &lt;latitude&gt;45.0&lt;/latitude&gt;
        &lt;longitude&gt;59.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="22"&gt;
        &lt;id&gt;20&lt;/id&gt;
        &lt;latitude&gt;45.0&lt;/latitude&gt;
        &lt;longitude&gt;71.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="23"&gt;
        &lt;id&gt;21&lt;/id&gt;
        &lt;latitude&gt;66.0&lt;/latitude&gt;
        &lt;longitude&gt;84.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="24"&gt;
        &lt;id&gt;22&lt;/id&gt;
        &lt;latitude&gt;11.0&lt;/latitude&gt;
        &lt;longitude&gt;35.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="25"&gt;
        &lt;id&gt;23&lt;/id&gt;
        &lt;latitude&gt;81.0&lt;/latitude&gt;
        &lt;longitude&gt;46.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="26"&gt;
        &lt;id&gt;24&lt;/id&gt;
        &lt;latitude&gt;85.0&lt;/latitude&gt;
        &lt;longitude&gt;10.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="27"&gt;
        &lt;id&gt;25&lt;/id&gt;
        &lt;latitude&gt;75.0&lt;/latitude&gt;
        &lt;longitude&gt;20.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="28"&gt;
        &lt;id&gt;26&lt;/id&gt;
        &lt;latitude&gt;15.0&lt;/latitude&gt;
        &lt;longitude&gt;21.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="29"&gt;
        &lt;id&gt;27&lt;/id&gt;
        &lt;latitude&gt;90.0&lt;/latitude&gt;
        &lt;longitude&gt;45.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="30"&gt;
        &lt;id&gt;28&lt;/id&gt;
        &lt;latitude&gt;15.0&lt;/latitude&gt;
        &lt;longitude&gt;0.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="31"&gt;
        &lt;id&gt;29&lt;/id&gt;
        &lt;latitude&gt;31.0&lt;/latitude&gt;
        &lt;longitude&gt;26.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="32"&gt;
        &lt;id&gt;30&lt;/id&gt;
        &lt;latitude&gt;10.0&lt;/latitude&gt;
        &lt;longitude&gt;95.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="33"&gt;
        &lt;id&gt;31&lt;/id&gt;
        &lt;latitude&gt;6.0&lt;/latitude&gt;
        &lt;longitude&gt;6.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="34"&gt;
        &lt;id&gt;32&lt;/id&gt;
        &lt;latitude&gt;51.0&lt;/latitude&gt;
        &lt;longitude&gt;5.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
      &lt;VrpAirLocation id="35"&gt;
        &lt;id&gt;33&lt;/id&gt;
        &lt;latitude&gt;26.0&lt;/latitude&gt;
        &lt;longitude&gt;36.0&lt;/longitude&gt;
      &lt;/VrpAirLocation&gt;
    &lt;/locationList&gt;
    &lt;depotList id="36"&gt;
      &lt;VrpDepot id="37"&gt;
        &lt;id&gt;1&lt;/id&gt;
        &lt;location class="VrpAirLocation" reference="3"/&gt;
      &lt;/VrpDepot&gt;
    &lt;/depotList&gt;
    &lt;vehicleList id="38"&gt;
      &lt;VrpVehicle id="39"&gt;
        &lt;id&gt;0&lt;/id&gt;
        &lt;capacity&gt;100&lt;/capacity&gt;
        &lt;depot reference="37"/&gt;
        &lt;nextCustomer id="40"&gt;
          &lt;id&gt;33&lt;/id&gt;
          &lt;location class="VrpAirLocation" reference="35"/&gt;
          &lt;demand&gt;22&lt;/demand&gt;
          &lt;previousStandstill class="VrpVehicle" reference="39"/&gt;
          &lt;nextCustomer id="41"&gt;
            &lt;id&gt;11&lt;/id&gt;
            &lt;location class="VrpAirLocation" reference="13"/&gt;
            &lt;demand&gt;1&lt;/demand&gt;
            &lt;previousStandstill class="VrpCustomer" reference="40"/&gt;
            &lt;nextCustomer id="42"&gt;
              &lt;id&gt;12&lt;/id&gt;
              &lt;location class="VrpAirLocation" reference="14"/&gt;
              &lt;demand&gt;21&lt;/demand&gt;
              &lt;previousStandstill class="VrpCustomer" reference="41"/&gt;
              &lt;nextCustomer id="43"&gt;
                &lt;id&gt;30&lt;/id&gt;
                &lt;location class="VrpAirLocation" reference="32"/&gt;
                &lt;demand&gt;22&lt;/demand&gt;
                &lt;previousStandstill class="VrpCustomer" reference="42"/&gt;
                &lt;nextCustomer id="44"&gt;
                  &lt;id&gt;18&lt;/id&gt;
                  &lt;location class="VrpAirLocation" reference="20"/&gt;
                  &lt;demand&gt;17&lt;/demand&gt;
                  &lt;previousStandstill class="VrpCustomer" reference="43"/&gt;
                  &lt;vehicle reference="39"/&gt;
                &lt;/nextCustomer&gt;
                &lt;vehicle reference="39"/&gt;
              &lt;/nextCustomer&gt;
              &lt;vehicle reference="39"/&gt;
            &lt;/nextCustomer&gt;
            &lt;vehicle reference="39"/&gt;
          &lt;/nextCustomer&gt;
          &lt;vehicle reference="39"/&gt;
        &lt;/nextCustomer&gt;
      &lt;/VrpVehicle&gt;
      &lt;VrpVehicle id="45"&gt;
        &lt;id&gt;1&lt;/id&gt;
        &lt;capacity&gt;100&lt;/capacity&gt;
        &lt;depot reference="37"/&gt;
        &lt;nextCustomer id="46"&gt;
          &lt;id&gt;14&lt;/id&gt;
          &lt;location class="VrpAirLocation" reference="16"/&gt;
          &lt;demand&gt;25&lt;/demand&gt;
          &lt;previousStandstill class="VrpVehicle" reference="45"/&gt;
          &lt;nextCustomer id="47"&gt;
            &lt;id&gt;8&lt;/id&gt;
            &lt;location class="VrpAirLocation" reference="10"/&gt;
            &lt;demand&gt;15&lt;/demand&gt;
            &lt;previousStandstill class="VrpCustomer" reference="46"/&gt;
            &lt;nextCustomer id="48"&gt;
              &lt;id&gt;19&lt;/id&gt;
              &lt;location class="VrpAirLocation" reference="21"/&gt;
              &lt;demand&gt;17&lt;/demand&gt;
              &lt;previousStandstill class="VrpCustomer" reference="47"/&gt;
              &lt;nextCustomer id="49"&gt;
                &lt;id&gt;2&lt;/id&gt;
                &lt;location class="VrpAirLocation" reference="4"/&gt;
                &lt;demand&gt;26&lt;/demand&gt;
                &lt;previousStandstill class="VrpCustomer" reference="48"/&gt;
                &lt;nextCustomer id="50"&gt;
                  &lt;id&gt;15&lt;/id&gt;
                  &lt;location class="VrpAirLocation" reference="17"/&gt;
                  &lt;demand&gt;16&lt;/demand&gt;
                  &lt;previousStandstill class="VrpCustomer" reference="49"/&gt;
                  &lt;vehicle reference="45"/&gt;
                &lt;/nextCustomer&gt;
                &lt;vehicle reference="45"/&gt;
              &lt;/nextCustomer&gt;
              &lt;vehicle reference="45"/&gt;
            &lt;/nextCustomer&gt;
            &lt;vehicle reference="45"/&gt;
          &lt;/nextCustomer&gt;
          &lt;vehicle reference="45"/&gt;
        &lt;/nextCustomer&gt;
      &lt;/VrpVehicle&gt;
      &lt;VrpVehicle id="51"&gt;
        &lt;id&gt;2&lt;/id&gt;
        &lt;capacity&gt;100&lt;/capacity&gt;
        &lt;depot reference="37"/&gt;
        &lt;nextCustomer id="52"&gt;
          &lt;id&gt;13&lt;/id&gt;
          &lt;location class="VrpAirLocation" reference="15"/&gt;
          &lt;demand&gt;66&lt;/demand&gt;
          &lt;previousStandstill class="VrpVehicle" reference="51"/&gt;
          &lt;nextCustomer id="53"&gt;
            &lt;id&gt;22&lt;/id&gt;
            &lt;location class="VrpAirLocation" reference="24"/&gt;
            &lt;demand&gt;25&lt;/demand&gt;
            &lt;previousStandstill class="VrpCustomer" reference="52"/&gt;
            &lt;vehicle reference="51"/&gt;
          &lt;/nextCustomer&gt;
          &lt;vehicle reference="51"/&gt;
        &lt;/nextCustomer&gt;
      &lt;/VrpVehicle&gt;
      &lt;VrpVehicle id="54"&gt;
        &lt;id&gt;3&lt;/id&gt;
        &lt;capacity&gt;100&lt;/capacity&gt;
        &lt;depot reference="37"/&gt;
        &lt;nextCustomer id="55"&gt;
          &lt;id&gt;29&lt;/id&gt;
          &lt;location class="VrpAirLocation" reference="31"/&gt;
          &lt;demand&gt;21&lt;/demand&gt;
          &lt;previousStandstill class="VrpVehicle" reference="54"/&gt;
          &lt;nextCustomer id="56"&gt;
            &lt;id&gt;28&lt;/id&gt;
            &lt;location class="VrpAirLocation" reference="30"/&gt;
            &lt;demand&gt;11&lt;/demand&gt;
            &lt;previousStandstill class="VrpCustomer" reference="55"/&gt;
            &lt;nextCustomer id="57"&gt;
              &lt;id&gt;31&lt;/id&gt;
              &lt;location class="VrpAirLocation" reference="33"/&gt;
              &lt;demand&gt;25&lt;/demand&gt;
              &lt;previousStandstill class="VrpCustomer" reference="56"/&gt;
              &lt;nextCustomer id="58"&gt;
                &lt;id&gt;17&lt;/id&gt;
                &lt;location class="VrpAirLocation" reference="19"/&gt;
                &lt;demand&gt;7&lt;/demand&gt;
                &lt;previousStandstill class="VrpCustomer" reference="57"/&gt;
                &lt;nextCustomer id="59"&gt;
                  &lt;id&gt;26&lt;/id&gt;
                  &lt;location class="VrpAirLocation" reference="28"/&gt;
                  &lt;demand&gt;11&lt;/demand&gt;
                  &lt;previousStandstill class="VrpCustomer" reference="58"/&gt;
                  &lt;vehicle reference="54"/&gt;
                &lt;/nextCustomer&gt;
                &lt;vehicle reference="54"/&gt;
              &lt;/nextCustomer&gt;
              &lt;vehicle reference="54"/&gt;
            &lt;/nextCustomer&gt;
            &lt;vehicle reference="54"/&gt;
          &lt;/nextCustomer&gt;
          &lt;vehicle reference="54"/&gt;
        &lt;/nextCustomer&gt;
      &lt;/VrpVehicle&gt;
      &lt;VrpVehicle id="60"&gt;
        &lt;id&gt;4&lt;/id&gt;
        &lt;capacity&gt;100&lt;/capacity&gt;
        &lt;depot reference="37"/&gt;
        &lt;nextCustomer id="61"&gt;
          &lt;id&gt;32&lt;/id&gt;
          &lt;location class="VrpAirLocation" reference="34"/&gt;
          &lt;demand&gt;2&lt;/demand&gt;
          &lt;previousStandstill class="VrpVehicle" reference="60"/&gt;
          &lt;nextCustomer id="62"&gt;
            &lt;id&gt;24&lt;/id&gt;
            &lt;location class="VrpAirLocation" reference="26"/&gt;
            &lt;demand&gt;7&lt;/demand&gt;
            &lt;previousStandstill class="VrpCustomer" reference="61"/&gt;
            &lt;nextCustomer id="63"&gt;
              &lt;id&gt;25&lt;/id&gt;
              &lt;location class="VrpAirLocation" reference="27"/&gt;
              &lt;demand&gt;21&lt;/demand&gt;
              &lt;previousStandstill class="VrpCustomer" reference="62"/&gt;
              &lt;nextCustomer id="64"&gt;
                &lt;id&gt;23&lt;/id&gt;
                &lt;location class="VrpAirLocation" reference="25"/&gt;
                &lt;demand&gt;16&lt;/demand&gt;
                &lt;previousStandstill class="VrpCustomer" reference="63"/&gt;
                &lt;nextCustomer id="65"&gt;
                  &lt;id&gt;27&lt;/id&gt;
                  &lt;location class="VrpAirLocation" reference="29"/&gt;
                  &lt;demand&gt;21&lt;/demand&gt;
                  &lt;previousStandstill class="VrpCustomer" reference="64"/&gt;
                  &lt;nextCustomer id="66"&gt;
                    &lt;id&gt;5&lt;/id&gt;
                    &lt;location class="VrpAirLocation" reference="7"/&gt;
                    &lt;demand&gt;15&lt;/demand&gt;
                    &lt;previousStandstill class="VrpCustomer" reference="65"/&gt;
                    &lt;nextCustomer id="67"&gt;
                      &lt;id&gt;9&lt;/id&gt;
                      &lt;location class="VrpAirLocation" reference="11"/&gt;
                      &lt;demand&gt;16&lt;/demand&gt;
                      &lt;previousStandstill class="VrpCustomer" reference="66"/&gt;
                      &lt;vehicle reference="60"/&gt;
                    &lt;/nextCustomer&gt;
                    &lt;vehicle reference="60"/&gt;
                  &lt;/nextCustomer&gt;
                  &lt;vehicle reference="60"/&gt;
                &lt;/nextCustomer&gt;
                &lt;vehicle reference="60"/&gt;
              &lt;/nextCustomer&gt;
              &lt;vehicle reference="60"/&gt;
            &lt;/nextCustomer&gt;
            &lt;vehicle reference="60"/&gt;
          &lt;/nextCustomer&gt;
          &lt;vehicle reference="60"/&gt;
        &lt;/nextCustomer&gt;
      &lt;/VrpVehicle&gt;
      &lt;VrpVehicle id="68"&gt;
        &lt;id&gt;5&lt;/id&gt;
        &lt;capacity&gt;100&lt;/capacity&gt;
        &lt;depot reference="37"/&gt;
        &lt;nextCustomer id="69"&gt;
          &lt;id&gt;7&lt;/id&gt;
          &lt;location class="VrpAirLocation" reference="9"/&gt;
          &lt;demand&gt;5&lt;/demand&gt;
          &lt;previousStandstill class="VrpVehicle" reference="68"/&gt;
          &lt;nextCustomer id="70"&gt;
            &lt;id&gt;20&lt;/id&gt;
            &lt;location class="VrpAirLocation" reference="22"/&gt;
            &lt;demand&gt;22&lt;/demand&gt;
            &lt;previousStandstill class="VrpCustomer" reference="69"/&gt;
            &lt;nextCustomer id="71"&gt;
              &lt;id&gt;21&lt;/id&gt;
              &lt;location class="VrpAirLocation" reference="23"/&gt;
              &lt;demand&gt;10&lt;/demand&gt;
              &lt;previousStandstill class="VrpCustomer" reference="70"/&gt;
              &lt;nextCustomer id="72"&gt;
                &lt;id&gt;10&lt;/id&gt;
                &lt;location class="VrpAirLocation" reference="12"/&gt;
                &lt;demand&gt;17&lt;/demand&gt;
                &lt;previousStandstill class="VrpCustomer" reference="71"/&gt;
                &lt;nextCustomer id="73"&gt;
                  &lt;id&gt;16&lt;/id&gt;
                  &lt;location class="VrpAirLocation" reference="18"/&gt;
                  &lt;demand&gt;11&lt;/demand&gt;
                  &lt;previousStandstill class="VrpCustomer" reference="72"/&gt;
                  &lt;nextCustomer id="74"&gt;
                    &lt;id&gt;3&lt;/id&gt;
                    &lt;location class="VrpAirLocation" reference="5"/&gt;
                    &lt;demand&gt;17&lt;/demand&gt;
                    &lt;previousStandstill class="VrpCustomer" reference="73"/&gt;
                    &lt;nextCustomer id="75"&gt;
                      &lt;id&gt;4&lt;/id&gt;
                      &lt;location class="VrpAirLocation" reference="6"/&gt;
                      &lt;demand&gt;6&lt;/demand&gt;
                      &lt;previousStandstill class="VrpCustomer" reference="74"/&gt;
                      &lt;nextCustomer id="76"&gt;
                        &lt;id&gt;6&lt;/id&gt;
                        &lt;location class="VrpAirLocation" reference="8"/&gt;
                        &lt;demand&gt;7&lt;/demand&gt;
                        &lt;previousStandstill class="VrpCustomer" reference="75"/&gt;
                        &lt;vehicle reference="68"/&gt;
                      &lt;/nextCustomer&gt;
                      &lt;vehicle reference="68"/&gt;
                    &lt;/nextCustomer&gt;
                    &lt;vehicle reference="68"/&gt;
                  &lt;/nextCustomer&gt;
                  &lt;vehicle reference="68"/&gt;
                &lt;/nextCustomer&gt;
                &lt;vehicle reference="68"/&gt;
              &lt;/nextCustomer&gt;
              &lt;vehicle reference="68"/&gt;
            &lt;/nextCustomer&gt;
            &lt;vehicle reference="68"/&gt;
          &lt;/nextCustomer&gt;
          &lt;vehicle reference="68"/&gt;
        &lt;/nextCustomer&gt;
      &lt;/VrpVehicle&gt;
    &lt;/vehicleList&gt;
    &lt;customerList id="77"&gt;
      &lt;VrpCustomer reference="49"/&gt;
      &lt;VrpCustomer reference="74"/&gt;
      &lt;VrpCustomer reference="75"/&gt;
      &lt;VrpCustomer reference="66"/&gt;
      &lt;VrpCustomer reference="76"/&gt;
      &lt;VrpCustomer reference="69"/&gt;
      &lt;VrpCustomer reference="47"/&gt;
      &lt;VrpCustomer reference="67"/&gt;
      &lt;VrpCustomer reference="72"/&gt;
      &lt;VrpCustomer reference="41"/&gt;
      &lt;VrpCustomer reference="42"/&gt;
      &lt;VrpCustomer reference="52"/&gt;
      &lt;VrpCustomer reference="46"/&gt;
      &lt;VrpCustomer reference="50"/&gt;
      &lt;VrpCustomer reference="73"/&gt;
      &lt;VrpCustomer reference="58"/&gt;
      &lt;VrpCustomer reference="44"/&gt;
      &lt;VrpCustomer reference="48"/&gt;
      &lt;VrpCustomer reference="70"/&gt;
      &lt;VrpCustomer reference="71"/&gt;
      &lt;VrpCustomer reference="53"/&gt;
      &lt;VrpCustomer reference="64"/&gt;
      &lt;VrpCustomer reference="62"/&gt;
      &lt;VrpCustomer reference="63"/&gt;
      &lt;VrpCustomer reference="59"/&gt;
      &lt;VrpCustomer reference="65"/&gt;
      &lt;VrpCustomer reference="56"/&gt;
      &lt;VrpCustomer reference="55"/&gt;
      &lt;VrpCustomer reference="43"/&gt;
      &lt;VrpCustomer reference="57"/&gt;
      &lt;VrpCustomer reference="61"/&gt;
      &lt;VrpCustomer reference="40"/&gt;
    &lt;/customerList&gt;
    &lt;score id="78"&gt;0hard/-743441soft&lt;/score&gt;
  &lt;/VrpVehicleRoutingSolution&gt;
  </code></pre>
  
  <p>Here is what i tried:</p>
  
  <pre><code>library(XML)
  library(plyr)
  xmlfile &lt;- xmlTreeParse("test.xml")
  class(xmlfile)
  topxml &lt;- xmlRoot(xmlfile)
  topxml &lt;- xmlSApply(topxml,
                     function(x) xmlSApply(x, xmlValue))
  xml_df &lt;- data.frame(t(topxml),
                      row.names=NULL)
  </code></pre>