1adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project/*
2320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * Copyright (c) 2004 World Wide Web Consortium,
3320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson *
4320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * (Massachusetts Institute of Technology, European Research Consortium for
5320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * Informatics and Mathematics, Keio University). All Rights Reserved. This
6320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * work is distributed under the W3C(r) Software License [1] in the hope that
7320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
8320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson *
10320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
11adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */
12adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project
13adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Projectpackage org.w3c.dom;
14adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project
15adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project/**
16f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * The <code>DOMImplementation</code> interface provides a number of methods
17f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * for performing operations that are independent of any particular instance
18adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * of the document object model.
19320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <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>.
20adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */
21adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Projectpublic interface DOMImplementation {
22adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project    /**
23f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * Test if the DOM implementation implements a specific feature and
24320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson     * version, as specified in .
25f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * @param feature  The name of the feature to test.
26f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * @param version  This is the version number of the feature to test.
27f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * @return <code>true</code> if the feature is implemented in the
28adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project     *   specified version, <code>false</code> otherwise.
29adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project     */
30f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes    public boolean hasFeature(String feature,
31adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project                              String version);
32adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project
33adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project    /**
34f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * Creates an empty <code>DocumentType</code> node. Entity declarations
35f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * and notations are not made available. Entity reference expansions and
36320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson     * default attribute additions do not occur..
37f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * @param qualifiedName The qualified name of the document type to be
38320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson     *   created.
39adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project     * @param publicId The external subset public identifier.
40adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project     * @param systemId The external subset system identifier.
41f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * @return A new <code>DocumentType</code> node with
42adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project     *   <code>Node.ownerDocument</code> set to <code>null</code>.
43adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project     * @exception DOMException
44f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   INVALID_CHARACTER_ERR: Raised if the specified qualified name is not
45320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson     *   an XML name according to [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>].
46f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
47adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project     *   malformed.
48f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   <br>NOT_SUPPORTED_ERR: May be raised if the implementation does not
49f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   support the feature "XML" and the language exposed through the
50f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   Document does not support XML Namespaces (such as [<a href='http://www.w3.org/TR/1999/REC-html401-19991224/'>HTML 4.01</a>]).
51adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project     * @since DOM Level 2
52adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project     */
53f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes    public DocumentType createDocumentType(String qualifiedName,
54f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes                                           String publicId,
55adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project                                           String systemId)
56adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project                                           throws DOMException;
57adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project
58adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project    /**
59f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * Creates a DOM Document object of the specified type with its document
60320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson     * element.
61f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * <br>Note that based on the <code>DocumentType</code> given to create
62f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * the document, the implementation may instantiate specialized
63f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * <code>Document</code> objects that support additional features than
64320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson     * the "Core", such as "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
65f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * . On the other hand, setting the <code>DocumentType</code> after the
66f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * document was created makes this very unlikely to happen.
67f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * Alternatively, specialized <code>Document</code> creation methods,
68320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson     * such as <code>createHTMLDocument</code> [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
69f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * , can be used to obtain specific types of <code>Document</code>
70320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson     * objects.
71f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * @param namespaceURI The namespace URI of the document element to
72320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson     *   create or <code>null</code>.
73f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * @param qualifiedName The qualified name of the document element to be
74320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson     *   created or <code>null</code>.
75adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project     * @param doctype The type of document to be created or <code>null</code>.
76f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   When <code>doctype</code> is not <code>null</code>, its
77f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   <code>Node.ownerDocument</code> attribute is set to the document
78adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project     *   being created.
79f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * @return A new <code>Document</code> object with its document element.
80f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   If the <code>NamespaceURI</code>, <code>qualifiedName</code>, and
81f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   <code>doctype</code> are <code>null</code>, the returned
82320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson     *   <code>Document</code> is empty with no document element.
83adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project     * @exception DOMException
84f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   INVALID_CHARACTER_ERR: Raised if the specified qualified name is not
85320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson     *   an XML name according to [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>].
86f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
87f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   malformed, if the <code>qualifiedName</code> has a prefix and the
88f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   <code>namespaceURI</code> is <code>null</code>, or if the
89f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   <code>qualifiedName</code> is <code>null</code> and the
90f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   <code>namespaceURI</code> is different from <code>null</code>, or
91f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   if the <code>qualifiedName</code> has a prefix that is "xml" and
92320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson     *   the <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'>
93320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson     *   http://www.w3.org/XML/1998/namespace</a>" [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
94f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   , or if the DOM implementation does not support the
95f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   <code>"XML"</code> feature but a non-null namespace URI was
96320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson     *   provided, since namespaces were defined by XML.
97f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   <br>WRONG_DOCUMENT_ERR: Raised if <code>doctype</code> has already
98f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   been used with a different document or was created from a different
99adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project     *   implementation.
100f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   <br>NOT_SUPPORTED_ERR: May be raised if the implementation does not
101f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   support the feature "XML" and the language exposed through the
102f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   Document does not support XML Namespaces (such as [<a href='http://www.w3.org/TR/1999/REC-html401-19991224/'>HTML 4.01</a>]).
103adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project     * @since DOM Level 2
104adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project     */
105f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes    public Document createDocument(String namespaceURI,
106f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes                                   String qualifiedName,
107adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project                                   DocumentType doctype)
108adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project                                   throws DOMException;
109adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project
110320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson    /**
111f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *  This method returns a specialized object which implements the
112f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * specialized APIs of the specified feature and version, as specified
113f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * in . The specialized object may also be obtained by using
114f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * binding-specific casting methods but is not necessarily expected to,
115f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * as discussed in . This method also allow the implementation to
116f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * provide specialized objects which do not support the
117f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * <code>DOMImplementation</code> interface.
118f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * @param feature  The name of the feature requested. Note that any plus
119f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   sign "+" prepended to the name of the feature will be ignored since
120f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   it is not significant in the context of this method.
121f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * @param version  This is the version number of the feature to test.
122f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     * @return  Returns an object which implements the specialized APIs of
123f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   the specified feature and version, if any, or <code>null</code> if
124f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   there is no object which implements interfaces associated with that
125f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   feature. If the <code>DOMObject</code> returned by this method
126f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   implements the <code>DOMImplementation</code> interface, it must
127f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   delegate to the primary core <code>DOMImplementation</code> and not
128f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   return results inconsistent with the primary core
129f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   <code>DOMImplementation</code> such as <code>hasFeature</code>,
130f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes     *   <code>getFeature</code>, etc.
131320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson     * @since DOM Level 3
132320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson     */
133f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes    public Object getFeature(String feature,
134320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson                             String version);
135320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson
136adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project}
137