public int getMinOccurs() { return this.particle.getMinOccurs(); }
boolean isParticleRedundant( XSParticle particle ) { if ( particle.getMaxOccursUnbounded() ) { return false; } return particle.getMinOccurs() == 1 && particle.getMaxOccurs() == 1; }
private static boolean isRepeatable(XSParticle particle) { return particle.getMaxOccursUnbounded() || particle.getMaxOccurs() > 1 || particle.getMinOccurs() > 1; }
String generateOccurenceInfo( XSParticle particle ) { return "(minOccurs=" + particle.getMinOccurs() + ", maxOccurs=" + ( particle.getMaxOccursUnbounded() ? "unbounded" : particle.getMaxOccurs() ) + ")"; }
for ( int i = 0; i < particles.getLength(); i++ ) { XSParticle particle = (XSParticle) particles.item( i ); exportTerm( writer, particle.getTerm(), particle.getMinOccurs(), particle.getMaxOccurs(), particle.getMaxOccursUnbounded() );
buf.append(" nillable='true' "); int minoccurs = xsp.getMinOccurs(); int maxoccurs = xsp.getMaxOccurs(); if (!(minoccurs == 0 && maxoccurs == 0) && !(minoccurs == 1 && maxoccurs == 1)) else buf.append(" maxOccurs='" + xsp.getMaxOccurs() + "'"); buf.append(" minOccurs='" + xsp.getMinOccurs() + "'");
for ( int i = 0; i < ol.getLength(); i++ ) { XSParticle o = (XSParticle) ol.item( i ); boolean voidable = o.getMinOccurs() == 0 || o.getMinOccurs() < num; Pair<XSElementDeclaration, Boolean> elDecl = getTargetElementTerm( new Pair<XSTerm, Boolean>( o.getTerm(),
private void analyzeParticle(XSParticle particle, String parentName, String namespace) { // Is this right, can a particle be null? if (particle == null) return; XSTerm term = particle.getTerm(); // Is this right, can a term be null? if (term == null) return; switch (term.getType()) { case XSConstants.MODEL_GROUP: XSModelGroup group = (XSModelGroup)term; XSObjectList list = group.getParticles(); for (int i = 0; i < list.getLength(); i++) analyzeParticle((XSParticle)list.item(i), parentName, namespace); break; case XSConstants.ELEMENT_DECLARATION: XSElementDeclaration decl = (XSElementDeclaration)term; analyzeElement(decl, parentName, namespace, new Integer(particle.getMinOccurs()), new Integer(particle.getMaxOccurs())); } }
private void setMandatoryPropertyNames(List properties, XSElementDeclaration element, XSParticle particle) { if (particle.getMinOccurs() > 0) { XSTerm term = particle.getTerm(); if ((term instanceof XSElementDeclaration)) { XSElementDeclaration propertyElement = (XSElementDeclaration) term; String namespaceUri = propertyElement.getNamespace(); String localName = propertyElement.getName(); properties.add(new QName(namespaceUri, localName)); } else if ((term instanceof XSModelGroup)) { XSModelGroup modelGroup = (XSModelGroup) term; XSObjectList particles = modelGroup.getParticles(); for (int i = 0; i < particles.getLength(); i++) setMandatoryPropertyNames(properties, element, (XSParticle) particles.item(i)); } } }
exportTerm( writer, particle.getTerm(), particle.getMinOccurs(), particle.getMaxOccurs(), particle.getMaxOccursUnbounded() );
case XSComplexTypeDefinition.CONTENTTYPE_ELEMENT: { final XSParticle particle = typeDef.getParticle(); final int minOccurs = particle.getMinOccurs(); final int maxOccurs = particle.getMaxOccursUnbounded() ? -1 : particle.getMaxOccurs(); final XSTerm term = particle.getTerm();
elementValue, elDec.getNillable(), particle.getMinOccurs() == 0, declareNs ); elementValue, true, particle.getMinOccurs() == 0, declareNs );
for ( int i = 0; i < sequence.getLength(); i++ ) { XSParticle particle = (XSParticle) sequence.item( i ); int minOccurs = getCombinedOccurs( parentMinOccurs, particle.getMinOccurs() ); int maxOccurs = getCombinedOccurs( parentMaxOccurs, particle.getMaxOccursUnbounded() ? -1 : particle.getMaxOccurs() );
private void collectProperties( XSParticle particle, List<PropertyDeclaration> properties ) { switch ( particle.getTerm().getType() ) { case XSConstants.MODEL_GROUP: { XSModelGroup modelGroup = (XSModelGroup) particle.getTerm(); XSObjectList subParticles = modelGroup.getParticles(); for ( int i = 0; i < subParticles.getLength(); i++ ) { XSParticle subParticle = (XSParticle) subParticles.item( i ); collectProperties( subParticle, properties ); } break; } case XSConstants.ELEMENT_DECLARATION: { XSElementDeclaration elementDecl = (XSElementDeclaration) particle.getTerm(); QName propertyName = new QName( elementDecl.getNamespace(), elementDecl.getName() ); String minOccurs = "" + particle.getMinOccurs(); String maxOccurs = particle.getMaxOccursUnbounded() ? "unbounded" : "" + particle.getMaxOccurs(); QName propertyType = new QName( elementDecl.getTypeDefinition().getNamespace(), elementDecl.getTypeDefinition().getName() ); PropertyDeclaration property = new PropertyDeclaration( propertyName, minOccurs, maxOccurs, propertyType ); properties.add( property ); break; } case XSConstants.WILDCARD: { break; } default: { // cannot happen } } }
case XSConstants.ELEMENT_DECLARATION: particle = processElement(parent, path, (XSElementDeclaration) xsTerm, substitutions, parents, xsParticle.getMinOccurs(), xsParticle.getMaxOccurs()); break;
boolean insideChoice = group.getCompositor() == XSModelGroup.COMPOSITOR_CHOICE; boolean optional = insideChoice || particle.getMinOccurs() == 0; boolean array = particle.getMaxOccurs() > 1 || particle.getMaxOccursUnbounded();
particleBinding.setMinOccurs(particle.getMinOccurs()); particleBinding.setMaxOccurs(particle.getMaxOccurs()); bindElement( (XSElementDeclaration)term, particle.getMinOccurs(), particle.getMaxOccurs(), particle.getMaxOccursUnbounded()
value, element.getNillable(), particle.getMinOccurs() == 0, declareNs ); o, element.getNillable(), particle.getMinOccurs() == 0, declareNs );
int repeatCount = generateRepeatCount(config, particle.getMinOccurs(), maxOccurs); if (term instanceof XSElementDeclaration) {
private void bindWildcard(XSParticle particle) { WildcardBinding binding = new WildcardBinding(schema); ModelGroupBinding group = (ModelGroupBinding)peekTypeOrGroup(); ParticleBinding particleBinding = new ParticleBinding(binding); particleBinding.setMaxOccurs(particle.getMaxOccurs()); particleBinding.setMaxOccursUnbounded(particle.getMaxOccursUnbounded()); particleBinding.setMinOccurs(particle.getMinOccurs()); group.addParticle(particleBinding); XSWildcard wildcard = (XSWildcard)particle.getTerm(); if(wildcard.getName() != null) { binding.setQName(new QName(wildcard.getNamespace(), wildcard.getName())); } binding.setProcessContents(wildcard.getProcessContents()); if (processAnnotations) { XSAnnotation annotation = wildcard.getAnnotation(); if(annotation != null) { customizeTerm(annotation, binding, trace); } } }