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