title: Unindent or linearize XML
body: <p>I'm looking for a fast way to linearize an XML in JAVA</p>
  
  <p>I'm using ~2GB file so DOM is excluded.
  Java targhet is 1.5.0.22
  I have to generate from an xml a file composed of 80bytes + newline. I have to write this in a DB2 table that will be read by a Cobol program. </p>
  
  <p>In Cobol is important the size because the data are read as CHAR from table this implies the an empty rows is 80 spaces.</p>
  
  <p>I read the file byte to byte(I must) but I can use internal temp bufferization to store the probably sequence to ignore </p>
  
  <p>Example 5 bytes af ascii file</p>
  
  <pre><code>&lt;a&gt;&lt;b&gt;&lt;c&gt;psofpisogiosigpsfiogpo&lt;/c&gt;&lt;/b&gt;&lt;/a&gt;
  
  &lt;a&gt;&lt;b
  &gt;&lt;c&gt;p
  sofpi
  sogio
  sigps
  fiogp
  o&lt;/c&gt;
  &lt;/b&gt;&lt;
  /a&gt;
  </code></pre>
  
  <p>PROBLEM WITH A FILE</p>
  
  <pre><code>&lt;a&gt;
      &lt;b&gt;
         &lt;c&gt;psofpisogiosigpsfiogpo&lt;/c&gt;
      &lt;/b&gt;
  &lt;/a&gt;
  
  
  
  
  
  
  
  &lt;a&gt;
  
    &lt;b
  &gt;
  
  
  &lt;c&gt;ps
  ofpis
  ogios
  igpsf
  iogpo
  &lt;/c&gt;
  
      &lt;
  /b&gt;
  
     &lt;/
  a&gt;
  </code></pre>
  
  <p>The non linearized XML create empty rows in table or some rows that ar not used to their full potential.</p>
  
  <p>This became a lost of payd cpu cycle unde HOST CICS enviorment </p>
  
  <p>If I can linearize the file i get same output if the file is indented or not and XML keep the same informations</p>
  
  <p>Any Idea?</p>