title: extracting XML from HTML?
body: <p>Reference page: <a href="http://www.ncbi.nlm.nih.gov/pubmed/?term=NS044283%5bGR%5d&amp;dispmax=200&amp;report=xml" rel="nofollow">http://www.ncbi.nlm.nih.gov/pubmed/?term=NS044283[GR]&amp;dispmax=200&amp;report=xml</a></p>
  
  <p>The XML is embedded under the <code>&lt;pre&gt;</code> tag of the returned HTML page.
  I can extract the contents of the <code>&lt;pre&gt;</code> tag, but I am unable to convert this to XML correctly. 
  I tried using the <code>to_xml</code> method of the NodeSet class, but it seems that the line endings (<code>\n</code>) are messing up the parsing.</p>
  
  <p>Here is a snippet of my code:</p>
  
  <pre><code>url = "http://www.ncbi.nlm.nih.gov/pubmed/?term=NS044283[GR]&amp;dispmax=200&amp;report=xml"
  doc = Nokogiri::XML(open(url))
  pre = doc.xpath('//pre')
  xml = pre.to_xml
  contents = Nokogiri::XML(xml)
  articles = contents.xpath('\\PubmedArticle')
  (article = [])
  </code></pre>