}
List<ParticleInfo> elements = new ArrayList<ParticleInfo>();
String functionName = outputDeserializerFunctionName(outputMessage);
code.append("function " + functionName + "(cxfjsutils, partElement) {\n");
getElementsForParts(outputMessage, elements);
ParticleInfo element = elements.get(0);
XmlSchemaType type = null;
if (isRPC) {
utils.appendLine("cxfjsutils.trace('rpc element: ' + cxfjsutils.traceElementName(partElement));");
utils.appendLine("partElement = cxfjsutils.getFirstElementChild(partElement);");
utils.appendLine("cxfjsutils.trace('rpc element: ' + cxfjsutils.traceElementName(partElement));");
}
type = element.getType();
if (!element.isEmpty()) {
if (type instanceof XmlSchemaComplexType) {
String typeObjectName = nameManager.getJavascriptName(element.getControllingName());
utils
.appendLine("var returnObject = "
+ typeObjectName
+ "_deserialize (cxfjsutils, partElement);\n");
utils.appendLine("return returnObject;");
} else if (type instanceof XmlSchemaSimpleType) {
XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType)type;
utils.appendLine("var returnText = cxfjsutils.getNodeText(partElement);");
utils.appendLine("var returnObject = "
+ utils.javascriptParseExpression(simpleType, "returnText") + ";");
utils.appendLine("return returnObject;");
} else if (type != null) {
utils.appendLine("// Unsupported construct " + type.getClass());
} else {
utils.appendLine("// No type for element " + element.getXmlName());
}
}
code.append("}\n");
}