KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > icl > saxon > om > DocumentBuilderImpl


1 package com.icl.saxon.om;
2 import com.icl.saxon.tinytree.*;
3
4 import org.w3c.dom.Document JavaDoc;
5 import org.w3c.dom.DOMImplementation JavaDoc;
6 import org.xml.sax.InputSource JavaDoc;
7 import org.xml.sax.EntityResolver JavaDoc;
8 import org.xml.sax.ErrorHandler JavaDoc;
9 import org.xml.sax.SAXException JavaDoc;
10
11 import javax.xml.parsers.*;
12 import javax.xml.transform.sax.SAXSource JavaDoc;
13 import javax.xml.transform.TransformerException JavaDoc;
14
15 public class DocumentBuilderImpl extends DocumentBuilder {
16    
17     public boolean isNamespaceAware() {
18         return true;
19     }
20     
21     public boolean isValidating() {
22         return false;
23     }
24     
25     public Document JavaDoc newDocument() {
26         // The returned document will be of little use, because it is immutable.
27
// But it can be used in a DOMResult as the result of a transformation
28
return new TinyDocumentImpl();
29     }
30     
31     public Document JavaDoc parse(InputSource JavaDoc in) throws SAXException JavaDoc {
32         try {
33             Builder builder = new TinyBuilder();
34             builder.setNamePool(NamePool.getDefaultNamePool());
35             return (Document JavaDoc)builder.build(new SAXSource JavaDoc(in));
36         } catch (TransformerException JavaDoc err) {
37             throw new SAXException JavaDoc(err);
38         }
39     }
40     
41     public void setEntityResolver(EntityResolver JavaDoc er) {
42         // TODO: not implemented
43
}
44     
45     public void setErrorHandler(ErrorHandler JavaDoc er) {
46         // TODO: not implemented
47
}
48
49     public DOMImplementation JavaDoc getDOMImplementation() {
50         return new TinyDocumentImpl().getImplementation();
51     }
52 }
Popular Tags