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