}
private void deserializeAny(XmlSchemaComplexType type,
ParticleInfo itemInfo,
ParticleInfo nextItem) {
XmlSchemaAny any = (XmlSchemaAny)itemInfo.getParticle();
boolean array = XmlSchemaUtils.isParticleArray(any);
boolean optional = XmlSchemaUtils.isParticleOptional(any);
if (array) {
utils.appendLine("var anyObject = [];");
} else {
utils.appendLine("var anyObject = null;");
}
String anyNamespaceSpec = any.getNamespace();
// we aren't dealing with any-after-any.
XmlSchemaElement nextElement = null;
if (nextItem != null) {
nextElement = (XmlSchemaElement)nextItem.getParticle();
}
String matchType;
String namespaceList = "[]";
if (anyNamespaceSpec == null
|| "##any".equals(anyNamespaceSpec)
|| "".equals(anyNamespaceSpec)) {
matchType = "org_apache_cxf_any_ns_matcher.ANY";
} else if ("##other".equals(anyNamespaceSpec)) {
matchType = "org_apache_cxf_any_ns_matcher.OTHER";
} else if ("##local".equals(anyNamespaceSpec)) {
matchType = "org_apache_cxf_any_ns_matcher.LOCAL";
} else {
matchType = "org_apache_cxf_any_ns_matcher.LISTED";
namespaceList = buildNamespaceList(anyNamespaceSpec);
}
String nextLocalPartConstant = "null";
if (nextElement != null) {
nextLocalPartConstant = "'" + nextElement.getQName().getLocalPart() + "'";
}
utils.appendLine("var matcher = new org_apache_cxf_any_ns_matcher("
+ matchType
+ ", '" + xmlSchema.getTargetNamespace() + "'"
+ ", " + namespaceList
+ ", " + nextLocalPartConstant
+ ");");
if (array) {
utils.appendLine("var anyNeeded = " + any.getMinOccurs() + ";");
utils.appendLine("var anyAllowed = " + any.getMaxOccurs() + ";");
} else if (optional) {
utils.appendLine("var anyNeeded = 0;");
utils.appendLine("var anyAllowed = 1;");
} else {
utils.appendLine("var anyNeeded = 1;");