[prev in list] [next in list] [prev in thread] [next in thread]
List: xalan-j-users
Subject: Simple serialize with indents
From: "Flurchick, Kenneth M" <FLURCHICKK () MAIL ! ECU ! EDU>
Date: 2002-11-28 15:16:35
[Download RAW message or body]
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);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic