KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > xml > lazydom > LazyDOMImplementation


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  * $Id: LazyDOMImplementation.java,v 1.3 2005/01/26 08:29:24 jkjome Exp $
22  */

23
24 package org.enhydra.xml.lazydom;
25
26 import org.enhydra.apache.xerces.dom.DOMImplementationImpl;
27 import org.w3c.dom.DOMException JavaDoc;
28 import org.w3c.dom.DOMImplementation JavaDoc;
29 import org.w3c.dom.Document JavaDoc;
30 import org.w3c.dom.DocumentType JavaDoc;
31
32 /**
33  * DOMImplementation method for the LazyDOM.
34
35  * @see org.w3c.dom.DOMImplementation
36  */

37 public class LazyDOMImplementation extends DOMImplementationImpl {
38     /** DOM implementation singleton. */
39     private static LazyDOMImplementation fSingleton;
40
41     /**
42      * Obtain and return the singleton shared object.
43      */

44     public static DOMImplementation JavaDoc getDOMImplementation() {
45         if (fSingleton == null) {
46             fSingleton = new LazyDOMImplementation();
47         }
48         return fSingleton;
49     }
50     
51     /**
52      * Create a new LazyDocument
53      * @see org.w3c.dom.DOMImplementation#createDocument
54      */

55     public Document JavaDoc createDocument(String JavaDoc namespaceURI,
56                                    String JavaDoc qualifiedName,
57                                    DocumentType JavaDoc doctype) throws DOMException JavaDoc {
58         LazyDocument doc = new LazyDocument(doctype, null);
59         doc.appendChild(doc.createElementNS(namespaceURI, qualifiedName));
60         return doc;
61     }
62
63
64     /**
65      * Create a new LazyDocumentType
66      * @see org.w3c.dom.DOMImplementation#createDocumentType
67      */

68     public DocumentType JavaDoc createDocumentType(String JavaDoc qualifiedName,
69                                            String JavaDoc publicID,
70                                            String JavaDoc systemID) {
71         LazyDocumentType docType = new LazyDocumentType(null,
72                                                         null,
73                                                         qualifiedName,
74                                                         publicID,
75                                                         systemID,
76                                                         null);
77         return docType;
78     }
79
80
81     /**
82      * Create a new LazyDocument from a template.
83      * @see org.w3c.dom.DOMImplementation#createDocument
84      */

85     public Document JavaDoc createDocument(TemplateDOM templateDOM) throws DOMException JavaDoc {
86         return new LazyDocument(null, templateDOM);
87     }
88 }
89
Popular Tags