1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.ws.commons.schema;
21
22 import org.apache.ws.commons.schema.constants.Constants;
23
24 import javax.xml.namespace.QName;
25
26
27
28
29
30
31 public class XmlSchemaElement extends XmlSchemaParticle implements TypeReceiver {
32
33
34
35
36 XmlSchemaDerivationMethod block;
37
38
39
40
41
42 XmlSchemaDerivationMethod blockResolved;
43 XmlSchemaObjectCollection constraints;
44
45
46
47
48
49 String defaultValue;
50 String fixedValue;
51
52
53
54
55
56 Object elementType;
57
58 XmlSchemaDerivationMethod finalDerivation;
59 XmlSchemaDerivationMethod finalDerivationResolved;
60
61
62
63
64
65 XmlSchemaForm form;
66 boolean isAbstract;
67 boolean isNillable;
68 String name;
69 QName qualifiedName;
70 QName refName;
71
72
73
74
75
76 XmlSchemaType schemaType;
77
78
79
80
81
82 QName schemaTypeName;
83
84
85
86
87 QName substitutionGroup;
88
89
90
91
92 public XmlSchemaElement() {
93 constraints = new XmlSchemaObjectCollection();
94 isAbstract = false;
95 isNillable = false;
96 form = new XmlSchemaForm(XmlSchemaForm.NONE);
97 finalDerivation = new XmlSchemaDerivationMethod(Constants.BlockConstants.NONE);
98 block = new XmlSchemaDerivationMethod(Constants.BlockConstants.NONE);
99 }
100
101
102
103
104 public XmlSchemaObjectCollection getConstraints() {
105 return constraints;
106 }
107
108 public String getDefaultValue() {
109 return defaultValue;
110 }
111
112 public void setDefaultValue(String defaultValue) {
113 this.defaultValue = defaultValue;
114 }
115
116 public XmlSchemaDerivationMethod getBlock() {
117 return block;
118 }
119
120 public void setBlock(XmlSchemaDerivationMethod block) {
121 this.block = block;
122 }
123
124 public XmlSchemaDerivationMethod getFinal() {
125 return finalDerivation;
126 }
127
128 public void setFinal(XmlSchemaDerivationMethod finalDerivation) {
129 this.finalDerivation = finalDerivation;
130 }
131
132 public XmlSchemaDerivationMethod getBlockResolved() {
133 return blockResolved;
134 }
135
136 public String getFixedValue() {
137 return fixedValue;
138 }
139
140 public void setFixedValue(String fixedValue) {
141 this.fixedValue = fixedValue;
142 }
143
144 public Object getElementType() {
145 return elementType;
146 }
147
148 public XmlSchemaForm getForm() {
149 return form;
150 }
151
152 public void setForm(XmlSchemaForm form) {
153 this.form = form;
154 }
155
156 public boolean isAbstract() {
157 return isAbstract;
158 }
159
160 public void setAbstract(boolean isAbstract) {
161 this.isAbstract = isAbstract;
162 }
163
164 public boolean isNillable() {
165 return isNillable;
166 }
167
168 public void setNillable(boolean isNillable) {
169 this.isNillable = isNillable;
170 }
171
172 public String getName() {
173 return name;
174 }
175
176 public void setName(String name) {
177 this.name = name;
178 }
179
180 public QName getRefName() {
181 return refName;
182 }
183
184 public void setRefName(QName refName) {
185 this.refName = refName;
186 }
187
188 public QName getQName() {
189 return qualifiedName;
190 }
191
192 public void setQName(QName qualifiedName) {
193 this.qualifiedName = qualifiedName;
194 }
195
196 public XmlSchemaType getSchemaType() {
197 return schemaType;
198 }
199
200 public void setSchemaType(XmlSchemaType schemaType) {
201 this.schemaType = schemaType;
202 }
203
204 public QName getSchemaTypeName() {
205 return schemaTypeName;
206 }
207
208 public void setSchemaTypeName(QName schemaTypeName) {
209 this.schemaTypeName = schemaTypeName;
210 }
211
212 public QName getSubstitutionGroup() {
213 return substitutionGroup;
214 }
215
216 public void setSubstitutionGroup(QName substitutionGroup) {
217 this.substitutionGroup = substitutionGroup;
218 }
219
220 public String toString(String prefix, int tab) {
221 String xml = new String();
222
223 if (!prefix.equals("") && prefix.indexOf(":") == -1)
224 prefix += ":";
225
226 for (int i = 0; i < tab; i++)
227 xml += "\t";
228
229 xml += "<" + prefix + "element ";
230
231 if (!name.equals(""))
232 xml += "name=\"" + name + "\" ";
233
234 if (schemaTypeName != null)
235 xml += "type=\"" + schemaTypeName + "\"";
236
237 if (refName != null)
238 xml += "ref=\"" + refName + "\" ";
239
240 if (minOccurs != 1)
241 xml += "minOccurs=\"" + minOccurs + "\" ";
242
243 if (maxOccurs != 1)
244 xml += "maxOccurs=\"" + maxOccurs + "\" ";
245
246 if (isNillable)
247 xml += "nillable=\"" + isNillable + "\" ";
248
249 xml += ">\n";
250
251 if (constraints != null)
252 xml += constraints.toString(prefix, (tab + 1));
253
254 if (schemaType != null) {
255 xml += schemaType.toString(prefix, (tab + 1));
256 }
257 for (int i = 0; i < tab; i++)
258 xml += "\t";
259
260 xml += "</" + prefix + "element>\n";
261
262 return xml;
263 }
264
265 public void setType(XmlSchemaType type) {
266 this.schemaType = type;
267 }
268 }