title: How to transform XML data into a data.frame?
body: <p>I'm trying to learn R's <code>XML</code> package. I'm trying to create a data.frame from books.xml sample xml data file. Here's what I get:</p>
  
  <pre><code>library(XML)
  books &lt;- "http://www.w3schools.com/XQuery/books.xml"
  doc &lt;- xmlTreeParse(books, useInternalNodes = TRUE)
  doc
  xpathApply(doc, "//book", function(x) do.call(paste, as.list(xmlValue(x))))
  xpathSApply(doc, "//book", function(x) strsplit(xmlValue(x), " "))
  xpathSApply(doc, "//book/child::*", xmlValue)
  </code></pre>
  
  <p>Each of these xpathSApply's don't get me even close to my intention. How should one proceed toward a well formed data.frame?</p>