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.xml.XmlParser; 36 37 import org.w3c.dom.Document ; 38 import org.xml.sax.SAXException ; 39 40 import java.io.IOException ; 41 import java.io.InputStream ; 42 43 public class XmlParserEcmaWrap { 44 public static Document parse(XmlParser parser, InputStream is) 45 throws IOException , SAXException 46 { 47 if (is instanceof ReadStream) 48 return parser.parseDocument((ReadStream) is); 49 else 50 return parser.parseDocument(is); 51 } 52 53 public static Document parseFile(XmlParser parser, Path path) 54 throws IOException , SAXException 55 { 56 return parser.parseDocument(path); 57 } 58 59 public static Document parseStream(XmlParser parser, InputStream is) 60 throws IOException , SAXException 61 { 62 return parser.parseDocument(is); 63 } 64 65 public static Document parseString(XmlParser parser, String s) 66 throws IOException , SAXException 67 { 68 return parser.parseDocumentString(s); 69 } 70 } 71 | Popular Tags |