1
2
3
4
5
6
7
8
9
10 package org.dom4j.tree;
11
12 import org.dom4j.Element;
13 import org.dom4j.Namespace;
14 import org.dom4j.QName;
15
16 /*** <p><code>DefaultAttribute</code> implements a doubly linked node which
17 * supports the parent relationship and is mutable.</p>
18 *
19 * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
20 * @version $Revision: 1.11 $
21 */
22 public class DefaultAttribute extends FlyweightAttribute {
23
24 /*** The parent of this node */
25 private Element parent;
26
27
28 public DefaultAttribute(QName qname) {
29 super(qname);
30 }
31
32 public DefaultAttribute(QName qname,String value) {
33 super(qname, value);
34 }
35
36 public DefaultAttribute(Element parent,QName qname,String value) {
37 super(qname, value);
38 this.parent = parent;
39 }
40
41 /*** Creates the <code>Attribute</code> with the specified local name
42 * and value.
43 *
44 * @param name is the name of the attribute
45 * @param value is the value of the attribute
46 */
47 public DefaultAttribute(String name,String value) {
48 super(name, value);
49 }
50
51 /*** Creates the <code>Attribute</code> with the specified local name,
52 * value and <code>Namespace</code>.
53 *
54 * @param name is the name of the attribute
55 * @param value is the value of the attribute
56 * @param namespace is the namespace of the attribute
57 */
58 public DefaultAttribute(String name,String value,Namespace namespace) {
59 super(name, value, namespace);
60 }
61
62 /*** Creates the <code>Attribute</code> with the specified local name,
63 * value and <code>Namespace</code>.
64 *
65 * @param parent is the parent element
66 * @param name is the name of the attribute
67 * @param value is the value of the attribute
68 * @param namespace is the namespace of the attribute
69 */
70 public DefaultAttribute(Element parent,String name,String value,Namespace namespace) {
71 super(name, value, namespace);
72 this.parent = parent;
73 }
74
75 public void setValue(String value) {
76 this.value = value;
77 }
78
79 public Element getParent() {
80 return parent;
81 }
82
83 public void setParent(Element parent) {
84 this.parent = parent;
85 }
86
87 public boolean supportsParent() {
88 return true;
89 }
90
91 public boolean isReadOnly() {
92 return false;
93 }
94
95 }
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143