1 import au.id.jericho.lib.html.*; 2 import java.util.*; 3 import java.io.*; 4 import java.net.*; 5 6 public class Indent { 7 public static void main(String [] args) throws Exception { 8 String sourceUrlString="data/test.html"; 9 if (args.length==0) 10 System.err.println("Using default argument of \""+sourceUrlString+'"'); 11 else 12 sourceUrlString=args[0]; 13 if (sourceUrlString.indexOf(':')==-1) sourceUrlString="file:"+sourceUrlString; 14 PHPTagTypes.register(); 15 MasonTagTypes.register(); 16 Source source=new Source(new URL(sourceUrlString)); 17 source.setLogWriter(new OutputStreamWriter(System.err)); source.fullSequentialParse(); 19 20 String indentText=" "; 21 boolean tidyTags=true; 22 boolean collapseWhiteSpace=false; 23 boolean indentAllElements=false; 24 source.indent(indentText,tidyTags,collapseWhiteSpace,indentAllElements).writeTo(new OutputStreamWriter(System.out)); 25 } 26 } 27 | Popular Tags |