1. /*
  2. * $Id: DocumentEx.java,v 1.1.1.1 2000/11/23 01:53:35 edwingo Exp $
  3. *
  4. * The Apache Software License, Version 1.1
  5. *
  6. *
  7. * Copyright (c) 2000 The Apache Software Foundation. All rights
  8. * reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. *
  14. * 1. Redistributions of source code must retain the above copyright
  15. * notice, this list of conditions and the following disclaimer.
  16. *
  17. * 2. Redistributions in binary form must reproduce the above copyright
  18. * notice, this list of conditions and the following disclaimer in
  19. * the documentation and/or other materials provided with the
  20. * distribution.
  21. *
  22. * 3. The end-user documentation included with the redistribution,
  23. * if any, must include the following acknowledgment:
  24. * "This product includes software developed by the
  25. * Apache Software Foundation (http://www.apache.org/)."
  26. * Alternately, this acknowledgment may appear in the software itself,
  27. * if and wherever such third-party acknowledgments normally appear.
  28. *
  29. * 4. The names "Crimson" and "Apache Software Foundation" must
  30. * not be used to endorse or promote products derived from this
  31. * software without prior written permission. For written
  32. * permission, please contact apache@apache.org.
  33. *
  34. * 5. Products derived from this software may not be called "Apache",
  35. * nor may "Apache" appear in their name, without prior written
  36. * permission of the Apache Software Foundation.
  37. *
  38. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  39. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  40. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  41. * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  42. * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  43. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  44. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  45. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  46. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  47. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  48. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  49. * SUCH DAMAGE.
  50. * ====================================================================
  51. *
  52. * This software consists of voluntary contributions made by many
  53. * individuals on behalf of the Apache Software Foundation and was
  54. * originally based on software copyright (c) 1999, Sun Microsystems, Inc.,
  55. * http://www.sun.com. For more information on the Apache Software
  56. * Foundation, please see <http://www.apache.org/>.
  57. */
  58. package org.apache.crimson.tree;
  59. import java.util.Locale;
  60. import org.w3c.dom.Document;
  61. import org.w3c.dom.Node;
  62. /**
  63. * This interface extends the DOM Document model in several useful ways.
  64. * It supports: <UL>
  65. *
  66. * <LI> Application-specialized element creation and document customization
  67. * at parse time;
  68. * <LI> Document printing;
  69. * <LI> The URI with which the document is associated;
  70. * <LI> Access to elements by their XML "ID" attributes (when the
  71. * document was constructed with an appropriate XML parser);
  72. * <LI> Application-level control over the language in which
  73. * diagnostics are provided (useful for multi-language applications
  74. * such as servers);
  75. * <LI> Moving nodes between DOM Documents. (DOM Level 1 only talks
  76. * about nodes that are coupled to a single DOM document.)
  77. *
  78. * </UL>
  79. *
  80. *
  81. * @author David Brownell
  82. * @version $Revision: 1.1.1.1 $
  83. */
  84. public interface DocumentEx extends Document, XmlWritable, ElementFactory
  85. {
  86. /**
  87. * Returns the system ID (a URI) associated with the document,
  88. * or null if this is unknown.
  89. */
  90. public String getSystemId ();
  91. /**
  92. * Assigns the element factory to be used by this document.
  93. */
  94. public void setElementFactory (ElementFactory factory);
  95. /**
  96. * Returns the element factory to be used by this document.
  97. */
  98. public ElementFactory getElementFactory ();
  99. /**
  100. * Returns the element whose ID is given by the parameter; or null
  101. * if no such element is known. Element IDs are declared by
  102. * attributes of type "ID", and are commonly used for internal
  103. * linking by using attributes of type IDREF or IDREFS to turn
  104. * XML's hierarchical data structure into a directed graph.
  105. *
  106. * <P> Note that DOM itself provides no way to identify which element
  107. * attributes are declared with the "ID" attribute type. This feature
  108. * relies on interfaces which may not be publicly exposed, such as
  109. * XML processors telling a DOM builder about those attributes.
  110. *
  111. * @param id The value of the ID attribute which will be matched
  112. * by any element which is returned.
  113. * @deprecated As of DOM level 2, replaced by the method
  114. * Document.getElementById
  115. */
  116. // Note: HTML DOM has getElementById() with "Element" return type
  117. public ElementEx getElementExById (String id);
  118. /**
  119. * Returns the locale to be used for diagnostic messages.
  120. */
  121. public Locale getLocale ();
  122. /**
  123. * Assigns the locale to be used for diagnostic messages.
  124. * Multi-language applications, such as web servers dealing with
  125. * clients from different locales, need the ability to interact
  126. * with clients in languages other than the server's default.
  127. * When a Document is created, its locale is the default
  128. * locale for the virtual machine.
  129. *
  130. * @see #chooseLocale
  131. */
  132. public void setLocale (Locale locale);
  133. /**
  134. * Chooses a client locale to use for diagnostics, using the first
  135. * language specified in the list that is supported by this DOM
  136. * implementation. That locale is then automatically assigned using <a
  137. * href="#setLocale(java.util.Locale)">setLocale()</a>. Such a list
  138. * could be provided by a variety of user preference mechanisms,
  139. * including the HTTP <em>Accept-Language</em> header field.
  140. *
  141. * @see org.apache.crimson.util.MessageCatalog
  142. *
  143. * @param languages Array of language specifiers, ordered with the most
  144. * preferable one at the front. For example, "en-ca" then "fr-ca",
  145. * followed by "zh_CN". Both RFC 1766 and Java styles are supported.
  146. * @return The chosen locale, or null.
  147. */
  148. public Locale chooseLocale (String languages []);
  149. /**
  150. * Changes the "owner document" of the given node, and all child
  151. * and associated attribute nodes, to be this document. If the
  152. * node has a parent, it is first removed from that parent.
  153. *
  154. * @param node the node whose "owner" will be changed.
  155. * @exception DOMException WRONG_DOCUMENT_ERROR when attempting
  156. * to change the owner for some other DOM implementation<P>
  157. * HIERARCHY_REQUEST_ERROR when the node is a document, document
  158. * type, entity, or notation; or when it is an attribute associated
  159. * with an element whose owner is not being (recursively) changed.
  160. */
  161. public void changeNodeOwner (Node node);
  162. }