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

The following examples show how to use com.sun.org.apache.xerces.internal.impl.xs.XSModelGroupImpl. 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: 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 #2
Source File: CMBuilder.java    From jdk1.8-source-analysis with Apache License 2.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: CMBuilder.java    From openjdk-8-source 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 #4
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 #5
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 #6
Source File: XSDComplexTypeTraverser.java    From openjdk-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: XSCMBinOp.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
protected void calcLastPos(CMStateSet toSet) {
    if (type() == XSModelGroupImpl.MODELGROUP_CHOICE) {
        // Its the the union of the first positions of our children.
        toSet.setTo(fLeftChild.lastPos());
        toSet.union(fRightChild.lastPos());
    }
    else if (type() == XSModelGroupImpl.MODELGROUP_SEQUENCE) {
        //
        //  If our right child is nullable, then its the union of our
        //  children's last positions. Else is our right child's last
        //  positions.
        //
        toSet.setTo(fRightChild.lastPos());
        if (fRightChild.isNullable())
            toSet.union(fLeftChild.lastPos());
    }
    else {
        throw new RuntimeException("ImplementationMessages.VAL_BST");
    }
}
 
Example #8
Source File: XSDHandler.java    From TencentKona-8 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 #9
Source File: XSCMBinOp.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected void calcLastPos(CMStateSet toSet) {
    if (type() == XSModelGroupImpl.MODELGROUP_CHOICE) {
        // Its the the union of the first positions of our children.
        toSet.setTo(fLeftChild.lastPos());
        toSet.union(fRightChild.lastPos());
    }
    else if (type() == XSModelGroupImpl.MODELGROUP_SEQUENCE) {
        //
        //  If our right child is nullable, then its the union of our
        //  children's last positions. Else is our right child's last
        //  positions.
        //
        toSet.setTo(fRightChild.lastPos());
        if (fRightChild.isNullable())
            toSet.union(fLeftChild.lastPos());
    }
    else {
        throw new RuntimeException("ImplementationMessages.VAL_BST");
    }
}
 
Example #10
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 #11
Source File: XSCMBinOp.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
protected void calcLastPos(CMStateSet toSet) {
    if (type() == XSModelGroupImpl.MODELGROUP_CHOICE) {
        // Its the the union of the first positions of our children.
        toSet.setTo(fLeftChild.lastPos());
        toSet.union(fRightChild.lastPos());
    }
    else if (type() == XSModelGroupImpl.MODELGROUP_SEQUENCE) {
        //
        //  If our right child is nullable, then its the union of our
        //  children's last positions. Else is our right child's last
        //  positions.
        //
        toSet.setTo(fRightChild.lastPos());
        if (fRightChild.isNullable())
            toSet.union(fLeftChild.lastPos());
    }
    else {
        throw new RuntimeException("ImplementationMessages.VAL_BST");
    }
}
 
Example #12
Source File: CMBuilder.java    From openjdk-8 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 #13
Source File: XSDHandler.java    From jdk8u60 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 #14
Source File: XSDComplexTypeTraverser.java    From jdk8u60 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 #15
Source File: XSCMBinOp.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected void calcFirstPos(CMStateSet toSet) {
    if (type() == XSModelGroupImpl.MODELGROUP_CHOICE) {
        // Its the the union of the first positions of our children.
        toSet.setTo(fLeftChild.firstPos());
        toSet.union(fRightChild.firstPos());
    }
     else if (type() == XSModelGroupImpl.MODELGROUP_SEQUENCE) {
        //
        //  If our left child is nullable, then its the union of our
        //  children's first positions. Else is our left child's first
        //  positions.
        //
        toSet.setTo(fLeftChild.firstPos());
        if (fLeftChild.isNullable())
            toSet.union(fRightChild.firstPos());
    }
     else {
        throw new RuntimeException("ImplementationMessages.VAL_BST");
    }
}
 
Example #16
Source File: XSCMBinOp.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected void calcLastPos(CMStateSet toSet) {
    if (type() == XSModelGroupImpl.MODELGROUP_CHOICE) {
        // Its the the union of the first positions of our children.
        toSet.setTo(fLeftChild.lastPos());
        toSet.union(fRightChild.lastPos());
    }
    else if (type() == XSModelGroupImpl.MODELGROUP_SEQUENCE) {
        //
        //  If our right child is nullable, then its the union of our
        //  children's last positions. Else is our right child's last
        //  positions.
        //
        toSet.setTo(fRightChild.lastPos());
        if (fRightChild.isNullable())
            toSet.union(fLeftChild.lastPos());
    }
    else {
        throw new RuntimeException("ImplementationMessages.VAL_BST");
    }
}
 
Example #17
Source File: XSCMBinOp.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
protected void calcFirstPos(CMStateSet toSet) {
    if (type() == XSModelGroupImpl.MODELGROUP_CHOICE) {
        // Its the the union of the first positions of our children.
        toSet.setTo(fLeftChild.firstPos());
        toSet.union(fRightChild.firstPos());
    }
     else if (type() == XSModelGroupImpl.MODELGROUP_SEQUENCE) {
        //
        //  If our left child is nullable, then its the union of our
        //  children's first positions. Else is our left child's first
        //  positions.
        //
        toSet.setTo(fLeftChild.firstPos());
        if (fLeftChild.isNullable())
            toSet.union(fRightChild.firstPos());
    }
     else {
        throw new RuntimeException("ImplementationMessages.VAL_BST");
    }
}
 
Example #18
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 #19
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 #20
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 #21
Source File: XSCMBinOp.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
protected void calcLastPos(CMStateSet toSet) {
    if (type() == XSModelGroupImpl.MODELGROUP_CHOICE) {
        // Its the the union of the first positions of our children.
        toSet.setTo(fLeftChild.lastPos());
        toSet.union(fRightChild.lastPos());
    }
    else if (type() == XSModelGroupImpl.MODELGROUP_SEQUENCE) {
        //
        //  If our right child is nullable, then its the union of our
        //  children's last positions. Else is our right child's last
        //  positions.
        //
        toSet.setTo(fRightChild.lastPos());
        if (fRightChild.isNullable())
            toSet.union(fLeftChild.lastPos());
    }
    else {
        throw new RuntimeException("ImplementationMessages.VAL_BST");
    }
}
 
Example #22
Source File: XSCMBinOp.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
protected void calcFirstPos(CMStateSet toSet) {
    if (type() == XSModelGroupImpl.MODELGROUP_CHOICE) {
        // Its the the union of the first positions of our children.
        toSet.setTo(fLeftChild.firstPos());
        toSet.union(fRightChild.firstPos());
    }
     else if (type() == XSModelGroupImpl.MODELGROUP_SEQUENCE) {
        //
        //  If our left child is nullable, then its the union of our
        //  children's first positions. Else is our left child's first
        //  positions.
        //
        toSet.setTo(fLeftChild.firstPos());
        if (fLeftChild.isNullable())
            toSet.union(fRightChild.firstPos());
    }
     else {
        throw new RuntimeException("ImplementationMessages.VAL_BST");
    }
}
 
Example #23
Source File: XSDHandler.java    From openjdk-jdk9 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 #24
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 #25
Source File: XSCMBinOp.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected void calcLastPos(CMStateSet toSet) {
    if (type() == XSModelGroupImpl.MODELGROUP_CHOICE) {
        // Its the the union of the first positions of our children.
        toSet.setTo(fLeftChild.lastPos());
        toSet.union(fRightChild.lastPos());
    }
    else if (type() == XSModelGroupImpl.MODELGROUP_SEQUENCE) {
        //
        //  If our right child is nullable, then its the union of our
        //  children's last positions. Else is our right child's last
        //  positions.
        //
        toSet.setTo(fRightChild.lastPos());
        if (fRightChild.isNullable())
            toSet.union(fLeftChild.lastPos());
    }
    else {
        throw new RuntimeException("ImplementationMessages.VAL_BST");
    }
}
 
Example #26
Source File: XSDHandler.java    From openjdk-jdk8u 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 #27
Source File: XSDComplexTypeTraverser.java    From openjdk-jdk8u 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 #28
Source File: XSDComplexTypeTraverser.java    From Bytecoder 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 #29
Source File: CMBuilder.java    From openjdk-jdk8u 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 #30
Source File: XSDComplexTypeTraverser.java    From openjdk-jdk8u-backup 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;
}