001: /*
002: * @(#)DOMAttrMapImpl.java 1.11 2000/08/16
003: *
004: */
005:
006: package org.w3c.tidy;
007:
008: import org.w3c.dom.DOMException;
009:
010: /**
011: *
012: * DOMAttrMapImpl
013: *
014: * (c) 1998-2000 (W3C) MIT, INRIA, Keio University
015: * See Tidy.java for the copyright notice.
016: * Derived from <a href="http://www.w3.org/People/Raggett/tidy">
017: * HTML Tidy Release 4 Aug 2000</a>
018: *
019: * @author Dave Raggett <dsr@w3.org>
020: * @author Andy Quick <ac.quick@sympatico.ca> (translation to Java)
021: * @version 1.4, 1999/09/04 DOM support
022: * @version 1.5, 1999/10/23 Tidy Release 27 Sep 1999
023: * @version 1.6, 1999/11/01 Tidy Release 22 Oct 1999
024: * @version 1.7, 1999/12/06 Tidy Release 30 Nov 1999
025: * @version 1.8, 2000/01/22 Tidy Release 13 Jan 2000
026: * @version 1.9, 2000/06/03 Tidy Release 30 Apr 2000
027: * @version 1.10, 2000/07/22 Tidy Release 8 Jul 2000
028: * @version 1.11, 2000/08/16 Tidy Release 4 Aug 2000
029: */
030:
031: public class DOMAttrMapImpl implements org.w3c.dom.NamedNodeMap {
032:
033: private AttVal first = null;
034:
035: protected DOMAttrMapImpl(AttVal first) {
036: this .first = first;
037: }
038:
039: /**
040: * @see org.w3c.dom.NamedNodeMap#getNamedItem
041: */
042: public org.w3c.dom.Node getNamedItem(String name) {
043: AttVal att = this .first;
044: while (att != null) {
045: if (att.attribute.equals(name))
046: break;
047: att = att.next;
048: }
049: if (att != null)
050: return att.getAdapter();
051: else
052: return null;
053: }
054:
055: /**
056: * @see org.w3c.dom.NamedNodeMap#setNamedItem
057: */
058: public org.w3c.dom.Node setNamedItem(org.w3c.dom.Node arg)
059: throws DOMException {
060: // NOT SUPPORTED
061: return null;
062: }
063:
064: /**
065: * @see org.w3c.dom.NamedNodeMap#removeNamedItem
066: */
067: public org.w3c.dom.Node removeNamedItem(String name)
068: throws DOMException {
069: // NOT SUPPORTED
070: return null;
071: }
072:
073: /**
074: * @see org.w3c.dom.NamedNodeMap#item
075: */
076: public org.w3c.dom.Node item(int index) {
077: int i = 0;
078: AttVal att = this .first;
079: while (att != null) {
080: if (i >= index)
081: break;
082: i++;
083: att = att.next;
084: }
085: if (att != null)
086: return att.getAdapter();
087: else
088: return null;
089: }
090:
091: /**
092: * @see org.w3c.dom.NamedNodeMap#getLength
093: */
094: public int getLength() {
095: int len = 0;
096: AttVal att = this .first;
097: while (att != null) {
098: len++;
099: att = att.next;
100: }
101: return len;
102: }
103:
104: /**
105: * DOM2 - not implemented.
106: */
107: public org.w3c.dom.Node getNamedItemNS(String namespaceURI,
108: String localName) {
109: return null;
110: }
111:
112: /**
113: * DOM2 - not implemented.
114: * @exception org.w3c.dom.DOMException
115: */
116: public org.w3c.dom.Node setNamedItemNS(org.w3c.dom.Node arg)
117: throws org.w3c.dom.DOMException {
118: return null;
119: }
120:
121: /**
122: * DOM2 - not implemented.
123: * @exception org.w3c.dom.DOMException
124: */
125: public org.w3c.dom.Node removeNamedItemNS(String namespaceURI,
126: String localName) throws org.w3c.dom.DOMException {
127: return null;
128: }
129:
130: }
|