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
25
26
27
28
29
30 public class XmlSchemaComplexType extends XmlSchemaType {
31 XmlSchemaAnyAttribute anyAttribute, attributeWildcard;
32 XmlSchemaObjectCollection attributes;
33 XmlSchemaObjectTable attributeUses;
34 XmlSchemaDerivationMethod block, blockResolved;
35 XmlSchemaContentModel contentModel;
36 XmlSchemaContentType contentType;
37 XmlSchemaParticle particleType, particle;
38 boolean isAbstract, isMixed;
39
40
41
42
43 public XmlSchemaComplexType(XmlSchema schema) {
44 super(schema);
45 attributes = new XmlSchemaObjectCollection();
46 block = new XmlSchemaDerivationMethod(Constants.BlockConstants.NONE);
47 isAbstract = false;
48 isMixed = false;
49 }
50
51 public XmlSchemaAnyAttribute getAnyAttribute() {
52 return anyAttribute;
53 }
54
55 public void setAnyAttribute(XmlSchemaAnyAttribute anyAttribute) {
56 this.anyAttribute = anyAttribute;
57 }
58
59 public XmlSchemaObjectCollection getAttributes() {
60 return attributes;
61 }
62
63 public XmlSchemaObjectTable getAttributeUses() {
64 return attributeUses;
65 }
66
67 public XmlSchemaAnyAttribute getAttributeWildcard() {
68 return attributeWildcard;
69 }
70
71 public XmlSchemaDerivationMethod getBlock() {
72 return block;
73 }
74
75 public void setBlock(XmlSchemaDerivationMethod block) {
76 this.block = block;
77 }
78
79 public XmlSchemaDerivationMethod getBlockResolved() {
80 return blockResolved;
81 }
82
83 public XmlSchemaContentModel getContentModel() {
84 return contentModel;
85 }
86
87 public void setContentModel(XmlSchemaContentModel contentModel) {
88 this.contentModel = contentModel;
89 }
90
91 public XmlSchemaContentType getContentType() {
92 return contentType;
93 }
94
95 public void setContentType(XmlSchemaContentType contentType) {
96 this.contentType = contentType;
97 }
98
99 public XmlSchemaParticle getContentTypeParticle() {
100 return particleType;
101 }
102
103 public boolean isAbstract() {
104 return isAbstract;
105 }
106
107 public void setAbstract(boolean b) {
108 isAbstract = b;
109 }
110
111 public boolean isMixed() {
112 return isMixed;
113 }
114
115 public void setMixed(boolean b) {
116 isMixed = b;
117 }
118
119 public XmlSchemaParticle getParticle() {
120 return particle;
121 }
122
123 public void setParticle(XmlSchemaParticle particle) {
124 this.particle = particle;
125 }
126
127 public String toString(String prefix, int tab) {
128 String xml = new String();
129
130 for (int i = 0; i < tab; i++)
131 xml += "\t";
132
133 if (!prefix.equals("") && prefix.indexOf(":") == -1)
134 prefix += ":";
135
136 String typeName = name != null ? name : "";
137
138 xml += "<" + prefix + "complexType name=\"" + typeName + "\">\n";
139
140 if (particle != null)
141 xml += particle.toString(prefix, (tab + 1));
142
143 if (contentModel != null)
144 xml += contentModel.toString(prefix, (tab + 1));
145
146 for (int i = 0; i < attributes.getCount(); i++) {
147 xml += attributes.getItem(i).toString(prefix, (tab + 1));
148 }
149
150 for (int i = 0; i < tab; i++)
151 xml += "\t";
152
153 xml += "</" + prefix + "complexType>\n";
154 return xml;
155 }
156 }