title: Minify XML with Ruby
body: <p>Given an XML string:</p>
  
  <pre><code>xml = "&lt;org&gt;&lt;people&gt; &lt;person&gt;Joe Shmoe&lt;/person&gt; &lt;person&gt;Bo Bob&lt;/person&gt; 
      &lt;person&gt;New Guy&lt;/person&gt; &lt;/people&gt;&lt;other&gt;&lt;![CDATA[ This string might 
  have tags &lt; &gt;  &lt; &gt; and stuff, don't touch this ]]&gt;&lt;/other&gt;&lt;/org&gt;"
  </code></pre>
  
  <p>How can I get rid of newlines and spaces between the tags, without affecting tag text, CDATA, etc?</p>
  
  <p>Result should be:</p>
  
  <pre><code>xml = "&lt;org&gt;&lt;people&gt;&lt;person&gt;Joe Shmoe&lt;/person&gt;&lt;person&gt;Bo Bob&lt;/person&gt;&lt;person&gt;New Guy&lt;/person&gt;&lt;/people&gt;&lt;other&gt;&lt;![CDATA[ This string might 
  have tags &lt; &gt;  &lt; &gt; and stuff, don't touch this ]]&gt;&lt;/other&gt;&lt;/org&gt;"
  </code></pre>
  
  <hr>
  
  <p><strong>UPDATE:</strong>
  This is what I've come up with so far- I just can't figure out how to have it ignore CDATA content...</p>
  
  <pre><code>xml.gsub(/&gt;\s+&lt;/,"&gt;&lt;")
  </code></pre>
  
  <p>Also, would much rather use an XML parser for this, as from what I hear regexing XML is <a href="https://stackoverflow.com/q/701166/165673">a bad thing</a>.</p>