title: Scrape all child paragraphs under heading (preferable rvest)
body: <p>My objective is to use the <code>library(tm)</code> toolkit on a pretty big word document. The word document has sensible typography, so we have <code>h1</code> for the main sections, some <code>h2</code>and <code>h3</code> subheadings. I want to compare and text mine each section (the text below each <code>h1</code> - the subheadings is of little importance - so they can be included or excluded.)</p>
  
  <p>My strategy is to export the worddocument to html and then use the <code>rvest</code>pacakge to extract the paragraphs. </p>
  
  <pre><code>library(rvest)
  # the file has latin-1 chars
  #Sys.setlocale(category="LC_ALL", locale="da_DK.UTF-8")
  # small example html file
  file &lt;- rvest::html("https://83ae1009d5b31624828197160f04b932625a6af5.googledrive.com/host/0B9YtZi1ZH4VlaVVCTGlwV3ZqcWM/tidy.html", encoding = 'utf-8')
  
  nodes &lt;- file %&gt;%
    rvest::html_nodes("h1&gt;p") %&gt;%
    rvest::html_text()
  </code></pre>
  
  <p>I can extract all the <code>&lt;p&gt;</code>with <code>html_nodes("p")</code>, but thats just one big soup. I need to analize each <code>h1</code> separately. </p>
  
  <p>The best would probably be a list, with a vector of <code>p</code> tags for each <code>h1</code> heading. And maybe a loop with somehting like <code>for (i in 1:length(html_nodes(fil, "h1"))) (html_children(html_nodes(fil, "h1")[i]))</code> (which is not working).</p>
  
  <p>Bonus if there is a way to tidy words html from within <code>rvest</code></p>