1 21 22 package nu.xom.samples; 23 24 import java.io.*; 25 import nu.xom.Document; 26 import nu.xom.Builder; 27 import nu.xom.ParsingException; 28 29 34 public class ROT13File { 35 36 public static void main(String [] args) { 37 38 if (args.length <= 0) { 39 System.out.println("Usage: java nu.xom.samples.ROT13File filename"); 40 return; 41 } 42 43 File file = new File(args[0]); 44 45 try { 46 Builder parser = new Builder(); 47 48 Document document = parser.build(file); 50 51 ROT13XML.encode(document); 53 54 System.out.println(document.toXML()); 56 57 } 58 catch (IOException ex) { 59 System.out.println( 60 "Due to an IOException, the parser could not encode " + file 61 ); 62 } 63 catch (ParsingException ex) { 64 System.out.println(ex); 65 ex.printStackTrace(); 66 } 67 68 } 70 } 71 | Popular Tags |