01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.html.dom;
18:
19: import org.apache.xerces.dom.DOMImplementationImpl;
20: import org.w3c.dom.DOMException;
21: import org.w3c.dom.html.HTMLDOMImplementation;
22: import org.w3c.dom.html.HTMLDocument;
23:
24: /**
25: * Provides number of methods for performing operations that are independent
26: * of any particular instance of the document object model. This class is
27: * unconstructable, the only way to obtain an instance of a DOM implementation
28: * is by calling the static method {@link #getDOMImplementation}.
29: *
30: * @xerces.internal
31: *
32: * @version $Revision: 447255 $ $Date: 2006-09-18 01:36:42 -0400 (Mon, 18 Sep 2006) $
33: * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
34: * @see org.w3c.dom.DOMImplementation
35: */
36: public class HTMLDOMImplementationImpl extends DOMImplementationImpl
37: implements HTMLDOMImplementation {
38:
39: /**
40: * Holds a reference to the single instance of the DOM implementation.
41: * Only one instance is required since this class is multiple entry.
42: */
43: private static HTMLDOMImplementation _instance = new HTMLDOMImplementationImpl();
44:
45: /**
46: * Private constructor assures that an object of this class cannot
47: * be created. The only way to obtain an object is by calling {@link
48: * #getDOMImplementation}.
49: */
50: private HTMLDOMImplementationImpl() {
51: }
52:
53: /**
54: * Create a new HTML document of the specified <TT>TITLE</TT> text.
55: *
56: * @param title The document title text
57: * @return New HTML document
58: */
59: public final HTMLDocument createHTMLDocument(String title)
60: throws DOMException {
61: HTMLDocument doc;
62:
63: if (title == null)
64: throw new NullPointerException(
65: "HTM014 Argument 'title' is null.");
66: doc = new HTMLDocumentImpl();
67: doc.setTitle(title);
68: return doc;
69: }
70:
71: /**
72: * Returns an instance of a {@link HTMLDOMImplementation} that can be
73: * used to perform operations that are not specific to a particular
74: * document instance, e.g. to create a new document.
75: *
76: * @return Reference to a valid DOM implementation
77: */
78: public static HTMLDOMImplementation getHTMLDOMImplementation() {
79: return _instance;
80: }
81:
82: }
|