title: R : XML content does not seem to be XML
body: <p>I am parsing a XML file using R, but I always got the error saying the XML content does not seem to be XML, but the XML file truly contains XML data and even if I just put in one simple tag. Please see sample below</p>
  
  <p>Any suggestion on how to resolve this?</p>
  
  <p>R code :</p>
  
  <pre><code>xmlinfile = "sample.xml"
  xml = xmlInternalTreeParse(xmlinfile)
  </code></pre>
  
  <p>sample.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;root&gt;
     &lt;name&gt;Sample&lt;/name&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>Error :</p>
  
  <pre><code>Error: XML content does not seem to be XML: 'sample.xml'
  </code></pre>
  
  <p>As requested, below is what I got when I print the file before parsing:</p>
  
  <pre><code> xmlinfile = "sample.xml"
   sampleFile&lt;-file(xmlinfile,"w")
   print(sampleFile)
  
  description     class      mode     text       opened     can read    can write 
  "sample.xml"    "file"      "w"    "text"     "opened"      "no"        "yes"
  </code></pre>
  
  <p>Thanks ahead.</p>