001 /*
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
003 *
004 * This code is free software; you can redistribute it and/or modify it
005 * under the terms of the GNU General Public License version 2 only, as
006 * published by the Free Software Foundation. Sun designates this
007 * particular file as subject to the "Classpath" exception as provided
008 * by Sun in the LICENSE file that accompanied this code.
009 *
010 * This code is distributed in the hope that it will be useful, but WITHOUT
011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
013 * version 2 for more details (a copy is included in the LICENSE file that
014 * accompanied this code).
015 *
016 * You should have received a copy of the GNU General Public License version
017 * 2 along with this work; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
019 *
020 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
021 * CA 95054 USA or visit www.sun.com if you need additional information or
022 * have any questions.
023 */
024
025 /*
026 * This file is available under and governed by the GNU General Public
027 * License version 2 only, as published by the Free Software Foundation.
028 * However, the following notice accompanied the original version of this
029 * file and, per its terms, should not be removed:
030 *
031 * Copyright (c) 2004 World Wide Web Consortium,
032 *
033 * (Massachusetts Institute of Technology, European Research Consortium for
034 * Informatics and Mathematics, Keio University). All Rights Reserved. This
035 * work is distributed under the W3C(r) Software License [1] in the hope that
036 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
037 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
038 *
039 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
040 */
041
042 package org.w3c.dom;
043
044 /**
045 * The <code>DOMImplementation</code> interface provides a number of methods
046 * for performing operations that are independent of any particular instance
047 * of the document object model.
048 * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
049 */
050 public interface DOMImplementation {
051 /**
052 * Test if the DOM implementation implements a specific feature and
053 * version, as specified in <a href="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#DOMFeatures">DOM Features</a>.
054 * @param feature The name of the feature to test.
055 * @param version This is the version number of the feature to test.
056 * @return <code>true</code> if the feature is implemented in the
057 * specified version, <code>false</code> otherwise.
058 */
059 public boolean hasFeature(String feature, String version);
060
061 /**
062 * Creates an empty <code>DocumentType</code> node. Entity declarations
063 * and notations are not made available. Entity reference expansions and
064 * default attribute additions do not occur..
065 * @param qualifiedName The qualified name of the document type to be
066 * created.
067 * @param publicId The external subset public identifier.
068 * @param systemId The external subset system identifier.
069 * @return A new <code>DocumentType</code> node with
070 * <code>Node.ownerDocument</code> set to <code>null</code>.
071 * @exception DOMException
072 * INVALID_CHARACTER_ERR: Raised if the specified qualified name is not
073 * an XML name according to [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>].
074 * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
075 * malformed.
076 * <br>NOT_SUPPORTED_ERR: May be raised if the implementation does not
077 * support the feature "XML" and the language exposed through the
078 * Document does not support XML Namespaces (such as [<a href='http://www.w3.org/TR/1999/REC-html401-19991224/'>HTML 4.01</a>]).
079 * @since DOM Level 2
080 */
081 public DocumentType createDocumentType(String qualifiedName,
082 String publicId, String systemId) throws DOMException;
083
084 /**
085 * Creates a DOM Document object of the specified type with its document
086 * element.
087 * <br>Note that based on the <code>DocumentType</code> given to create
088 * the document, the implementation may instantiate specialized
089 * <code>Document</code> objects that support additional features than
090 * the "Core", such as "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
091 * . On the other hand, setting the <code>DocumentType</code> after the
092 * document was created makes this very unlikely to happen.
093 * Alternatively, specialized <code>Document</code> creation methods,
094 * such as <code>createHTMLDocument</code> [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
095 * , can be used to obtain specific types of <code>Document</code>
096 * objects.
097 * @param namespaceURI The namespace URI of the document element to
098 * create or <code>null</code>.
099 * @param qualifiedName The qualified name of the document element to be
100 * created or <code>null</code>.
101 * @param doctype The type of document to be created or <code>null</code>.
102 * When <code>doctype</code> is not <code>null</code>, its
103 * <code>Node.ownerDocument</code> attribute is set to the document
104 * being created.
105 * @return A new <code>Document</code> object with its document element.
106 * If the <code>NamespaceURI</code>, <code>qualifiedName</code>, and
107 * <code>doctype</code> are <code>null</code>, the returned
108 * <code>Document</code> is empty with no document element.
109 * @exception DOMException
110 * INVALID_CHARACTER_ERR: Raised if the specified qualified name is not
111 * an XML name according to [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>].
112 * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
113 * malformed, if the <code>qualifiedName</code> has a prefix and the
114 * <code>namespaceURI</code> is <code>null</code>, or if the
115 * <code>qualifiedName</code> is <code>null</code> and the
116 * <code>namespaceURI</code> is different from <code>null</code>, or
117 * if the <code>qualifiedName</code> has a prefix that is "xml" and
118 * the <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'>
119 * http://www.w3.org/XML/1998/namespace</a>" [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
120 * , or if the DOM implementation does not support the
121 * <code>"XML"</code> feature but a non-null namespace URI was
122 * provided, since namespaces were defined by XML.
123 * <br>WRONG_DOCUMENT_ERR: Raised if <code>doctype</code> has already
124 * been used with a different document or was created from a different
125 * implementation.
126 * <br>NOT_SUPPORTED_ERR: May be raised if the implementation does not
127 * support the feature "XML" and the language exposed through the
128 * Document does not support XML Namespaces (such as [<a href='http://www.w3.org/TR/1999/REC-html401-19991224/'>HTML 4.01</a>]).
129 * @since DOM Level 2
130 */
131 public Document createDocument(String namespaceURI,
132 String qualifiedName, DocumentType doctype)
133 throws DOMException;
134
135 /**
136 * This method returns a specialized object which implements the
137 * specialized APIs of the specified feature and version, as specified
138 * in <a href="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#DOMFeatures">DOM Features</a>. The specialized object may also be obtained by using
139 * binding-specific casting methods but is not necessarily expected to,
140 * as discussed in . This method also allow the implementation to
141 * provide specialized objects which do not support the
142 * <code>DOMImplementation</code> interface.
143 * @param feature The name of the feature requested. Note that any plus
144 * sign "+" prepended to the name of the feature will be ignored since
145 * it is not significant in the context of this method.
146 * @param version This is the version number of the feature to test.
147 * @return Returns an object which implements the specialized APIs of
148 * the specified feature and version, if any, or <code>null</code> if
149 * there is no object which implements interfaces associated with that
150 * feature. If the <code>DOMObject</code> returned by this method
151 * implements the <code>DOMImplementation</code> interface, it must
152 * delegate to the primary core <code>DOMImplementation</code> and not
153 * return results inconsistent with the primary core
154 * <code>DOMImplementation</code> such as <code>hasFeature</code>,
155 * <code>getFeature</code>, etc.
156 * @since DOM Level 3
157 */
158 public Object getFeature(String feature, String version);
159
160 }
|