Java Code Examples for org.apache.xerces.xs.XSParticle#getMaxOccursUnbounded()
The following examples show how to use
org.apache.xerces.xs.XSParticle#getMaxOccursUnbounded() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XSContentModel.java From jlibs with Apache License 2.0 | 6 votes |
private void appendCardinality(Path path){ path = path.getParentPath(XSParticle.class); if(path!=null){ XSParticle particle = (XSParticle)path.getElement(); if(particle.getMinOccurs()==1 && particle.getMaxOccurs()==1) return; if(particle.getMinOccurs()==0 && particle.getMaxOccurs()==1) buff.append("?"); else if(particle.getMinOccurs()==0 && particle.getMaxOccursUnbounded()) buff.append("*"); else if(particle.getMinOccurs()==1 && particle.getMaxOccursUnbounded()) buff.append("+"); else{ buff.append("["); if(particle.getMaxOccursUnbounded()) buff.append(particle.getMinOccurs()).append("+"); else if(particle.getMinOccurs()==particle.getMaxOccurs()) buff.append(particle.getMinOccurs()); else buff.append(particle.getMinOccurs()).append(",").append(particle.getMaxOccurs()); buff.append("]"); } } }
Example 2
Source File: XmlAligner.java From iaf with Apache License 2.0 | 6 votes |
protected Set<String> findMultipleOccurringChildElements(XSParticle particle) { Set<String> result=new HashSet<String>(); if (particle==null) { log.warn("findMultipleOccurringChildElements() typeDefinition particle is null, is this a problem?"); return result; } XSTerm term = particle.getTerm(); if (term==null) { throw new IllegalStateException("findMultipleOccurringChildElements particle.term is null"); } if (log.isTraceEnabled()) log.trace("findMultipleOccurringChildElements() term name ["+term.getName()+"] occurring unbounded ["+particle.getMaxOccursUnbounded()+"] max occur ["+particle.getMaxOccurs()+"] term ["+ToStringBuilder.reflectionToString(term)+"]"); if (particle.getMaxOccursUnbounded()||particle.getMaxOccurs()>1) { collectChildElements(particle,result); return result; } if (term instanceof XSModelGroup) { XSModelGroup modelGroup = (XSModelGroup)term; XSObjectList particles = modelGroup.getParticles(); if (log.isTraceEnabled()) log.trace("findMultipleOccurringChildElements() modelGroup particles ["+ToStringBuilder.reflectionToString(particles)+"]"); for (int i=0;i<particles.getLength();i++) { XSParticle childParticle = (XSParticle)particles.item(i); result.addAll(findMultipleOccurringChildElements(childParticle)); } } return result; }
Example 3
Source File: XmlTypeToJsonSchemaConverter.java From iaf with Apache License 2.0 | 5 votes |
private void handleCompositorsAllAndSequence(JsonObjectBuilder builder, XSObjectList particles, XSObjectList attributeUses){ if (log.isTraceEnabled()) log.trace("modelGroup COMPOSITOR_SEQUENCE or COMPOSITOR_ALL"); if (skipArrayElementContainers && particles.getLength()==1) { XSParticle childParticle = (XSParticle)particles.item(0); if (childParticle.getMaxOccursUnbounded() || childParticle.getMaxOccurs()>1) { if (log.isTraceEnabled()) log.trace("skippable array element childParticle ["+ToStringBuilder.reflectionToString(particles.item(0),ToStringStyle.MULTI_LINE_STYLE)+"]"); buildSkippableArrayContainer(childParticle, builder); return; } } buildObject(builder, particles, attributeUses, null, null); }
Example 4
Source File: XMLToJSON.java From ts-reaktive with MIT License | 4 votes |
private boolean isMultiValued(XSParticle particle) { return particle.getMaxOccursUnbounded() || particle.getMaxOccurs() > 1; }
Example 5
Source File: XSDisplayFilter.java From jlibs with Apache License 2.0 | 4 votes |
protected boolean process(XSParticle particle){ return !(!particle.getMaxOccursUnbounded() && particle.getMinOccurs() == 1 && particle.getMaxOccurs() == 1); }