title: How to replace < (&lt;) inbetween xml tags using regular expression?
body: <p>I am fetching a xml data from database as a string.
      I want to <strong>replace &lt; with &amp;lt ;</strong> in between xml tags.For eg:</p>
  
  <pre><code> &lt;smallelement&gt; a&lt;b &lt;/smallelement&gt;
  </code></pre>
  
  <p>To be replaced as </p>
  
  <pre><code>&lt;smallelement&gt; a &amp;lt; b &lt;/smallelement&gt;
  
  i want to replace &lt; with &amp;lt; 
  </code></pre>
  
  <p>If I use string replace function </p>
  
  <pre><code>  $content = str_replace("&lt;","&amp;lt;",$content);
  it replaces element tag &lt;smallelement&gt; also like &amp;lt ;smallelement.
  
     &amp;lt;smallelement&gt; a&amp;lt;b &amp;lt;/smallelement&gt;
  </code></pre>
  
  <p>How can i achieve this using regular expression to replace content within xml tags or is there any other ways ?</p>