public void visit(XSDParticle particle) { XSDElementDeclaration decl = (XSDElementDeclaration) particle.getContent(); if (decl.isElementDeclarationReference()) { decl = decl.getResolvedElementDeclaration(); } if (decl == fElement) { if (particle.isSetMinOccurs()) { minOccurs.add(Integer.valueOf(particle.getMinOccurs())); } else if (particle.getContainer() instanceof XSDModelGroup && particle.getContainer().getContainer() instanceof XSDParticle) { particle = (XSDParticle) particle.getContainer().getContainer(); minOccurs.add(Integer.valueOf(particle.getMinOccurs())); } else { minOccurs.add(1); } } } };
public static int getMinOccurs(XSDConcreteComponent component) { int minOccur = -2; if (component != null) { Object o = component.getContainer(); if (o instanceof XSDParticle) { if (((XSDParticle) o).isSetMinOccurs()) { try { minOccur = ((XSDParticle) o).getMinOccurs(); } catch (Exception e) { } } } } return minOccur; }
XSDParticle parentParticle = (XSDParticle)parent; if (parentParticle.isSetMinOccurs()) { particle.setMinOccurs(parentParticle.getMinOccurs()); parentParticle.unsetMinOccurs();