1 30 31 package com.caucho.eswrap.com.caucho.xml; 32 33 import com.caucho.vfs.Path; 34 import com.caucho.vfs.ReadStream; 35 import com.caucho.vfs.StringStream; 36 import com.caucho.xml.Html; 37 38 import org.w3c.dom.Document ; 39 import org.xml.sax.SAXException ; 40 41 import java.io.IOException ; 42 import java.io.InputStream ; 43 44 public class HtmlEcmaWrap { 45 public static Document parse(InputStream is) 46 throws IOException , SAXException 47 { 48 if (is instanceof ReadStream) 49 return new Html().parseDocument((ReadStream) is); 50 else 51 return new Html().parseDocument(is); 52 } 53 54 public static Document parseString(String s) 55 throws IOException , SAXException 56 { 57 return new Html().parseDocument(StringStream.open(s)); 58 } 59 60 public static Document parseFile(Path path) 61 throws IOException , SAXException 62 { 63 return new Html().parseDocument(path); 64 } 65 } 66 | Popular Tags |