com.sun.org.apache.xerces.internal.impl.xs.XSParticleDecl Java Examples

The following examples show how to use com.sun.org.apache.xerces.internal.impl.xs.XSParticleDecl. 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: XSDFACM.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
Object findMatchingDecl(QName curElem, SubstitutionGroupHandler subGroupHandler) {
    Object matchingDecl = null;

    for (int elemIndex = 0; elemIndex < fElemMapSize; elemIndex++) {
        int type = fElemMapType[elemIndex] ;
        if (type == XSParticleDecl.PARTICLE_ELEMENT) {
            matchingDecl = subGroupHandler.getMatchingElemDecl(curElem, (XSElementDecl)fElemMap[elemIndex]);
            if (matchingDecl != null) {
                return matchingDecl;
            }
        }
        else if (type == XSParticleDecl.PARTICLE_WILDCARD) {
            if(((XSWildcardDecl)fElemMap[elemIndex]).allowNamespace(curElem.uri))
                return fElemMap[elemIndex];
        }
    }

    return null;
}
 
Example #2
Source File: CMBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private CMNode copyNode(CMNode node) {
    int type = node.type();
    // for choice or sequence, copy the two subtrees, and combine them
    if (type == XSModelGroupImpl.MODELGROUP_CHOICE ||
        type == XSModelGroupImpl.MODELGROUP_SEQUENCE) {
        XSCMBinOp bin = (XSCMBinOp)node;
        node = fNodeFactory.getCMBinOpNode(type, copyNode(bin.getLeft()),
                             copyNode(bin.getRight()));
    }
    // for ?+*, copy the subtree, and put it in a new ?+* node
    else if (type == XSParticleDecl.PARTICLE_ZERO_OR_MORE ||
             type == XSParticleDecl.PARTICLE_ONE_OR_MORE ||
             type == XSParticleDecl.PARTICLE_ZERO_OR_ONE) {
        XSCMUniOp uni = (XSCMUniOp)node;
        node = fNodeFactory.getCMUniOpNode(type, copyNode(uni.getChild()));
    }
    // for element/wildcard (leaf), make a new leaf node,
    // with a distinct position
    else if (type == XSParticleDecl.PARTICLE_ELEMENT ||
             type == XSParticleDecl.PARTICLE_WILDCARD) {
        XSCMLeaf leaf = (XSCMLeaf)node;
        node = fNodeFactory.getCMLeafNode(leaf.type(), leaf.getLeaf(), leaf.getParticleId(), fLeafCount++);
    }

    return node;
}
 
Example #3
Source File: XSDComplexTypeTraverser.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void contentRestore() {
    fAnnotations = (XSAnnotationImpl [])fGlobalStore[--fGlobalStorePos];
    fXSSimpleType = (XSSimpleType)fGlobalStore[--fGlobalStorePos];
    fParticle = (XSParticleDecl)fGlobalStore[--fGlobalStorePos];
    fAttrGrp = (XSAttributeGroupDecl)fGlobalStore[--fGlobalStorePos];
    fBaseType = (XSTypeDefinition)fGlobalStore[--fGlobalStorePos];
    int i = ((Integer)(fGlobalStore[--fGlobalStorePos])).intValue();
    fBlock = (short)(i >> 16);
    fContentType = (short)i;
    i = ((Integer)(fGlobalStore[--fGlobalStorePos])).intValue();
    fDerivedBy = (short)(i >> 16);
    fFinal = (short)i;
    fTargetNamespace = (String)fGlobalStore[--fGlobalStorePos];
    fName = (String)fGlobalStore[--fGlobalStorePos];
    fIsAbstract = ((Boolean)fGlobalStore[--fGlobalStorePos]).booleanValue();
    fComplexTypeDecl = (XSComplexTypeDecl)fGlobalStore[--fGlobalStorePos];
}
 
Example #4
Source File: CMBuilder.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private boolean useRepeatingLeafNodes(XSParticleDecl particle) {
    int maxOccurs = particle.fMaxOccurs;
    int minOccurs = particle.fMinOccurs;
    short type = particle.fType;

    if (type == XSParticleDecl.PARTICLE_MODELGROUP) {
        XSModelGroupImpl group = (XSModelGroupImpl) particle.fValue;
        if (minOccurs != 1 || maxOccurs != 1) {
            if (group.fParticleCount == 1) {
                XSParticleDecl particle2 = (XSParticleDecl) group.fParticles[0];
                short type2 = particle2.fType;
                return ((type2 == XSParticleDecl.PARTICLE_ELEMENT ||
                        type2 == XSParticleDecl.PARTICLE_WILDCARD) &&
                        particle2.fMinOccurs == 1 &&
                        particle2.fMaxOccurs == 1);
            }
            return (group.fParticleCount == 0);
        }
        for (int i = 0; i < group.fParticleCount; ++i) {
            if (!useRepeatingLeafNodes(group.fParticles[i])) {
                return false;
            }
        }
    }
    return true;
}
 
Example #5
Source File: CMBuilder.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
XSCMValidator createAllCM(XSParticleDecl particle) {
    if (particle.fMaxOccurs == 0)
        return null;

    // get the model group, and add all children of it to the content model
    XSModelGroupImpl group = (XSModelGroupImpl)particle.fValue;
    // create an all content model. the parameter indicates whether
    // the <all> itself is optional
    XSAllCM allContent = new XSAllCM(particle.fMinOccurs == 0, group.fParticleCount);
    for (int i = 0; i < group.fParticleCount; i++) {
        // add the element decl to the all content model
        allContent.addElement((XSElementDecl)group.fParticles[i].fValue,
        group.fParticles[i].fMinOccurs == 0);
    }
    return allContent;
}
 
Example #6
Source File: XSDComplexTypeTraverser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static XSParticleDecl getErrorContent() {
    if (fErrorContent == null) {
        XSParticleDecl particle = new XSParticleDecl();
        particle.fType = XSParticleDecl.PARTICLE_WILDCARD;
        particle.fValue = getErrorWildcard();
        particle.fMinOccurs = 0;
        particle.fMaxOccurs = SchemaSymbols.OCCURRENCE_UNBOUNDED;
        XSModelGroupImpl group = new XSModelGroupImpl();
        group.fCompositor = XSModelGroupImpl.MODELGROUP_SEQUENCE;
        group.fParticleCount = 1;
        group.fParticles = new XSParticleDecl[1];
        group.fParticles[0] = particle;
        XSParticleDecl errorContent = new XSParticleDecl();
        errorContent.fType = XSParticleDecl.PARTICLE_MODELGROUP;
        errorContent.fValue = group;
        fErrorContent = errorContent;
    }
    return fErrorContent;
}
 
Example #7
Source File: CMBuilder.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
XSCMValidator createAllCM(XSParticleDecl particle) {
    if (particle.fMaxOccurs == 0)
        return null;

    // get the model group, and add all children of it to the content model
    XSModelGroupImpl group = (XSModelGroupImpl)particle.fValue;
    // create an all content model. the parameter indicates whether
    // the <all> itself is optional
    XSAllCM allContent = new XSAllCM(particle.fMinOccurs == 0, group.fParticleCount);
    for (int i = 0; i < group.fParticleCount; i++) {
        // add the element decl to the all content model
        allContent.addElement((XSElementDecl)group.fParticles[i].fValue,
        group.fParticles[i].fMinOccurs == 0);
    }
    return allContent;
}
 
Example #8
Source File: CMBuilder.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private boolean useRepeatingLeafNodes(XSParticleDecl particle) {
    int maxOccurs = particle.fMaxOccurs;
    int minOccurs = particle.fMinOccurs;
    short type = particle.fType;

    if (type == XSParticleDecl.PARTICLE_MODELGROUP) {
        XSModelGroupImpl group = (XSModelGroupImpl) particle.fValue;
        if (minOccurs != 1 || maxOccurs != 1) {
            if (group.fParticleCount == 1) {
                XSParticleDecl particle2 = (XSParticleDecl) group.fParticles[0];
                short type2 = particle2.fType;
                return ((type2 == XSParticleDecl.PARTICLE_ELEMENT ||
                        type2 == XSParticleDecl.PARTICLE_WILDCARD) &&
                        particle2.fMinOccurs == 1 &&
                        particle2.fMaxOccurs == 1);
            }
            return (group.fParticleCount == 0);
        }
        for (int i = 0; i < group.fParticleCount; ++i) {
            if (!useRepeatingLeafNodes(group.fParticles[i])) {
                return false;
            }
        }
    }
    return true;
}
 
Example #9
Source File: XSDComplexTypeTraverser.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
private void contentRestore() {
    fAnnotations = (XSAnnotationImpl [])fGlobalStore[--fGlobalStorePos];
    fXSSimpleType = (XSSimpleType)fGlobalStore[--fGlobalStorePos];
    fParticle = (XSParticleDecl)fGlobalStore[--fGlobalStorePos];
    fAttrGrp = (XSAttributeGroupDecl)fGlobalStore[--fGlobalStorePos];
    fBaseType = (XSTypeDefinition)fGlobalStore[--fGlobalStorePos];
    int i = ((Integer)(fGlobalStore[--fGlobalStorePos]));
    fBlock = (short)(i >> 16);
    fContentType = (short)i;
    i = ((Integer)(fGlobalStore[--fGlobalStorePos]));
    fDerivedBy = (short)(i >> 16);
    fFinal = (short)i;
    fTargetNamespace = (String)fGlobalStore[--fGlobalStorePos];
    fName = (String)fGlobalStore[--fGlobalStorePos];
    fIsAbstract = ((Boolean)fGlobalStore[--fGlobalStorePos]);
    fComplexTypeDecl = (XSComplexTypeDecl)fGlobalStore[--fGlobalStorePos];
}
 
Example #10
Source File: CMBuilder.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private boolean useRepeatingLeafNodes(XSParticleDecl particle) {
    int maxOccurs = particle.fMaxOccurs;
    int minOccurs = particle.fMinOccurs;
    short type = particle.fType;

    if (type == XSParticleDecl.PARTICLE_MODELGROUP) {
        XSModelGroupImpl group = (XSModelGroupImpl) particle.fValue;
        if (minOccurs != 1 || maxOccurs != 1) {
            if (group.fParticleCount == 1) {
                XSParticleDecl particle2 = (XSParticleDecl) group.fParticles[0];
                short type2 = particle2.fType;
                return ((type2 == XSParticleDecl.PARTICLE_ELEMENT ||
                        type2 == XSParticleDecl.PARTICLE_WILDCARD) &&
                        particle2.fMinOccurs == 1 &&
                        particle2.fMaxOccurs == 1);
            }
            return (group.fParticleCount == 0);
        }
        for (int i = 0; i < group.fParticleCount; ++i) {
            if (!useRepeatingLeafNodes(group.fParticles[i])) {
                return false;
            }
        }
    }
    return true;
}
 
Example #11
Source File: XSDHandler.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private boolean removeParticle(XSModelGroupImpl group, XSParticleDecl particle) {
    XSParticleDecl member;
    for (int i = 0; i < group.fParticleCount; i++) {
        member = group.fParticles[i];
        if (member == particle) {
            for (int j = i; j < group.fParticleCount-1; j++)
                group.fParticles[j] = group.fParticles[j+1];
            group.fParticleCount--;
            return true;
        }
        if (member.fType == XSParticleDecl.PARTICLE_MODELGROUP) {
            if (removeParticle((XSModelGroupImpl)member.fValue, particle))
                return true;
        }
    }
    return false;
}
 
Example #12
Source File: XSDHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private boolean removeParticle(XSModelGroupImpl group, XSParticleDecl particle) {
    XSParticleDecl member;
    for (int i = 0; i < group.fParticleCount; i++) {
        member = group.fParticles[i];
        if (member == particle) {
            for (int j = i; j < group.fParticleCount-1; j++)
                group.fParticles[j] = group.fParticles[j+1];
            group.fParticleCount--;
            return true;
        }
        if (member.fType == XSParticleDecl.PARTICLE_MODELGROUP) {
            if (removeParticle((XSModelGroupImpl)member.fValue, particle))
                return true;
        }
    }
    return false;
}
 
Example #13
Source File: XSDHandler.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private boolean removeParticle(XSModelGroupImpl group, XSParticleDecl particle) {
    XSParticleDecl member;
    for (int i = 0; i < group.fParticleCount; i++) {
        member = group.fParticles[i];
        if (member == particle) {
            for (int j = i; j < group.fParticleCount-1; j++)
                group.fParticles[j] = group.fParticles[j+1];
            group.fParticleCount--;
            return true;
        }
        if (member.fType == XSParticleDecl.PARTICLE_MODELGROUP) {
            if (removeParticle((XSModelGroupImpl)member.fValue, particle))
                return true;
        }
    }
    return false;
}
 
Example #14
Source File: XSDComplexTypeTraverser.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private void contentRestore() {
    fAnnotations = (XSAnnotationImpl [])fGlobalStore[--fGlobalStorePos];
    fXSSimpleType = (XSSimpleType)fGlobalStore[--fGlobalStorePos];
    fParticle = (XSParticleDecl)fGlobalStore[--fGlobalStorePos];
    fAttrGrp = (XSAttributeGroupDecl)fGlobalStore[--fGlobalStorePos];
    fBaseType = (XSTypeDefinition)fGlobalStore[--fGlobalStorePos];
    int i = ((Integer)(fGlobalStore[--fGlobalStorePos])).intValue();
    fBlock = (short)(i >> 16);
    fContentType = (short)i;
    i = ((Integer)(fGlobalStore[--fGlobalStorePos])).intValue();
    fDerivedBy = (short)(i >> 16);
    fFinal = (short)i;
    fTargetNamespace = (String)fGlobalStore[--fGlobalStorePos];
    fName = (String)fGlobalStore[--fGlobalStorePos];
    fIsAbstract = ((Boolean)fGlobalStore[--fGlobalStorePos]).booleanValue();
    fComplexTypeDecl = (XSComplexTypeDecl)fGlobalStore[--fGlobalStorePos];
}
 
Example #15
Source File: XSDComplexTypeTraverser.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private static XSParticleDecl getErrorContent() {
    if (fErrorContent == null) {
        XSParticleDecl particle = new XSParticleDecl();
        particle.fType = XSParticleDecl.PARTICLE_WILDCARD;
        particle.fValue = getErrorWildcard();
        particle.fMinOccurs = 0;
        particle.fMaxOccurs = SchemaSymbols.OCCURRENCE_UNBOUNDED;
        XSModelGroupImpl group = new XSModelGroupImpl();
        group.fCompositor = XSModelGroupImpl.MODELGROUP_SEQUENCE;
        group.fParticleCount = 1;
        group.fParticles = new XSParticleDecl[1];
        group.fParticles[0] = particle;
        XSParticleDecl errorContent = new XSParticleDecl();
        errorContent.fType = XSParticleDecl.PARTICLE_MODELGROUP;
        errorContent.fValue = group;
        fErrorContent = errorContent;
    }
    return fErrorContent;
}
 
Example #16
Source File: XSCMUniOp.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public XSCMUniOp(int type, CMNode childNode) {
    super(type);

    // Insure that its one of the types we require
    if ((type() != XSParticleDecl.PARTICLE_ZERO_OR_ONE)
    &&  (type() != XSParticleDecl.PARTICLE_ZERO_OR_MORE)
    &&  (type() != XSParticleDecl.PARTICLE_ONE_OR_MORE)) {
        throw new RuntimeException("ImplementationMessages.VAL_UST");
    }

    // Store the node and init any data that needs it
    fChild = childNode;
}
 
Example #17
Source File: XSCMUniOp.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public XSCMUniOp(int type, CMNode childNode) {
    super(type);

    // Insure that its one of the types we require
    if ((type() != XSParticleDecl.PARTICLE_ZERO_OR_ONE)
    &&  (type() != XSParticleDecl.PARTICLE_ZERO_OR_MORE)
    &&  (type() != XSParticleDecl.PARTICLE_ONE_OR_MORE)) {
        throw new RuntimeException("ImplementationMessages.VAL_UST");
    }

    // Store the node and init any data that needs it
    fChild = childNode;
}
 
Example #18
Source File: CMBuilder.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get content model for the a given type
 *
 * @param typeDecl  get content model for which complex type
 * @return          a content model validator
 */
public XSCMValidator getContentModel(XSComplexTypeDecl typeDecl) {

    // for complex type with empty or simple content,
    // there is no content model validator
    short contentType = typeDecl.getContentType();
    if (contentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE ||
        contentType == XSComplexTypeDecl.CONTENTTYPE_EMPTY) {
        return null;
    }

    XSParticleDecl particle = (XSParticleDecl)typeDecl.getParticle();

    // if the content is element only or mixed, but no particle
    // is defined, return the empty content model
    if (particle == null)
        return fEmptyCM;

    // if the content model contains "all" model group,
    // we create an "all" content model, otherwise a DFA content model
    XSCMValidator cmValidator = null;
    if (particle.fType == XSParticleDecl.PARTICLE_MODELGROUP &&
        ((XSModelGroupImpl)particle.fValue).fCompositor == XSModelGroupImpl.MODELGROUP_ALL) {
        cmValidator = createAllCM(particle);
    }
    else {
        cmValidator = createDFACM(particle);
    }

    //now we are throught building content model and have passed sucessfully of the nodecount check
    //if set by the application
    fNodeFactory.resetNodeCount() ;

    // if the validator returned is null, it means there is nothing in
    // the content model, so we return the empty content model.
    if (cmValidator == null)
        cmValidator = fEmptyCM;

    return cmValidator;
}
 
Example #19
Source File: CMBuilder.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
XSCMValidator createDFACM(XSParticleDecl particle) {
    fLeafCount = 0;
    fParticleCount = 0;
    // convert particle tree to CM tree
    CMNode node = useRepeatingLeafNodes(particle) ? buildCompactSyntaxTree(particle) : buildSyntaxTree(particle, true);
    if (node == null)
        return null;
    // build DFA content model from the CM tree
    return new XSDFACM(node, fLeafCount);
}
 
Example #20
Source File: XSDAbstractParticleTraverser.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
void addParticle(XSParticleDecl particle) {
    // resize the particle array if necessary
    if (fPos[fContextCount] == fParticles.length) {
        int newSize = fPos[fContextCount] * 2;
        XSParticleDecl[] newArray = new XSParticleDecl[newSize];
        System.arraycopy(fParticles, 0, newArray, 0, fPos[fContextCount]);
        fParticles = newArray;
    }
    fParticles[fPos[fContextCount]++] = particle;
}
 
Example #21
Source File: XSCMUniOp.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public XSCMUniOp(int type, CMNode childNode) {
    super(type);

    // Insure that its one of the types we require
    if ((type() != XSParticleDecl.PARTICLE_ZERO_OR_ONE)
    &&  (type() != XSParticleDecl.PARTICLE_ZERO_OR_MORE)
    &&  (type() != XSParticleDecl.PARTICLE_ONE_OR_MORE)) {
        throw new RuntimeException("ImplementationMessages.VAL_UST");
    }

    // Store the node and init any data that needs it
    fChild = childNode;
}
 
Example #22
Source File: XSDAbstractParticleTraverser.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
protected boolean hasAllContent(XSParticleDecl particle) {
    // If the content is not empty, is the top node ALL?
    if (particle != null && particle.fType == XSParticleDecl.PARTICLE_MODELGROUP) {
        return ((XSModelGroupImpl)particle.fValue).fCompositor == XSModelGroupImpl.MODELGROUP_ALL;
    }

    return false;
}
 
Example #23
Source File: XSDAbstractParticleTraverser.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
XSParticleDecl[] popContext() {
    int count = fPos[fContextCount] - fPos[fContextCount-1];
    XSParticleDecl[] array = null;
    if (count != 0) {
        array = new XSParticleDecl[count];
        System.arraycopy(fParticles, fPos[fContextCount-1], array, 0, count);
        // clear the particle array, to release memory
        for (int i = fPos[fContextCount-1]; i < fPos[fContextCount]; i++)
            fParticles[i] = null;
    }
    fContextCount--;
    return array;
}
 
Example #24
Source File: XSCMUniOp.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public XSCMUniOp(int type, CMNode childNode) {
    super(type);

    // Insure that its one of the types we require
    if ((type() != XSParticleDecl.PARTICLE_ZERO_OR_ONE)
    &&  (type() != XSParticleDecl.PARTICLE_ZERO_OR_MORE)
    &&  (type() != XSParticleDecl.PARTICLE_ONE_OR_MORE)) {
        throw new RuntimeException("ImplementationMessages.VAL_UST");
    }

    // Store the node and init any data that needs it
    fChild = childNode;
}
 
Example #25
Source File: CMBuilder.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get content model for the a given type
 *
 * @param typeDecl  get content model for which complex type
 * @return          a content model validator
 */
public XSCMValidator getContentModel(XSComplexTypeDecl typeDecl) {

    // for complex type with empty or simple content,
    // there is no content model validator
    short contentType = typeDecl.getContentType();
    if (contentType == XSComplexTypeDecl.CONTENTTYPE_SIMPLE ||
        contentType == XSComplexTypeDecl.CONTENTTYPE_EMPTY) {
        return null;
    }

    XSParticleDecl particle = (XSParticleDecl)typeDecl.getParticle();

    // if the content is element only or mixed, but no particle
    // is defined, return the empty content model
    if (particle == null)
        return fEmptyCM;

    // if the content model contains "all" model group,
    // we create an "all" content model, otherwise a DFA content model
    XSCMValidator cmValidator = null;
    if (particle.fType == XSParticleDecl.PARTICLE_MODELGROUP &&
        ((XSModelGroupImpl)particle.fValue).fCompositor == XSModelGroupImpl.MODELGROUP_ALL) {
        cmValidator = createAllCM(particle);
    }
    else {
        cmValidator = createDFACM(particle);
    }

    //now we are throught building content model and have passed sucessfully of the nodecount check
    //if set by the application
    fNodeFactory.resetNodeCount() ;

    // if the validator returned is null, it means there is nothing in
    // the content model, so we return the empty content model.
    if (cmValidator == null)
        cmValidator = fEmptyCM;

    return cmValidator;
}
 
Example #26
Source File: XSDHandler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
void fillInLocalElemInfo(Element elmDecl,
        XSDocumentInfo schemaDoc,
        int allContextFlags,
        XSObject parent,
        XSParticleDecl particle) {

    // if the stack is full, increase the size
    if (fParticle.length == fLocalElemStackPos) {
        // increase size
        XSParticleDecl[] newStackP = new XSParticleDecl[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fParticle, 0, newStackP, 0, fLocalElemStackPos);
        fParticle = newStackP;
        Element[] newStackE = new Element[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fLocalElementDecl, 0, newStackE, 0, fLocalElemStackPos);
        fLocalElementDecl = newStackE;
        XSDocumentInfo [] newStackE_schema = new XSDocumentInfo[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fLocalElementDecl_schema, 0, newStackE_schema, 0, fLocalElemStackPos);
        fLocalElementDecl_schema = newStackE_schema;
        int[] newStackI = new int[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fAllContext, 0, newStackI, 0, fLocalElemStackPos);
        fAllContext = newStackI;
        XSObject[] newStackC = new XSObject[fLocalElemStackPos+INC_STACK_SIZE];
        System.arraycopy(fParent, 0, newStackC, 0, fLocalElemStackPos);
        fParent = newStackC;
        String [][] newStackN = new String [fLocalElemStackPos+INC_STACK_SIZE][];
        System.arraycopy(fLocalElemNamespaceContext, 0, newStackN, 0, fLocalElemStackPos);
        fLocalElemNamespaceContext = newStackN;
    }

    fParticle[fLocalElemStackPos] = particle;
    fLocalElementDecl[fLocalElemStackPos] = elmDecl;
    fLocalElementDecl_schema[fLocalElemStackPos] = schemaDoc;
    fAllContext[fLocalElemStackPos] = allContextFlags;
    fParent[fLocalElemStackPos] = parent;
    fLocalElemNamespaceContext[fLocalElemStackPos++] = schemaDoc.fNamespaceSupport.getEffectiveLocalContext();
}
 
Example #27
Source File: CMBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private CMNode buildCompactSyntaxTree2(XSParticleDecl particle, int minOccurs, int maxOccurs) {
    // Convert element and wildcard particles to leaf nodes. Wrap repeating particles in a CMUniOpNode.
    CMNode nodeRet = null;
    if (minOccurs == 1 && maxOccurs == 1) {
        nodeRet = fNodeFactory.getCMLeafNode(particle.fType, particle.fValue, fParticleCount++, fLeafCount++);
    }
    else if (minOccurs == 0 && maxOccurs == 1) {
        // zero or one
        nodeRet = fNodeFactory.getCMLeafNode(particle.fType, particle.fValue, fParticleCount++, fLeafCount++);
        nodeRet = fNodeFactory.getCMUniOpNode(XSParticleDecl.PARTICLE_ZERO_OR_ONE, nodeRet);
    }
    else if (minOccurs == 0 && maxOccurs==SchemaSymbols.OCCURRENCE_UNBOUNDED) {
        // zero or more
        nodeRet = fNodeFactory.getCMLeafNode(particle.fType, particle.fValue, fParticleCount++, fLeafCount++);
        nodeRet = fNodeFactory.getCMUniOpNode(XSParticleDecl.PARTICLE_ZERO_OR_MORE, nodeRet);
    }
    else if (minOccurs == 1 && maxOccurs==SchemaSymbols.OCCURRENCE_UNBOUNDED) {
        // one or more
        nodeRet = fNodeFactory.getCMLeafNode(particle.fType, particle.fValue, fParticleCount++, fLeafCount++);
        nodeRet = fNodeFactory.getCMUniOpNode(XSParticleDecl.PARTICLE_ONE_OR_MORE, nodeRet);
    }
    else {
        // {n,m}: Instead of expanding this out, create a compound leaf node which carries the
        // occurence information and wrap it in the appropriate CMUniOpNode.
        nodeRet = fNodeFactory.getCMRepeatingLeafNode(particle.fType, particle.fValue, minOccurs, maxOccurs, fParticleCount++, fLeafCount++);
        if (minOccurs == 0) {
            nodeRet = fNodeFactory.getCMUniOpNode(XSParticleDecl.PARTICLE_ZERO_OR_MORE, nodeRet);
        }
        else {
            nodeRet = fNodeFactory.getCMUniOpNode(XSParticleDecl.PARTICLE_ONE_OR_MORE, nodeRet);
        }
    }
    return nodeRet;
}
 
Example #28
Source File: XSDAbstractParticleTraverser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
XSParticleDecl[] popContext() {
    int count = fPos[fContextCount] - fPos[fContextCount-1];
    XSParticleDecl[] array = null;
    if (count != 0) {
        array = new XSParticleDecl[count];
        System.arraycopy(fParticles, fPos[fContextCount-1], array, 0, count);
        // clear the particle array, to release memory
        for (int i = fPos[fContextCount-1]; i < fPos[fContextCount]; i++)
            fParticles[i] = null;
    }
    fContextCount--;
    return array;
}
 
Example #29
Source File: XSDAbstractParticleTraverser.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected boolean hasAllContent(XSParticleDecl particle) {
    // If the content is not empty, is the top node ALL?
    if (particle != null && particle.fType == XSParticleDecl.PARTICLE_MODELGROUP) {
        return ((XSModelGroupImpl)particle.fValue).fCompositor == XSModelGroupImpl.MODELGROUP_ALL;
    }

    return false;
}
 
Example #30
Source File: CMBuilder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
XSCMValidator createDFACM(XSParticleDecl particle) {
    fLeafCount = 0;
    fParticleCount = 0;
    // convert particle tree to CM tree
    CMNode node = useRepeatingLeafNodes(particle) ? buildCompactSyntaxTree(particle) : buildSyntaxTree(particle, true);
    if (node == null)
        return null;
    // build DFA content model from the CM tree
    return new XSDFACM(node, fLeafCount);
}