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