title: Java/JAXB: How can I serialize a class into a well-formatted xml document?
body: <p>I love JAXB. It has made my work so much easier.
  I do have one minor gripe: The XML it outputs is always dumped onto a single line.
  I call it a minor gripe because typically I don't really care what's in the XML and no user should either, and if they stumble upon and brutalize the contents I generally implement fail safes to revert back to install-time defaults. However, some times I just do really kind of want to look at whats in there, to make sure things are running right, and sometimes just to see what it's doing and how it's doing it.</p>
  
  <p>Is it possible to get JAXB to serialize a class to a well-formated XML document? Like, rather than</p>
  
  <pre><code>&lt;Class&gt;&lt;Object&gt;value&lt;/Object&gt;&lt;Object2&gt;value&lt;/Object2&gt;&lt;/Class&gt;
  </code></pre>
  
  <p>something like</p>
  
  <pre><code>&lt;Class&gt;
      &lt;Object&gt;
          value
      &lt;/Object&gt;
  &lt;/Class&gt;
  </code></pre>
  
  <p>Is that possible?</p>