if (pFrom < 0 || pFrom >= particles.length ||
pTo < 0 || pTo >= particles.length || pTo < pFrom) {
return;
}
for (int i = pFrom; i <= pTo; i++) {
ParticleSG particle = particles[i];
if (particle.isElement()) {
ObjectSG oSG = particle.getObjectSG();
XsQName name = oSG.getName();
Object uriCondition;
if ("".equals(name.getNamespaceURI())) {
uriCondition = new Object[]{"(", getParamNamespaceURI(),
" == null || ",
getParamNamespaceURI(),
".length() == 0)"};
} else {
uriCondition = new Object[]{JavaSource.getQuoted(name.getNamespaceURI()),
".equals(", getParamNamespaceURI(), ")"};
}
pJm.addIf(i == pFrom, uriCondition, " && ",
JavaSource.getQuoted(name.getLocalName()),
".equals(", getParamLocalName(), ")");
acceptParticle(pJm, i);
handleStartOfChildElement(pUnmarshallerHandler, pJm, particle);
pJm.addLine("return true;");
} else if (particle.isGroup()) {
GroupSG gSG = particle.getGroupSG();
GroupHandlerSG handlerSG = getGroupHandlerSG(gSG);
pJm.addIf(i == pFrom,
pUnmarshallerHandler, ".testGroupParser(new ",
handlerSG.getJavaSource().getQName(), "(), ",
getParamNamespaceURI(), ", ", getParamLocalName(),
", ", getParamQName(), ", ", getParamAttrs(), ")");
acceptParticle(pJm, i);
pJm.addLine("return true;");
} else if (particle.isWildcard()) {
throw new IllegalStateException("TODO: Add support for wildcards");
} else {
throw new IllegalStateException("Invalid particle type");
}
}