title: How to replace nth occurrence in the xml template in Java?
body: <p>Here I am doing automation with Java, serenity with rest-assured.
  So I want to replace the 2nd <code>&lt;p&gt;</code> &amp; <code>&lt;/p&gt;</code> tags with a blank string.</p>
  <p>Here I attached the template</p>
  <pre><code>&lt;Request&gt;    
      &lt;P&gt;
          &lt;n&gt;name1&lt;/n&gt;
          &lt;v&gt;${value1}&lt;/v&gt;
      &lt;/P&gt;
      &lt;P&gt;
          &lt;n&gt;name2&lt;/n&gt;
          &lt;v&gt;${value2}&lt;/v&gt;
      &lt;/P&gt; 
     &lt;P&gt;
          &lt;n&gt;name3&lt;/n&gt;
          &lt;v&gt;value3&lt;/v&gt;
      &lt;/P&gt; 
  &lt;/Request&gt;
  </code></pre>
  <p>I am using the below code to replace the 2nd <code>&lt;p&gt;</code> and <code>&lt;/p&gt;</code> tags. But it was replaced the all <code>&lt;p&gt;</code> &amp;<code>&lt;/p&gt;</code> tags(first and last <code>&lt;p&gt;</code> &amp; <code>&lt;/p&gt;</code> tags also)</p>
  <pre><code>String request = exampleTemplate.replace(&quot;${value1}&quot;, &quot;XYZ&quot;)
                  .replace(&quot;&lt;P&gt;&quot;, &quot;&quot;)
                  .replace(&quot;&lt;v&gt;${value2}&lt;/v&gt;&quot;, &quot;1234&quot;)
                  .replace(&quot;&lt;/P&gt;&quot;, &quot;&quot;)
                  .replace(&quot;${value3}&quot;, &quot;AAA&quot;);
  </code></pre>
  <p>How can I replace only the 2nd <code>&lt;p&gt;</code> and <code>&lt;/p&gt;</code> tags?</p>