title: How to remove tabs "\n" and witespace from text?
body: <p>I have a XML document and after every update  operation from code it has   some extra spaces and as a result file size increases. I used this  expression  in groovy, but it doesn't work. What should I do?</p>
  
  <pre><code> def stringWriter = new StringWriter()
   new XmlNodePrinter(new PrintWriter(stringWriter)).print(xml)
   def newXml = stringWriter.toString()
   String trimmedString = newXml.replaceAll("(?m)^[ \t]*\r?\n", "");
   println trimmedString
  </code></pre>