1. /*
  2. * Copyright (c) 2001 World Wide Web Consortium,
  3. * (Massachusetts Institute of Technology, Institut National de
  4. * Recherche en Informatique et en Automatique, Keio University). All
  5. * Rights Reserved. This program is distributed under the W3C's Software
  6. * Intellectual Property License. This program is distributed in the
  7. * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
  8. * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  9. * PURPOSE.
  10. * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
  11. */
  12. package com.sun.org.apache.xerces.internal.dom3.as;
  13. import org.w3c.dom.DOMException;
  14. /**
  15. * @deprecated
  16. * Objects implementing the <code>ASNamedObjectMap</code> interface are used
  17. * to represent collections of abstract schema nodes that can be accessed by
  18. * name. Note that <code>ASNamedObjectMap</code> does not inherit from
  19. * <code>ASObjectList</code> <code>ASNamedObjectMaps</code> are not
  20. * maintained in any particular order. Objects contained in an object
  21. * implementing <code>ASNamedObjectMap</code> may also be accessed by an
  22. * ordinal index, but this is simply to allow convenient enumeration of the
  23. * contents of a <code>ASNamedObjectMap</code>, and does not imply that the
  24. * DOM specifies an order to these <code>ASObjects</code>.
  25. * <p><code>ASNamedObjectMap</code> object in the DOM are live.
  26. * <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
  27. and Save Specification</a>.
  28. */
  29. public interface ASNamedObjectMap {
  30. /**
  31. * The number of <code>ASObjects</code> in the <code>ASObjectList</code>.
  32. * The range of valid child node indices is 0 to <code>length-1</code>
  33. * inclusive.
  34. */
  35. public int getLength();
  36. /**
  37. * Retrieves an <code>ASObject</code> specified by name.
  38. * @param name The <code>nodeName</code> of an <code>ASObject</code> to
  39. * retrieve.
  40. * @return An <code>ASObject</code> with specified node name and
  41. * <code>null</code> if the map does not contain an element with the
  42. * given name.
  43. */
  44. public ASObject getNamedItem(String name);
  45. /**
  46. * Retrieves an <code>ASObject</code> specified by local name and
  47. * namespace URI.
  48. * @param namespaceURI The namespace URI of the <code>ASObject</code> to
  49. * retrieve.
  50. * @param localName The local name of the <code>ASObject</code> to
  51. * retrieve.
  52. * @return A <code>ASObject</code> (of any type) with the specified local
  53. * name and namespace URI, or <code>null</code> if they do not
  54. * identify any <code>ASObject</code> in this map.
  55. */
  56. public ASObject getNamedItemNS(String namespaceURI,
  57. String localName);
  58. /**
  59. * Returns the <code>index</code>th item in the map. The index starts at
  60. * <code>0</code>. If <code>index</code> is greater than or equal to the
  61. * number of nodes in the list, this returns <code>null</code>.
  62. * @param index The position in the map from which the item is to be
  63. * retrieved.
  64. * @return The <code>ASObject</code> at the <code>index</code>th position
  65. * in the <code>ASNamedObjectMap</code>, or <code>null</code> if that
  66. * is not a valid index.
  67. */
  68. public ASObject item(int index);
  69. /**
  70. * Removes an <code>ASObject</code> specified by a <code>nodeName</code>.
  71. * @param name The <code>nodeName</code> of the <code>ASObject</code> to
  72. * be removed.
  73. * @return The <code>ASObject</code> removed from this map if an
  74. * <code>ASObject</code> with such a name exists.
  75. * @exception DOMException
  76. * NOT_FOUND_ERR: Raised if there is no node named <code>name</code> in
  77. * this map.
  78. * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
  79. */
  80. public ASObject removeNamedItem(String name)
  81. throws DOMException;
  82. /**
  83. * Removes an <code>ASObject</code> specified by a namespace URI and a
  84. * local name.
  85. * @param namespaceURI The namespace URI of the <code>ASObject</code> to
  86. * be removed.
  87. * @param localName The local name of the <code>ASObject</code> to remove.
  88. * @return The <code>ASObject</code> removed from this map if an
  89. * <code>ASObject</code> with such a local name and namespace URI
  90. * exists.
  91. * @exception DOMException
  92. * NOT_FOUND_ERR: Raised if there is no node with the specified
  93. * <code>namespaceURI</code> and <code>localName</code> in this map.
  94. * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
  95. */
  96. public ASObject removeNamedItemNS(String namespaceURI,
  97. String localName)
  98. throws DOMException;
  99. /**
  100. * Adds an <code>ASObject</code> using its <code>nodeName</code>
  101. * attribute. If an <code>ASObject</code> with that name is already
  102. * present in this map, it is replaced by the new one.
  103. * @param newASObject The <code>ASObject</code> to be inserted in the map
  104. * with its <code>nodeName</code> as the key.
  105. * @return If the new node replaces an existing one, the replaced node is
  106. * returned, otherwise <code>null</code>.
  107. * @exception DOMException
  108. * WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a
  109. * different <code>ASModel</code> than the one that created this map.
  110. * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
  111. * <br>HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a node
  112. * doesn't belong in this <code>ASNamedObjectMap</code>.
  113. */
  114. public ASObject setNamedItem(ASObject newASObject)
  115. throws DOMException;
  116. /**
  117. * Adds an <code>ASObject</code> using its <code>namespaceURI</code> and
  118. * <code>localName</code>. If an <code>ASObject</code> with the same
  119. * <code>namespaceURI</code> and <code>localName</code> is already
  120. * present in this map, it is replaced by the new one.
  121. * @param newASObject The <code>ASObject</code> to be inserted in the
  122. * map.The <code>ASObject</code> will later be accessible using the
  123. * value of its <code>namespaceURI</code> and <code>localName</code>
  124. * attributes.
  125. * @return If the new node replaces an existing one, the replaced node is
  126. * returned, otherwise <code>null</code>.
  127. * @exception DOMException
  128. * <code>WRONG_DOCUMENT_ERR</code>: Raised if <code>arg</code> was
  129. * created from a different <code>ASModel</code> than the one that
  130. * created this map.
  131. * <br><code>NO_MODIFICATION_ALLOWED_ERR</code>: Raised if this map is
  132. * readonly.
  133. * <br><code>HIERARCHY_REQUEST_ERR</code>: Raised if an attempt is made
  134. * to add a node doesn't belong in this <code>ASNamedObjectMap</code>.
  135. */
  136. public ASObject setNamedItemNS(ASObject newASObject)
  137. throws DOMException;
  138. }