public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { ElementBinding element = (ElementBinding)particle.getTerm(); Object o = startElement(parent, elementName, element); if(o != null) { attrs = element.getType().expandWithDefaultAttributes(attrs); attributes(o, elementName, element, attrs, nsCtx); } return o; }
/** * TODO: it seems like for correct type resolution in startParticle * I should take into account the way the object is going to be added * to the parent in setParent (and, hence, do some steps that are done in setParticle). * In setParent then I should reuse the results of what has been done in startParticle. */ public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { TermBinding term = particle.getTerm(); Object o = startElement(parent, elementName, particle); if(!term.isModelGroup()) { ElementBinding element = (ElementBinding)term; if(o != null) { attrs = element.getType().expandWithDefaultAttributes(attrs); attributes(o, elementName, element, attrs, nsCtx); } } return o; }