title: How to replace the text inside an XML element in R?
body: <p>I have one input xml file. </p>
  
  <p>cat sample.xml</p>
  
  <pre><code>&lt;Text&gt;
      &amp;lt;p&amp;gt;ABC &amp;lt;/p&amp;gt;
  &lt;/Text&gt;
  </code></pre>
  
  <p>R script   </p>
  
  <pre><code>library(XML)
  doc = xmlTreeParse("sample.xml", useInternal = TRUE)
  top&lt;-xmlRoot(doc)
  
  sub("&amp;lt;","&lt;",top[[1]])
  </code></pre>
  
  <p>How can i fix above pblm?</p>
  
  <p><strong>Error Message</strong>: Error in as.vector(x, "character") : 
    cannot coerce type 'externalptr' to vector of type 'character'</p>
  
  <p>Edit: Aim is to use readHTMLTable() function for particular node in xml which has html table but it has xml markup( <code>&amp;gt;</code> and <code>&amp;lt;</code>) for > and &lt; which need to be repalced first as readHTMLTable function cannot handle xml markup. </p>