private void endRepeatableParticle(ParticleBinding particle)
{
//System.out.println(" end repeatable (" + stack.size() + "): " + particle.getTerm());
StackItem item = stack.peek();
ValueList valueList = item.repeatableParticleValue;
if(valueList != null)
{
item.repeatableParticleValue = null;
if(valueList.size() == 0)
{
return;
}
if(particle.getTerm().isWildcard())
{
ParticleHandler handler = null;
/*
handler = ((WildcardBinding) particle.getTerm()).getWildcardHandler();
if (handler == null)
{
handler = defParticleHandler;
}
*/
// that's not good. some elements can be handled as "unresolved" and some as "resolved"
QName qName = valueList.getValue(0).qName;
Collection col = new ArrayList();
for(int i = 0; i < valueList.size(); ++i)
{
NonRequiredValue value = valueList.getValue(i);
col.add(value.value);
if(handler != value.handler)
{
if(handler == null && i == 0)
{
handler = (ParticleHandler) value.handler;
}
else
{
throw new JBossXBRuntimeException("Handlers in the list are supposed to be the same.");
}
}
}
StackItem parentItem = stack.peek(1);
handler.setParent(parentItem.o, col, qName, particle, parentItem.particle);
}
else
{
valueList.getHandler().newInstance(particle, valueList);
}
}
}