title: remove line breaks and spaces from xml file with vb
body: <p>I have looked online for a couple days on how to do this. I find small elements of code, but I seem to be missing the larger items.</p>
  
  <p>I have a number of xml files that I need to edit out extra spaces within the tags (the innertext) and I need to take out the many linebreaks (or returns--not sure if I have the right term). As well, there are elements like some text where I want to keep the text, but get rid of just the tags (the text will be absorbed into the parent tag, which is why I need to get rid of spaces and returns.</p>
  
  <pre><code>&lt;root&gt;
    &lt;element&gt;Some text here that has line breaks. Like this: 
      item        one 
      item two
    &lt;/element&gt; 
  &lt;/root&gt;
  </code></pre>
  
  <p>Need it to look like:</p>
  
  <pre><code>&lt;root&gt;
   &lt;element&gt;Some text here that has line breaks. Like this: item item two&lt;/element&gt;
  &lt;/root&gt;    
  </code></pre>
  
  <p>I found this, but I knew it wouldn't work. I know I probably need some code that reads through and replaces (like for each node etc, etc).</p>
  
  <p>Here is my start:</p>
  
  
  
  <pre class="lang-vb prettyprint-override"><code>Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
      Dim path As String = "c:\temp\"
  
      Dim doc As New XmlDocument
      doc.PreserveWhitespace = False
      doc.Load(path &amp; filenm.Text)
      'need some loop though here with a doc.replace(something???)
      doc.Save(path &amp; filenm.Text)
      doc.PreserveWhitespace = False
  End Sub
  </code></pre>
  
  <p>Any help? BTW, all the help I get here is great. I am a newbee, but have learned a lot from you and have a pretty cool app running now that makes people think I know what I am doing. ;-)</p>