001: /*
002: * Copyright (c) 2001 World Wide Web Consortium,
003: * (Massachusetts Institute of Technology, Institut National de
004: * Recherche en Informatique et en Automatique, Keio University). All
005: * Rights Reserved. This program is distributed under the W3C's Software
006: * Intellectual Property License. This program is distributed in the
007: * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
008: * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
009: * PURPOSE.
010: * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
011: */
012:
013: package org.apache.xerces.dom3.as;
014:
015: import org.w3c.dom.DOMException;
016:
017: /**
018: * @deprecated
019: * Objects implementing the <code>ASNamedObjectMap</code> interface are used
020: * to represent collections of abstract schema nodes that can be accessed by
021: * name. Note that <code>ASNamedObjectMap</code> does not inherit from
022: * <code>ASObjectList</code>; <code>ASNamedObjectMaps</code> are not
023: * maintained in any particular order. Objects contained in an object
024: * implementing <code>ASNamedObjectMap</code> may also be accessed by an
025: * ordinal index, but this is simply to allow convenient enumeration of the
026: * contents of a <code>ASNamedObjectMap</code>, and does not imply that the
027: * DOM specifies an order to these <code>ASObjects</code>.
028: * <p><code>ASNamedObjectMap</code> object in the DOM are live.
029: * <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
030: and Save Specification</a>.
031: */
032: public interface ASNamedObjectMap {
033: /**
034: * The number of <code>ASObjects</code> in the <code>ASObjectList</code>.
035: * The range of valid child node indices is 0 to <code>length-1</code>
036: * inclusive.
037: */
038: public int getLength();
039:
040: /**
041: * Retrieves an <code>ASObject</code> specified by name.
042: * @param name The <code>nodeName</code> of an <code>ASObject</code> to
043: * retrieve.
044: * @return An <code>ASObject</code> with specified node name and
045: * <code>null</code> if the map does not contain an element with the
046: * given name.
047: */
048: public ASObject getNamedItem(String name);
049:
050: /**
051: * Retrieves an <code>ASObject</code> specified by local name and
052: * namespace URI.
053: * @param namespaceURI The namespace URI of the <code>ASObject</code> to
054: * retrieve.
055: * @param localName The local name of the <code>ASObject</code> to
056: * retrieve.
057: * @return A <code>ASObject</code> (of any type) with the specified local
058: * name and namespace URI, or <code>null</code> if they do not
059: * identify any <code>ASObject</code> in this map.
060: */
061: public ASObject getNamedItemNS(String namespaceURI, String localName);
062:
063: /**
064: * Returns the <code>index</code>th item in the map. The index starts at
065: * <code>0</code>. If <code>index</code> is greater than or equal to the
066: * number of nodes in the list, this returns <code>null</code>.
067: * @param index The position in the map from which the item is to be
068: * retrieved.
069: * @return The <code>ASObject</code> at the <code>index</code>th position
070: * in the <code>ASNamedObjectMap</code>, or <code>null</code> if that
071: * is not a valid index.
072: */
073: public ASObject item(int index);
074:
075: /**
076: * Removes an <code>ASObject</code> specified by a <code>nodeName</code>.
077: * @param name The <code>nodeName</code> of the <code>ASObject</code> to
078: * be removed.
079: * @return The <code>ASObject</code> removed from this map if an
080: * <code>ASObject</code> with such a name exists.
081: * @exception DOMException
082: * NOT_FOUND_ERR: Raised if there is no node named <code>name</code> in
083: * this map.
084: * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
085: */
086: public ASObject removeNamedItem(String name) throws DOMException;
087:
088: /**
089: * Removes an <code>ASObject</code> specified by a namespace URI and a
090: * local name.
091: * @param namespaceURI The namespace URI of the <code>ASObject</code> to
092: * be removed.
093: * @param localName The local name of the <code>ASObject</code> to remove.
094: * @return The <code>ASObject</code> removed from this map if an
095: * <code>ASObject</code> with such a local name and namespace URI
096: * exists.
097: * @exception DOMException
098: * NOT_FOUND_ERR: Raised if there is no node with the specified
099: * <code>namespaceURI</code> and <code>localName</code> in this map.
100: * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
101: */
102: public ASObject removeNamedItemNS(String namespaceURI,
103: String localName) throws DOMException;
104:
105: /**
106: * Adds an <code>ASObject</code> using its <code>nodeName</code>
107: * attribute. If an <code>ASObject</code> with that name is already
108: * present in this map, it is replaced by the new one.
109: * @param newASObject The <code>ASObject</code> to be inserted in the map
110: * with its <code>nodeName</code> as the key.
111: * @return If the new node replaces an existing one, the replaced node is
112: * returned, otherwise <code>null</code>.
113: * @exception DOMException
114: * WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a
115: * different <code>ASModel</code> than the one that created this map.
116: * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
117: * <br>HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a node
118: * doesn't belong in this <code>ASNamedObjectMap</code>.
119: */
120: public ASObject setNamedItem(ASObject newASObject)
121: throws DOMException;
122:
123: /**
124: * Adds an <code>ASObject</code> using its <code>namespaceURI</code> and
125: * <code>localName</code>. If an <code>ASObject</code> with the same
126: * <code>namespaceURI</code> and <code>localName</code> is already
127: * present in this map, it is replaced by the new one.
128: * @param newASObject The <code>ASObject</code> to be inserted in the
129: * map.The <code>ASObject</code> will later be accessible using the
130: * value of its <code>namespaceURI</code> and <code>localName</code>
131: * attributes.
132: * @return If the new node replaces an existing one, the replaced node is
133: * returned, otherwise <code>null</code>.
134: * @exception DOMException
135: * <code>WRONG_DOCUMENT_ERR</code>: Raised if <code>arg</code> was
136: * created from a different <code>ASModel</code> than the one that
137: * created this map.
138: * <br><code>NO_MODIFICATION_ALLOWED_ERR</code>: Raised if this map is
139: * readonly.
140: * <br><code>HIERARCHY_REQUEST_ERR</code>: Raised if an attempt is made
141: * to add a node doesn't belong in this <code>ASNamedObjectMap</code>.
142: */
143: public ASObject setNamedItemNS(ASObject newASObject)
144: throws DOMException;
145:
146: }
|