KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > html > dom > HTMLDOMImplementationImpl


1 /*
2  * Copyright 1999,2000,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.html.dom;
17     
18
19 import org.apache.xerces.dom.DOMImplementationImpl;
20 import org.w3c.dom.DOMException JavaDoc;
21 import org.w3c.dom.html.HTMLDOMImplementation;
22 import org.w3c.dom.html.HTMLDocument;
23
24
25 /**
26  * Provides number of methods for performing operations that are independent
27  * of any particular instance of the document object model. This class is
28  * unconstructable, the only way to obtain an instance of a DOM implementation
29  * is by calling the static method {@link #getDOMImplementation}.
30  *
31  * @xerces.internal
32  *
33  * @version $Revision: 1.6 $ $Date: 2004/10/05 03:23:48 $
34  * @author <a HREF="mailto:arkin@exoffice.com">Assaf Arkin</a>
35  * @see org.w3c.dom.DOMImplementation
36  */

37 public class HTMLDOMImplementationImpl
38     extends DOMImplementationImpl
39     implements HTMLDOMImplementation
40 {
41
42
43     /**
44      * Holds a reference to the single instance of the DOM implementation.
45      * Only one instance is required since this class is multiple entry.
46      */

47     private static HTMLDOMImplementation _instance = new HTMLDOMImplementationImpl();
48
49
50     /**
51      * Private constructor assures that an object of this class cannot
52      * be created. The only way to obtain an object is by calling {@link
53      * #getDOMImplementation}.
54      */

55     private HTMLDOMImplementationImpl()
56     {
57     }
58
59
60     /**
61      * Create a new HTML document of the specified <TT>TITLE</TT> text.
62      *
63      * @param title The document title text
64      * @return New HTML document
65      */

66     public final HTMLDocument createHTMLDocument( String JavaDoc title )
67         throws DOMException JavaDoc
68     {
69     HTMLDocument doc;
70
71     if ( title == null )
72         throw new NullPointerException JavaDoc( "HTM014 Argument 'title' is null." );
73     doc = new HTMLDocumentImpl();
74     doc.setTitle( title );
75     return doc;
76     }
77
78
79     /**
80      * Returns an instance of a {@link HTMLDOMImplementation} that can be
81      * used to perform operations that are not specific to a particular
82      * document instance, e.g. to create a new document.
83      *
84      * @return Reference to a valid DOM implementation
85      */

86     public static HTMLDOMImplementation getHTMLDOMImplementation()
87     {
88     return _instance;
89     }
90
91
92 }
93
Popular Tags