You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by "Flurchick, Kenneth M" <FL...@MAIL.ECU.EDU> on 2002/11/28 16:16:35 UTC
Simple serialize with indents
GentleBeings
I hae tried everything I can think of without rebuilding Xalan
to serialize a DOM with indents
I believe this is a simple request but cannot find a solution
below is a snippet of code (it writes an XML file with line breaks
no indents)
Any help is greatly appreciated.
kf
org.apache.xalan.serialize.SerializerToXML serial = new
org.apache.xalan.serialize.SerializerToXML();
int spacer = 2;
serial.indent(spacer);
serial.asDOMSerializer();
Properties props = new Properties();
props.setProperty(javax.xml.transform.OutputKeys.METHOD, "xml");
props.setProperty(javax.xml.transform.OutputKeys.ENCODING,
"ISO-8859-1");
props.setProperty(javax.xml.transform.OutputKeys.INDENT, "yes");
props.setProperty(javax.xml.transform.OutputKeys.STANDALONE, "no");
props.list(System.out);
serial.setOutputFormat(props);
System.out.println(serial.getOutputFormat());
serial.setOutputStream(new FileOutputStream(ruFile));
serial.serialize(doc);
System.out.println("name = " + ruFile);