1 50 51 package com.lowagie.text.html; 52 53 import java.io.IOException ; 54 import java.io.InputStream ; 55 import java.io.Reader ; 56 57 import org.xml.sax.InputSource ; 58 import org.xml.sax.SAXException ; 59 60 import com.lowagie.text.DocListener; 61 import com.lowagie.text.ExceptionConverter; 62 import com.lowagie.text.xml.XmlParser; 63 64 67 68 public class HtmlParser extends XmlParser { 69 70 73 74 public HtmlParser() { 75 super(); 76 } 77 78 83 84 public void go(DocListener document, InputSource is) { 85 try { 86 parser.parse(is, new SAXmyHtmlHandler(document)); 87 } 88 catch(SAXException se) { 89 throw new ExceptionConverter(se); 90 } 91 catch(IOException ioe) { 92 throw new ExceptionConverter(ioe); 93 } 94 } 95 96 101 102 public static void parse(DocListener document, InputSource is) { 103 HtmlParser p = new HtmlParser(); 104 p.go(document, is); 105 } 106 107 112 113 public void go(DocListener document, String file) { 114 try { 115 parser.parse(file, new SAXmyHtmlHandler(document)); 116 } 117 catch(SAXException se) { 118 throw new ExceptionConverter(se); 119 } 120 catch(IOException ioe) { 121 throw new ExceptionConverter(ioe); 122 } 123 } 124 125 130 131 public static void parse(DocListener document, String file) { 132 HtmlParser p = new HtmlParser(); 133 p.go(document, file); 134 } 135 136 141 142 public void go(DocListener document, InputStream is) { 143 try { 144 parser.parse(new InputSource (is), new SAXmyHtmlHandler(document)); 145 } 146 catch(SAXException se) { 147 throw new ExceptionConverter(se); 148 } 149 catch(IOException ioe) { 150 throw new ExceptionConverter(ioe); 151 } 152 } 153 154 159 160 public static void parse(DocListener document, InputStream is) { 161 HtmlParser p = new HtmlParser(); 162 p.go(document, new InputSource (is)); 163 } 164 165 170 171 public void go(DocListener document, Reader is) { 172 try { 173 parser.parse(new InputSource (is), new SAXmyHtmlHandler(document)); 174 } 175 catch(SAXException se) { 176 throw new ExceptionConverter(se); 177 } 178 catch(IOException ioe) { 179 throw new ExceptionConverter(ioe); 180 } 181 } 182 183 188 189 public static void parse(DocListener document, Reader is) { 190 HtmlParser p = new HtmlParser(); 191 p.go(document, new InputSource (is)); 192 } 193 } | Popular Tags |