1 28 29 package com.caucho.xml.parsers; 30 31 import com.caucho.xml.QDOMImplementation; 32 import com.caucho.xml.Xml; 33 import com.caucho.xml.XmlParser; 34 35 import org.w3c.dom.DOMImplementation ; 36 import org.w3c.dom.Document ; 37 import org.xml.sax.EntityResolver ; 38 import org.xml.sax.ErrorHandler ; 39 import org.xml.sax.InputSource ; 40 import org.xml.sax.SAXException ; 41 42 import javax.xml.parsers.DocumentBuilder ; 43 import java.io.IOException ; 44 import java.io.InputStream ; 45 46 49 public class AbstractDocumentBuilder extends DocumentBuilder { 50 protected XmlParser _parser; 52 53 public DOMImplementation getDOMImplementation() 54 { 55 return new QDOMImplementation(); 56 } 57 58 65 public Document parse(InputSource is) 66 throws IOException , SAXException 67 { 68 return _parser.parseDocument(is); 69 } 70 71 78 public Document parse(InputStream is) 79 throws IOException , SAXException 80 { 81 return _parser.parseDocument(is); 82 } 83 84 92 public Document parse(InputStream is, String systemId) 93 throws IOException , SAXException 94 { 95 return _parser.parseDocument(is, systemId); 96 } 97 98 public boolean isNamespaceAware() 99 { 100 return _parser.isNamespaceAware(); 101 } 102 103 public boolean isValidating() 104 { 105 return false; 106 } 107 108 113 public void setEntityResolver(EntityResolver er) 114 { 115 _parser.setEntityResolver(er); 116 } 117 118 public void setErrorHandler(ErrorHandler eh) 119 { 120 _parser.setErrorHandler(eh); 121 } 122 123 public Document newDocument() 124 { 125 return Xml.createDocument(); 126 } 127 } 128 | Popular Tags |