KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > lobobrowser > html > domimpl > AttrImpl


1 /*
2     GNU LESSER GENERAL PUBLIC LICENSE
3     Copyright (C) 2006 The Lobo Project
4
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Lesser General Public
7     License as published by the Free Software Foundation; either
8     version 2.1 of the License, or (at your option) any later version.
9
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13     Lesser General Public License for more details.
14
15     You should have received a copy of the GNU Lesser General Public
16     License along with this library; if not, write to the Free Software
17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19     Contact info: xamjadmin@users.sourceforge.net
20 */

21 /*
22  * Created on Sep 10, 2005
23  */

24 package org.lobobrowser.html.domimpl;
25
26 import org.w3c.dom.*;
27
28 public class AttrImpl extends NodeImpl implements Attr {
29     private String JavaDoc name;
30     private String JavaDoc value;
31     private boolean specified;
32     private Element ownerElement;
33     private boolean isId;
34     
35     /**
36      * @param name
37      * @param value
38      */

39     public AttrImpl(String JavaDoc name, String JavaDoc value, boolean specified, Element owner, boolean isId) {
40         super();
41         this.name = name;
42         this.value = value;
43         this.specified = specified;
44         this.ownerElement = owner;
45         this.isId = isId;
46     }
47
48     /**
49      * @param name
50      */

51     public AttrImpl(String JavaDoc name) {
52         super();
53         this.name = name;
54         this.value = "";
55         this.specified = false;
56         this.ownerElement = null;
57         this.isId = false;
58     }
59
60     public String JavaDoc getLocalName() {
61         return this.name;
62     }
63
64     public String JavaDoc getNodeName() {
65         return this.name;
66     }
67
68     public String JavaDoc getNodeValue() throws DOMException {
69         return this.value;
70     }
71
72     public void setNodeValue(String JavaDoc nodeValue) throws DOMException {
73         this.value = nodeValue;
74     }
75
76     public short getNodeType() {
77         return Node.ATTRIBUTE_NODE;
78     }
79
80     public String JavaDoc getName() {
81         return this.name;
82     }
83
84     public boolean getSpecified() {
85         return this.specified;
86     }
87
88     public String JavaDoc getValue() {
89         return this.value;
90     }
91
92     public void setValue(String JavaDoc value) throws DOMException {
93         this.value = value;
94     }
95
96     public Element getOwnerElement() {
97         return this.ownerElement;
98     }
99
100     public TypeInfo getSchemaTypeInfo() {
101         throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Namespaces not supported");
102     }
103
104     public boolean isId() {
105         return this.isId;
106     }
107     
108     public void setId(boolean value) {
109         this.isId = value;
110     }
111
112     protected Node createSimilarNode() {
113         return new AttrImpl(this.name, this.value, this.specified, this.ownerElement, this.isId);
114     }
115 }
116
Popular Tags