Permalink
Browse files

intendation added

  • Loading branch information...
1 parent 6724484 commit 8d01f68f959cd94d73645ee3ff8ae54dd10650c8 @jschneider committed Mar 27, 2012
@@ -35,6 +35,7 @@
import com.cedarsoft.version.VersionRange;
import com.cedarsoft.serialization.AbstractXmlSerializer;
import com.cedarsoft.serialization.stax.AbstractStaxBasedSerializer;
+import org.codehaus.staxmate.SMOutputFactory;
import org.codehaus.staxmate.out.SMNamespace;
import org.codehaus.staxmate.out.SMOutputDocument;
import org.codehaus.staxmate.out.SMOutputElement;
@@ -51,14 +52,19 @@
* @param <T> the type
*/
public abstract class AbstractStaxMateSerializer<T> extends AbstractStaxBasedSerializer<T, SMOutputElement> {
+ @Nonnull
+ public static final String INDENT_STR = "\n ";
+
protected AbstractStaxMateSerializer( @Nonnull String defaultElementName, @Nonnull String nameSpaceUriBase, @Nonnull VersionRange formatVersionRange ) {
super( defaultElementName, nameSpaceUriBase, formatVersionRange );
}
@Override
public void serialize( @Nonnull T object, @Nonnull OutputStream out ) throws IOException {
try {
- SMOutputDocument doc = StaxMateSupport.getSmOutputFactory().createOutputDocument( out );
+ SMOutputFactory factory = StaxMateSupport.getSmOutputFactory();
+ SMOutputDocument doc = factory.createOutputDocument( out );
+ doc.setIndentation( INDENT_STR, 1, 2 );
String nameSpaceUri = getNameSpace();
SMNamespace nameSpace = doc.getNamespace( nameSpaceUri );

0 comments on commit 8d01f68

Please sign in to comment.