changed .classpath to relative PATH ECLIPSE_HOME
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / tidy / DOMAttrImpl.java
1 /*
2  * @(#)DOMAttrImpl.java   1.11 2000/08/16
3  *
4  */
5
6 package net.sourceforge.phpdt.tidy;
7
8 import org.w3c.dom.DOMException;
9
10 /**
11  *
12  * DOMAttrImpl
13  *
14  * (c) 1998-2000 (W3C) MIT, INRIA, Keio University
15  * See Tidy.java for the copyright notice.
16  * Derived from <a href="http://www.w3.org/People/Raggett/tidy">
17  * HTML Tidy Release 4 Aug 2000</a>
18  *
19  * @author  Dave Raggett <dsr@w3.org>
20  * @author  Andy Quick <ac.quick@sympatico.ca> (translation to Java)
21  * @version 1.4, 1999/09/04 DOM Support
22  * @version 1.5, 1999/10/23 Tidy Release 27 Sep 1999
23  * @version 1.6, 1999/11/01 Tidy Release 22 Oct 1999
24  * @version 1.7, 1999/12/06 Tidy Release 30 Nov 1999
25  * @version 1.8, 2000/01/22 Tidy Release 13 Jan 2000
26  * @version 1.9, 2000/06/03 Tidy Release 30 Apr 2000
27  * @version 1.10, 2000/07/22 Tidy Release 8 Jul 2000
28  * @version 1.11, 2000/08/16 Tidy Release 4 Aug 2000
29  */
30
31 public class DOMAttrImpl extends DOMNodeImpl implements org.w3c.dom.Attr {
32
33     protected AttVal avAdaptee;
34
35     protected DOMAttrImpl(AttVal adaptee)
36     {
37         super(null); // must override all methods of DOMNodeImpl
38         this.avAdaptee = adaptee;
39     }
40
41
42     /* --------------------- DOM ---------------------------- */
43
44     public String getNodeValue() throws DOMException
45     {
46         return getValue();
47     }
48
49     public void setNodeValue(String nodeValue) throws DOMException
50     {
51         setValue(nodeValue);
52     }
53
54     public String getNodeName()
55     {
56         return getName();
57     }
58
59     public short getNodeType()
60     {
61         return org.w3c.dom.Node.ATTRIBUTE_NODE;
62     }
63
64     public org.w3c.dom.Node getParentNode()
65     {
66         return null;
67     }
68
69     public org.w3c.dom.NodeList getChildNodes()
70     {
71         // NOT SUPPORTED
72         return null;
73     }
74
75     public org.w3c.dom.Node getFirstChild()
76     {
77         // NOT SUPPORTED
78         return null;
79     }
80
81     public org.w3c.dom.Node getLastChild()
82     {
83         // NOT SUPPORTED
84         return null;
85     }
86
87     public org.w3c.dom.Node getPreviousSibling()
88     {
89         return null;
90     }
91
92     public org.w3c.dom.Node getNextSibling()
93     {
94         return null;
95     }
96
97     public org.w3c.dom.NamedNodeMap getAttributes()
98     {
99         return null;
100     }
101
102     public org.w3c.dom.Document getOwnerDocument()
103     {
104         return null;
105     }
106
107     public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, 
108                                          org.w3c.dom.Node refChild)
109                                              throws DOMException
110     {
111         throw new DOMExceptionImpl(DOMException.NO_MODIFICATION_ALLOWED_ERR,
112                                    "Not supported");
113     }
114
115     public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, 
116                                          org.w3c.dom.Node oldChild)
117                                              throws DOMException
118     {
119         throw new DOMExceptionImpl(DOMException.NO_MODIFICATION_ALLOWED_ERR,
120                                    "Not supported");
121     }
122
123     public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
124                                             throws DOMException
125     {
126         throw new DOMExceptionImpl(DOMException.NO_MODIFICATION_ALLOWED_ERR,
127                                    "Not supported");
128     }
129
130     public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
131                                             throws DOMException
132     {
133         throw new DOMExceptionImpl(DOMException.NO_MODIFICATION_ALLOWED_ERR,
134                                    "Not supported");
135     }
136
137     public boolean hasChildNodes()
138     {
139         return false;
140     }
141
142     public org.w3c.dom.Node cloneNode(boolean deep)
143     {
144         return null;
145     }
146
147     /**
148      * @see org.w3c.dom.Attr#getName
149      */
150     public String getName()
151     {
152         return avAdaptee.attribute;
153     }
154
155     /**
156      * @see org.w3c.dom.Attr#getSpecified
157      */
158     public boolean getSpecified()
159     {
160         return true;
161     }
162
163     /**
164      * Returns value of this attribute.  If this attribute has a null value,
165      * then the attribute name is returned instead.
166      * Thanks to Brett Knights <brett@knightsofthenet.com> for this fix.
167      * @see org.w3c.dom.Attr#getValue
168      * 
169      */
170     public String getValue()
171     {
172         return (avAdaptee.value == null) ? avAdaptee.attribute : avAdaptee.value ;
173     }
174
175     /**
176      * @see org.w3c.dom.Attr#setValue
177      */
178     public void setValue(String value)
179     {
180         avAdaptee.value = value;
181     }
182
183     /**
184      * DOM2 - not implemented.
185      */
186     public org.w3c.dom.Element getOwnerElement() {
187         return null;
188     }
189
190 }