1
2
3
4
5
6
7
8 package org.dom4j.dtd;
9
10 /***
11 * <p>
12 * <code>AttributeDecl</code> represents an attribute declaration in a DTD.
13 * </p>
14 *
15 * @author <a href="mailto:james.strachan@metastuff.com">James Strachan </a>
16 * @version $Revision: 1.7 $
17 */
18 public class AttributeDecl {
19 /*** Holds value of property elementName. */
20 private String elementName;
21
22 /*** Holds value of property attributeName. */
23 private String attributeName;
24
25 /*** Holds value of property type. */
26 private String type;
27
28 /*** Holds value of property value. */
29 private String value;
30
31 /*** Holds value of property valueDefault. */
32 private String valueDefault;
33
34 public AttributeDecl() {
35 }
36
37 public AttributeDecl(String elementName, String attributeName, String type,
38 String valueDefault, String value) {
39 this.elementName = elementName;
40 this.attributeName = attributeName;
41 this.type = type;
42 this.value = value;
43 this.valueDefault = valueDefault;
44 }
45
46 /***
47 * Getter for property elementName.
48 *
49 * @return Value of property elementName.
50 */
51 public String getElementName() {
52 return elementName;
53 }
54
55 /***
56 * Setter for property elementName.
57 *
58 * @param elementName
59 * New value of property elementName.
60 */
61 public void setElementName(String elementName) {
62 this.elementName = elementName;
63 }
64
65 /***
66 * Getter for property attributeName.
67 *
68 * @return Value of property attributeName.
69 */
70 public String getAttributeName() {
71 return attributeName;
72 }
73
74 /***
75 * Setter for property attributeName.
76 *
77 * @param attributeName
78 * New value of property attributeName.
79 */
80 public void setAttributeName(String attributeName) {
81 this.attributeName = attributeName;
82 }
83
84 /***
85 * Getter for property type.
86 *
87 * @return Value of property type.
88 */
89 public String getType() {
90 return type;
91 }
92
93 /***
94 * Setter for property type.
95 *
96 * @param type
97 * New value of property type.
98 */
99 public void setType(String type) {
100 this.type = type;
101 }
102
103 /***
104 * Getter for property value.
105 *
106 * @return Value of property value.
107 */
108 public String getValue() {
109 return value;
110 }
111
112 /***
113 * Setter for property value.
114 *
115 * @param value
116 * New value of property value.
117 */
118 public void setValue(String value) {
119 this.value = value;
120 }
121
122 /***
123 * Getter for property valueDefault.
124 *
125 * @return Value of property valueDefault.
126 */
127 public String getValueDefault() {
128 return valueDefault;
129 }
130
131 /***
132 * Setter for property valueDefault.
133 *
134 * @param valueDefault
135 * New value of property valueDefault.
136 */
137 public void setValueDefault(String valueDefault) {
138 this.valueDefault = valueDefault;
139 }
140
141 public String toString() {
142 StringBuffer buffer = new StringBuffer("<!ATTLIST ");
143 buffer.append(elementName);
144 buffer.append(" ");
145 buffer.append(attributeName);
146 buffer.append(" ");
147 buffer.append(type);
148 buffer.append(" ");
149
150 if (valueDefault != null) {
151 buffer.append(valueDefault);
152
153 if (valueDefault.equals("#FIXED")) {
154 buffer.append(" \"");
155 buffer.append(value);
156 buffer.append("\"");
157 }
158 } else {
159 buffer.append("\"");
160 buffer.append(value);
161 buffer.append("\"");
162 }
163
164 buffer.append(">");
165
166 return buffer.toString();
167 }
168 }
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205