title: how to find and replace content in an xml file
body: <p>Trying to find and replace content in xml file</p>
  
  <p>I am running nmap against various hosts and getting an xml output for each run (this is happening in pipeline)
  I am merging the xml files for each run into a merged xml </p>
  
  <p>the above is to provide background only..</p>
  
  <p><strong>My actual issue is:</strong> </p>
  
  <p>I want to replace some content in the merged xml file </p>
  
  <p>I tried <strong>sed -i -e</strong> but it works only for third line where I am trying to change the link but second line is not working, probably due to spaces in the line</p>
  
  <p>I have test.xml file in which I need to replace some content </p>
  
  <pre><code>&lt;?xml version="1.0"?&gt; 
  &lt;!DOCTYPE nmaprun PUBLIC "-//IDN nmap.org//DTD Nmap XML 1.04//EN" "https://svn.nmap.org/nmap/docs/nmap.dtd"&gt; 
  &lt;?xml-stylesheet href="https://svn.nmap.org/nmap/docs/nmap.xsl" type="text/xsl"?&gt; 
  </code></pre>
  
  <p>In the second line I want to remove content after nmaprun (Remove ' PUBLIC........ until .. .dtd") > should stay</p>
  
  <p>after replace it should be like this</p>
  
  <pre><code>&lt;!DOCTYPE nmaprun&gt;
  </code></pre>
  
  <p>and the third line I want to replace <code>https://svn.nmap.org/nmap/docs/nmap.xsl</code>
  with <code>file:///usr/local/bin/../share/nmap/nmap.xsl</code></p>
  
  <p>after replace it should be displayed as </p>
  
  <pre><code>&lt;?xml-stylesheet href="file:///usr/local/bin/../share/nmap/nmap.xsl" type="text/xsl"?&gt;
  </code></pre>
  
  <p>after two lines replace it should display as</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt; 
      &lt;!DOCTYPE nmaprun&gt; 
      &lt;?xml-stylesheet href="file:///usr/local/bin/../share/nmap/nmap.xsl" type="text/xsl"?&gt;
  </code></pre>