1 package dolda.jsvc.next;
6 public class IndentWriter extends XmlWriter {
7 public int collimit = 80;
9 public IndentWriter(Document doc) {
13 private static boolean onlytext(Element el) {
14 for(Node n = el.getFirstChild(); n != null; n = n.getNextSibling()) {
15 if(!(n instanceof Text))
21 protected boolean prebreak(ColumnWriter out, Element el) {
22 if(el.getFirstChild() == null)
29 protected int indent(ColumnWriter out, Element el) {
35 protected boolean postbreak(ColumnWriter out, Element el) {
36 if(out.col > collimit)
38 return(!onlytext(el));
41 protected void attribute(ColumnWriter out, String nm, String val, int indent) throws IOException {
42 if(out.col > indent) {
43 if(nm.length() + val.length() + 4 > collimit)
46 super.attribute(out, nm, val, indent);