1 47 48 package com.lowagie.text.xml; 49 50 51 import java.io.OutputStream; 52 import java.io.FileInputStream; 53 import java.io.FileOutputStream; 54 55 import com.lowagie.text.Document; 56 import com.lowagie.text.DocumentException; 57 import com.lowagie.text.html.HtmlWriter; 58 59 60 66 public class XmlToHtml 67 extends XmlToXXX 68 { 69 70 73 public XmlToHtml() 74 { 75 super(); 76 } 78 79 84 public XmlToHtml(String pageSize) 85 { 86 super(pageSize); 87 } 89 90 97 protected final void addWriter(Document doc, OutputStream out) 98 throws DocumentException 99 { 100 HtmlWriter.getInstance(doc, out); 101 } 103 104 108 public static void main(String[] args) 109 { 110 int code = 0; 111 112 if (args.length > 1) 113 { 114 try 115 { 116 XmlToHtml x; 117 if (args.length > 2) 118 { 119 x = new XmlToHtml(args[2]); 120 } else 122 { 123 x = new XmlToHtml(); 124 } 126 x.parse(new FileInputStream(args[0]), new FileOutputStream(args[1])); 127 } catch (Exception ex) 129 { 130 code = 2; 131 ex.printStackTrace(System.err); 132 } } else 135 { 136 code = 1; 137 System.err.println( 138 "Usage: XmlToHtml [XML file in] [PDF file out] [optional page size]"); 139 } 141 System.exit(code); 142 } 144 } | Popular Tags |