Source code: com/port80/html/tidy/DOMAttrMapImpl.java
1 /*
2 * @(#)DOMAttrMapImpl.java 1.11 2000/08/16
3 *
4 */
5
6 package com.port80.html.tidy;
7
8 import org.w3c.dom.DOMException;
9
10
11 /**
12 *
13 * DOMAttrMapImpl
14 *
15 * (c) 1998-2000 (W3C) MIT, INRIA, Keio University
16 * See Tidy.java for the copyright notice.
17 * Derived from <a href="http://www.w3.org/People/Raggett/tidy">
18 * HTML Tidy Release 4 Aug 2000</a>
19 *
20 * @author Dave Raggett <dsr@w3.org>
21 * @author Andy Quick <ac.quick@sympatico.ca> (translation to Java)
22 * @version 1.4, 1999/09/04 DOM support
23 * @version 1.5, 1999/10/23 Tidy Release 27 Sep 1999
24 * @version 1.6, 1999/11/01 Tidy Release 22 Oct 1999
25 * @version 1.7, 1999/12/06 Tidy Release 30 Nov 1999
26 * @version 1.8, 2000/01/22 Tidy Release 13 Jan 2000
27 * @version 1.9, 2000/06/03 Tidy Release 30 Apr 2000
28 * @version 1.10, 2000/07/22 Tidy Release 8 Jul 2000
29 * @version 1.11, 2000/08/16 Tidy Release 4 Aug 2000
30 */
31
32 public class DOMAttrMapImpl implements org.w3c.dom.NamedNodeMap {
33
34 private AttVal first = null;
35
36 protected DOMAttrMapImpl(AttVal first)
37 {
38 this.first = first;
39 }
40
41 /**
42 * @see org.w3c.dom.NamedNodeMap#getNamedItem
43 */
44 public org.w3c.dom.Node getNamedItem(String name)
45 {
46 AttVal att = this.first;
47 while (att != null) {
48 if (att.attribute.equals(name)) break;
49 att = att.next;
50 }
51 if (att != null)
52 return att.getAdapter();
53 else
54 return null;
55 }
56
57 /**
58 * @see org.w3c.dom.NamedNodeMap#setNamedItem
59 */
60 public org.w3c.dom.Node setNamedItem(org.w3c.dom.Node arg)
61 throws DOMException
62 {
63 // NOT SUPPORTED
64 return null;
65 }
66
67 /**
68 * @see org.w3c.dom.NamedNodeMap#removeNamedItem
69 */
70 public org.w3c.dom.Node removeNamedItem(String name)
71 throws DOMException
72 {
73 // NOT SUPPORTED
74 return null;
75 }
76
77 /**
78 * @see org.w3c.dom.NamedNodeMap#item
79 */
80 public org.w3c.dom.Node item(int index)
81 {
82 int i = 0;
83 AttVal att = this.first;
84 while (att != null) {
85 if (i >= index) break;
86 i++;
87 att = att.next;
88 }
89 if (att != null)
90 return att.getAdapter();
91 else
92 return null;
93 }
94
95 /**
96 * @see org.w3c.dom.NamedNodeMap#getLength
97 */
98 public int getLength()
99 {
100 int len = 0;
101 AttVal att = this.first;
102 while (att != null) {
103 len++;
104 att = att.next;
105 }
106 return len;
107 }
108
109 /**
110 * DOM2 - not implemented.
111 */
112 public org.w3c.dom.Node getNamedItemNS(String namespaceURI,
113 String localName)
114 {
115 return null;
116 }
117
118 /**
119 * DOM2 - not implemented.
120 * @exception org.w3c.dom.DOMException
121 */
122 public org.w3c.dom.Node setNamedItemNS(org.w3c.dom.Node arg)
123 throws org.w3c.dom.DOMException
124 {
125 return null;
126 }
127
128 /**
129 * DOM2 - not implemented.
130 * @exception org.w3c.dom.DOMException
131 */
132 public org.w3c.dom.Node removeNamedItemNS(String namespaceURI,
133 String localName)
134 throws org.w3c.dom.DOMException
135 {
136 return null;
137 }
138
139 }