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