Vector restrictdata = null;
if (type.isSimpleType())
{
//check for extended types
TypeEntry base =
CSchemaUtils.getComplexElementExtensionBase(
type.getNode(),
symbolTable);
if (base != null)
{
String localpart = type.getQName().getLocalPart() + "_value";
QName typeName =
new QName(type.getQName().getNamespaceURI(), localpart);
ElementInfo eleinfo =
new ElementInfo(
typeName,
createTypeInfo(base.getQName(), targetLanguage));
typedata.setExtensionBaseType(eleinfo);
if (WSDL2Ws.verbose)
System.out.print(
"=====complexType with simpleContent is found : "
+ type.getQName().getLocalPart()
+ "=====\n");
}
else
{
//types declared as simpleType
restrictdata =
CUtils.getRestrictionBaseAndValues(node, symbolTable);
if (restrictdata != null)
typedata.setRestrictiondata(restrictdata);
}
// There can be attributes in this extended basic type
// Process the attributes
Vector attributes =
CSchemaUtils.getContainedAttributeTypes(
type.getNode(),
symbolTable);
if (attributes != null)
{
for (int j = 0; j < attributes.size(); j += 2)
{
typedata.setTypeForAttributeName(
((QName) attributes.get(j + 1)).getLocalPart(),
createTypeInfo(
((TypeEntry) attributes.get(j)).getQName(),
targetLanguage));
}
}
}
else
if (type instanceof CollectionType)
{
typedata.setTypeNameForElementName(
new ElementInfo(
type.getQName(),
createTypeInfo(
type.getRefType().getQName(),
targetLanguage)));
typedata.setArray(true);
}
else
{
//is this a SOAPEnc array type
QName arrayType =
CSchemaUtils.getArrayComponentQName(
node,
new IntHolder(0),
symbolTable);
if (arrayType != null)
{
typedata.setTypeNameForElementName(
new ElementInfo(
new QName("item"),
createTypeInfo(arrayType, targetLanguage)));
typedata.setArray(true);
}
else
if ((arrayType =
CSchemaUtils.getCollectionComponentQName(node))
!= null)
{
typedata.setTypeNameForElementName(
new ElementInfo(
new QName("item"),
createTypeInfo(arrayType, targetLanguage)));
typedata.setArray(true);
}
//Note in a array the parameter type is stored as under the name item all the time
else
{
// get all extended types
Vector extendList = new Vector();
extendList.add(type);
TypeEntry parent =
CSchemaUtils.getComplexElementExtensionBase(
type.getNode(),
symbolTable);
while (parent != null)
{
extendList.add(parent);
parent =
CSchemaUtils.getComplexElementExtensionBase(
parent.getNode(),
symbolTable);
}
// Now generate a list of names and types starting with
// the oldest parent. (Attrs are considered before elements).
for (int i = extendList.size() - 1; i >= 0; i--)
{
TypeEntry te = (TypeEntry) extendList.elementAt(i);
//TODO the code require the attributes name at extension base types
//different, the WSDL2Ws do not support it having same name at up and below.
// The names of the inherited parms are mangled
// in case they interfere with local parms.
// String mangle = "";
//if (i > 0) {
// mangle = "_" +
// Utils.xmlNameToJava(te.getQName().getLocalPart()) +
// "_";
//}
// Process the attributes
Vector attributes =
CSchemaUtils.getContainedAttributeTypes(
te.getNode(),
symbolTable);
if (attributes != null)
{
for (int j = 0; j < attributes.size(); j += 2)
{
typedata.setTypeForAttributeName(
((QName) attributes.get(j + 1))
.getLocalPart(),
createTypeInfo(
((TypeEntry) attributes.get(j))
.getQName(),
targetLanguage));
}
}
// Process the elements
Vector elements =
CSchemaUtils.getContainedElementDeclarations(
te.getNode(),
symbolTable);
if (elements != null)
{
for (int j = 0; j < elements.size(); j++)
{