Search in sources :

Example 11 with XSParticle

use of org.apache.xerces.xs.XSParticle in project iaf by ibissource.

the class XmlAligner method findMultipleOccurringChildElements.

protected Set<String> findMultipleOccurringChildElements(XSParticle particle) {
    Set<String> result = new HashSet<String>();
    if (particle == null) {
        log.warn("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("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("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;
}
Also used : XSObjectList(org.apache.xerces.xs.XSObjectList) XSTerm(org.apache.xerces.xs.XSTerm) XSParticle(org.apache.xerces.xs.XSParticle) HashSet(java.util.HashSet) XSModelGroup(org.apache.xerces.xs.XSModelGroup)

Aggregations

XSParticle (org.apache.xerces.xs.XSParticle)11 XSElementDeclaration (org.apache.xerces.xs.XSElementDeclaration)7 XSObjectList (org.apache.xerces.xs.XSObjectList)7 XSTerm (org.apache.xerces.xs.XSTerm)7 XSModelGroup (org.apache.xerces.xs.XSModelGroup)6 XSComplexTypeDefinition (org.apache.xerces.xs.XSComplexTypeDefinition)3 XSTypeDefinition (org.apache.xerces.xs.XSTypeDefinition)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 LinkedList (java.util.LinkedList)2 JsonArrayBuilder (javax.json.JsonArrayBuilder)2 JsonObjectBuilder (javax.json.JsonObjectBuilder)2 QName (javax.xml.namespace.QName)2 XSSimpleType (org.apache.xerces.impl.dv.XSSimpleType)2 XSModel (org.apache.xerces.xs.XSModel)2 XSWildcard (org.apache.xerces.xs.XSWildcard)2 HasTargetNamespace (org.eclipse.winery.model.tosca.HasTargetNamespace)2 XsdImportManager (org.eclipse.winery.repository.backend.xsd.XsdImportManager)2 SAXException (org.xml.sax.SAXException)2 IOException (java.io.IOException)1