title: How to get formatted xml output from jaxb in spring?
body: <p>I am using Jaxb2Marshaller as a view property for ContentNegotiatingViewResolver. I am able to get the xml repsonse. How do I format (pretty print) it?</p>
  
  <pre><code>&lt;bean
      class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"&gt;
      &lt;property name="mediaTypes"&gt;
          &lt;map&gt;
              &lt;entry key="xml" value="application/xml" /&gt;
          &lt;/map&gt;
      &lt;/property&gt;
      &lt;property name="defaultViews"&gt;
          &lt;list&gt;
  
              &lt;bean class="org.springframework.web.servlet.view.xml.MarshallingView"&gt;
                  &lt;constructor-arg&gt;
                      &lt;bean class="org.springframework.oxm.jaxb.Jaxb2Marshaller"&gt;
                          &lt;property name="classesToBeBound"&gt;
                              &lt;list&gt;
  
                              &lt;/list&gt;
                          &lt;/property&gt;
                      &lt;/bean&gt;
                  &lt;/constructor-arg&gt;
              &lt;/bean&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  
  &lt;/bean&gt;
  </code></pre>