Examples of XSOpenContentDecl


Examples of org.apache.xerces.impl.xs.XSOpenContentDecl

        if (!allb.hasOptionalContent() && totalMin != 0) {
            return false;
        }

        // If derived doesn't have an open content, don't need to check #2.
        XSOpenContentDecl oc = alld.getOpenContent();
        wd = oc == null ? null : oc.fWildcard;
        if (wd == null) {
            return true;
        }
       
View Full Code Here

Examples of org.apache.xerces.impl.xs.XSOpenContentDecl

        // General Attribute Checking for elmNode
        Object[] attrValues = fAttrChecker.checkAttributes(elmNode, isDefault, schemaDoc);

        // Create open content declaration
        XSOpenContentDecl ocDecl = new XSOpenContentDecl();

        // get attribute values
        final XInt modeAttr = (XInt) attrValues[XSAttributeChecker.ATTIDX_MODE];
        final short ocMode = modeAttr.shortValue();
       
View Full Code Here

Examples of org.apache.xerces.impl.xs.XSOpenContentDecl

        // -----------------------------------------------------------------------
        // Compose the final content and attribute uses
        // -----------------------------------------------------------------------
        XSParticleDecl baseContent = (XSParticleDecl)baseType.getParticle();
        // XML Schema 1.1
        XSOpenContentDecl explicitOpenContent = null;

        if (fDerivedBy==XSConstants.DERIVATION_RESTRICTION) {

            // This is an RESTRICTION

            // N.B. derivation-ok-restriction.5.3 is checked under schema
            // full checking.   That's because we need to wait until locals are
            // traversed so that occurrence information is correct.
            if (fContentType == XSComplexTypeDecl.CONTENTTYPE_MIXED &&
                    baseType.getContentType() != XSComplexTypeDecl.CONTENTTYPE_MIXED) {
                fAttrChecker.returnAttrArray(complexContentAttrValues, schemaDoc);
                fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc);
                throw new ComplexTypeRecoverableError("derivation-ok-restriction.5.4.1.2",
                        new Object[]{fName, baseType.getName()},
                        complexContent);
            }

            try {
                mergeAttributes(baseType.getAttrGrp(), fAttrGrp, fName, false, complexContent);
            } catch (ComplexTypeRecoverableError e) {
                fAttrChecker.returnAttrArray(complexContentAttrValues, schemaDoc);
                fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc);
                throw e;
            }
            // Remove prohibited uses.   Must be done after merge for RESTRICTION.
            fAttrGrp.removeProhibitedAttrs();

            if (baseType != SchemaGrammar.getXSAnyType(fSchemaHandler.fSchemaVersion)) {
                Object[] errArgs = fAttrGrp.validRestrictionOf(fName, baseType.getAttrGrp(), fSchemaHandler.fXSConstraints);
                if (errArgs != null) {
                    fAttrChecker.returnAttrArray(complexContentAttrValues, schemaDoc);
                    fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc);
                    throw new ComplexTypeRecoverableError((String)errArgs[errArgs.length-1],
                            errArgs, complexContent);
                }
            }
        }
        else {
           
            // This is an EXTENSION

            // Create the particle
            if (fParticle == null) {
                fContentType = baseType.getContentType();
                fXSSimpleType = (XSSimpleType)baseType.getSimpleType();
                fParticle = baseContent;
                if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
                    explicitOpenContent = (XSOpenContentDecl) baseType.getOpenContent();
                }
            }
            else if (baseType.getContentType() == XSComplexTypeDecl.CONTENTTYPE_EMPTY) {
            }
            else {
                //
                // Check if the contentType of the base is consistent with the new type
                // cos-ct-extends.1.4.3.2
                if (fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT &&
                        baseType.getContentType() != XSComplexTypeDecl.CONTENTTYPE_ELEMENT) {
                    fAttrChecker.returnAttrArray(complexContentAttrValues, schemaDoc);
                    fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc);
                    throw new ComplexTypeRecoverableError("cos-ct-extends.1.4.3.2.2.1.a",
                            new Object[]{fName}, complexContent);
                }
                else if (fContentType == XSComplexTypeDecl.CONTENTTYPE_MIXED &&
                        baseType.getContentType() != XSComplexTypeDecl.CONTENTTYPE_MIXED) {
                    fAttrChecker.returnAttrArray(complexContentAttrValues, schemaDoc);
                    fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc);
                    throw new ComplexTypeRecoverableError("cos-ct-extends.1.4.3.2.2.1.b",
                            new Object[]{fName}, complexContent);
                }

                // if the content of either type is an "all" model group, error.
                boolean baseIsAll = (((XSParticleDecl)baseType.getParticle()).fType == XSParticleDecl.PARTICLE_MODELGROUP
                                    && ((XSModelGroupImpl)(((XSParticleDecl)baseType.getParticle())).fValue).fCompositor == XSModelGroupImpl.MODELGROUP_ALL);
                boolean derivedIsAll = (fParticle.fType == XSParticleDecl.PARTICLE_MODELGROUP
                                       && ((XSModelGroupImpl)fParticle.fValue).fCompositor == XSModelGroupImpl.MODELGROUP_ALL);

                if (baseIsAll || derivedIsAll) {
                    // XML Schema 1.1
                    //
                    // 4.2.3.2 If the {term} of the base particle has {compositor} all
                    //   and the {term} of the effective content also has {compositor}
                    //   all, then a Particle whose properties are as follows:
                    // {min occurs}
                    //      the {min occurs} of the effective content.
                    // {max occurs}
                    //      1
                    // {term}
                    //      a model group whose {compositor} is all and whose {particles}
                    //        are the {particles} of the {term} of the base particle followed
                    //        by the {particles} of the {term} of the effective content.
                    if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1 && baseIsAll && derivedIsAll) {
                        // Schema Component Constraint: Particle Valid (Extension)
                        //   3.1 E's {min occurs} is the same as B's {min occurs}.
                        if (fParticle.fMinOccurs != baseContent.fMinOccurs) {
                            throw new ComplexTypeRecoverableError("cos-particle-extends.3.1",
                                    new Object[]{}, complexContent);
                        }

                        XSModelGroupImpl group = new XSModelGroupImpl();
                        group.fCompositor = XSModelGroupImpl.MODELGROUP_ALL;
                        group.fParticleCount = ((XSModelGroupImpl)baseContent.fValue).fParticleCount + ((XSModelGroupImpl)fParticle.fValue).fParticleCount;
                        group.fParticles = new XSParticleDecl[group.fParticleCount];
                        System.arraycopy(((XSModelGroupImpl)baseContent.fValue).fParticles, 0, group.fParticles, 0, ((XSModelGroupImpl)baseContent.fValue).fParticleCount);
                        System.arraycopy(((XSModelGroupImpl)fParticle.fValue).fParticles, 0, group.fParticles, ((XSModelGroupImpl)baseContent.fValue).fParticleCount, ((XSModelGroupImpl)fParticle.fValue).fParticleCount);
                        group.fAnnotations = XSObjectListImpl.EMPTY_LIST;
                        // the particle to contain the above all
                        XSParticleDecl particle = new XSParticleDecl();
                        particle.fType = XSParticleDecl.PARTICLE_MODELGROUP;
                        particle.fValue = group;
                        particle.fAnnotations = XSObjectListImpl.EMPTY_LIST;
                        particle.fMinOccurs = fParticle.fMinOccurs;

                        fParticle = particle;
                        explicitOpenContent = (XSOpenContentDecl) baseType.getOpenContent();
                    }
                    else {
                        fAttrChecker.returnAttrArray(complexContentAttrValues, schemaDoc);
                        fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc);
                        throw new ComplexTypeRecoverableError("cos-all-limited.1.2",
                                new Object[]{}, complexContent);
                    }
                }
                // the "sequence" model group to contain both particles
                else {
                    XSModelGroupImpl group = new XSModelGroupImpl();
                    group.fCompositor = XSModelGroupImpl.MODELGROUP_SEQUENCE;
                    group.fParticleCount = 2;
                    group.fParticles = new XSParticleDecl[2];
                    group.fParticles[0] = (XSParticleDecl)baseType.getParticle();
                    group.fParticles[1] = fParticle;
                    group.fAnnotations = XSObjectListImpl.EMPTY_LIST;
                    // the particle to contain the above sequence
                    XSParticleDecl particle = new XSParticleDecl();
                    particle.fType = XSParticleDecl.PARTICLE_MODELGROUP;
                    particle.fValue = group;
                    particle.fAnnotations = XSObjectListImpl.EMPTY_LIST;
               
                    fParticle = particle;
                    if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
                        explicitOpenContent = (XSOpenContentDecl) baseType.getOpenContent();
                    }
                }
            }

            // Remove prohibited uses.   Must be done before merge for EXTENSION.
            fAttrGrp.removeProhibitedAttrs();
            try {
                mergeAttributes(baseType.getAttrGrp(), fAttrGrp, fName, true, complexContent);
            } catch (ComplexTypeRecoverableError e) {
                fAttrChecker.returnAttrArray(complexContentAttrValues, schemaDoc);
                fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc);
                throw e;
            }
        }

        //------------------------------------------------------------------------
        // XML Schema 1.1
        // Applies open content, if present
        //------------------------------------------------------------------------
        if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
            XSOpenContentDecl baseOpenContent = (XSOpenContentDecl) baseType.getOpenContent();

            // Let the wildcard element be  the appropriate case among the following:
            //    5.1 If the <openContent> [child] is present , then the <openContent> [child].
            //    5.2 If the <openContent> [child] is not present, the <schema> ancestor has an <defaultOpenContent> [child], and one of the following is true
            //      5.2.1 the {variety} of the explicit content type is not empty
View Full Code Here

Examples of org.apache.xerces.impl.xs.XSOpenContentDecl

        // General Attribute Checking for elmNode
        Object[] attrValues = fAttrChecker.checkAttributes(elmNode, isDefault, schemaDoc);

        // Create open content declaration
        XSOpenContentDecl ocDecl = new XSOpenContentDecl();

        // get attribute values
        final XInt modeAttr = (XInt) attrValues[XSAttributeChecker.ATTIDX_MODE];
        final short ocMode = modeAttr.shortValue();
       
View Full Code Here

Examples of org.apache.xerces.impl.xs.XSOpenContentDecl

        // -----------------------------------------------------------------------
        // Compose the final content and attribute uses
        // -----------------------------------------------------------------------
        XSParticleDecl baseContent = (XSParticleDecl)baseType.getParticle();
        // XML Schema 1.1
        XSOpenContentDecl explicitOpenContent = null;

        if (fDerivedBy==XSConstants.DERIVATION_RESTRICTION) {

            // This is an RESTRICTION

            // N.B. derivation-ok-restriction.5.3 is checked under schema
            // full checking.   That's because we need to wait until locals are
            // traversed so that occurrence information is correct.
            if (fContentType == XSComplexTypeDecl.CONTENTTYPE_MIXED &&
                    baseType.getContentType() != XSComplexTypeDecl.CONTENTTYPE_MIXED) {
                fAttrChecker.returnAttrArray(complexContentAttrValues, schemaDoc);
                fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc);
                throw new ComplexTypeRecoverableError("derivation-ok-restriction.5.4.1.2",
                        new Object[]{fName, baseType.getName()},
                        complexContent);
            }

            try {
                mergeAttributes(baseType.getAttrGrp(), fAttrGrp, fName, false, complexContent);
            } catch (ComplexTypeRecoverableError e) {
                fAttrChecker.returnAttrArray(complexContentAttrValues, schemaDoc);
                fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc);
                throw e;
            }
            // Remove prohibited uses.   Must be done after merge for RESTRICTION.
            fAttrGrp.removeProhibitedAttrs();

            if (baseType != SchemaGrammar.getXSAnyType(fSchemaHandler.fSchemaVersion)) {
                Object[] errArgs = fAttrGrp.validRestrictionOf(fName, baseType.getAttrGrp(), fSchemaHandler.fXSConstraints);
                if (errArgs != null) {
                    fAttrChecker.returnAttrArray(complexContentAttrValues, schemaDoc);
                    fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc);
                    throw new ComplexTypeRecoverableError((String)errArgs[errArgs.length-1],
                            errArgs, complexContent);
                }
            }
        }
        else {
           
            // This is an EXTENSION

            // Create the particle
            if (fParticle == null) {
                fContentType = baseType.getContentType();
                fXSSimpleType = (XSSimpleType)baseType.getSimpleType();
                fParticle = baseContent;
                if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
                    explicitOpenContent = (XSOpenContentDecl) baseType.getOpenContent();
                }
            }
            else if (baseType.getContentType() == XSComplexTypeDecl.CONTENTTYPE_EMPTY) {
            }
            else {
                //
                // Check if the contentType of the base is consistent with the new type
                // cos-ct-extends.1.4.3.2
                if (fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT &&
                        baseType.getContentType() != XSComplexTypeDecl.CONTENTTYPE_ELEMENT) {
                    fAttrChecker.returnAttrArray(complexContentAttrValues, schemaDoc);
                    fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc);
                    throw new ComplexTypeRecoverableError("cos-ct-extends.1.4.3.2.2.1.a",
                            new Object[]{fName}, complexContent);
                }
                else if (fContentType == XSComplexTypeDecl.CONTENTTYPE_MIXED &&
                        baseType.getContentType() != XSComplexTypeDecl.CONTENTTYPE_MIXED) {
                    fAttrChecker.returnAttrArray(complexContentAttrValues, schemaDoc);
                    fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc);
                    throw new ComplexTypeRecoverableError("cos-ct-extends.1.4.3.2.2.1.b",
                            new Object[]{fName}, complexContent);
                }

                // if the content of either type is an "all" model group, error.
                boolean baseIsAll = (((XSParticleDecl)baseType.getParticle()).fType == XSParticleDecl.PARTICLE_MODELGROUP
                                    && ((XSModelGroupImpl)(((XSParticleDecl)baseType.getParticle())).fValue).fCompositor == XSModelGroupImpl.MODELGROUP_ALL);
                boolean derivedIsAll = (fParticle.fType == XSParticleDecl.PARTICLE_MODELGROUP
                                       && ((XSModelGroupImpl)fParticle.fValue).fCompositor == XSModelGroupImpl.MODELGROUP_ALL);

                if (baseIsAll || derivedIsAll) {
                    // XML Schema 1.1
                    //
                    // 4.2.3.2 If the {term} of the base particle has {compositor} all
                    //   and the {term} of the effective content also has {compositor}
                    //   all, then a Particle whose properties are as follows:
                    // {min occurs}
                    //      the {min occurs} of the effective content.
                    // {max occurs}
                    //      1
                    // {term}
                    //      a model group whose {compositor} is all and whose {particles}
                    //        are the {particles} of the {term} of the base particle followed
                    //        by the {particles} of the {term} of the effective content.
                    if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1 && baseIsAll && derivedIsAll) {
                        // Schema Component Constraint: Particle Valid (Extension)
                        //   3.1 E's {min occurs} is the same as B's {min occurs}.
                        if (fParticle.fMinOccurs != baseContent.fMinOccurs) {
                            throw new ComplexTypeRecoverableError("cos-particle-extends.3.1",
                                    new Object[]{}, complexContent);
                        }

                        XSModelGroupImpl group = new XSModelGroupImpl();
                        group.fCompositor = XSModelGroupImpl.MODELGROUP_ALL;
                        group.fParticleCount = ((XSModelGroupImpl)baseContent.fValue).fParticleCount + ((XSModelGroupImpl)fParticle.fValue).fParticleCount;
                        group.fParticles = new XSParticleDecl[group.fParticleCount];
                        System.arraycopy(((XSModelGroupImpl)baseContent.fValue).fParticles, 0, group.fParticles, 0, ((XSModelGroupImpl)baseContent.fValue).fParticleCount);
                        System.arraycopy(((XSModelGroupImpl)fParticle.fValue).fParticles, 0, group.fParticles, ((XSModelGroupImpl)baseContent.fValue).fParticleCount, ((XSModelGroupImpl)fParticle.fValue).fParticleCount);
                        group.fAnnotations = XSObjectListImpl.EMPTY_LIST;
                        // the particle to contain the above all
                        XSParticleDecl particle = new XSParticleDecl();
                        particle.fType = XSParticleDecl.PARTICLE_MODELGROUP;
                        particle.fValue = group;
                        particle.fAnnotations = XSObjectListImpl.EMPTY_LIST;
                        particle.fMinOccurs = fParticle.fMinOccurs;

                        fParticle = particle;
                        explicitOpenContent = (XSOpenContentDecl) baseType.getOpenContent();
                    }
                    else {
                        fAttrChecker.returnAttrArray(complexContentAttrValues, schemaDoc);
                        fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc);
                        throw new ComplexTypeRecoverableError("cos-all-limited.1.2",
                                new Object[]{}, complexContent);
                    }
                }
                // the "sequence" model group to contain both particles
                else {
                    XSModelGroupImpl group = new XSModelGroupImpl();
                    group.fCompositor = XSModelGroupImpl.MODELGROUP_SEQUENCE;
                    group.fParticleCount = 2;
                    group.fParticles = new XSParticleDecl[2];
                    group.fParticles[0] = (XSParticleDecl)baseType.getParticle();
                    group.fParticles[1] = fParticle;
                    group.fAnnotations = XSObjectListImpl.EMPTY_LIST;
                    // the particle to contain the above sequence
                    XSParticleDecl particle = new XSParticleDecl();
                    particle.fType = XSParticleDecl.PARTICLE_MODELGROUP;
                    particle.fValue = group;
                    particle.fAnnotations = XSObjectListImpl.EMPTY_LIST;
               
                    fParticle = particle;
                    if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
                        explicitOpenContent = (XSOpenContentDecl) baseType.getOpenContent();
                    }
                }
            }

            // Remove prohibited uses.   Must be done before merge for EXTENSION.
            fAttrGrp.removeProhibitedAttrs();
            try {
                mergeAttributes(baseType.getAttrGrp(), fAttrGrp, fName, true, complexContent);
            } catch (ComplexTypeRecoverableError e) {
                fAttrChecker.returnAttrArray(complexContentAttrValues, schemaDoc);
                fAttrChecker.returnAttrArray(derivationTypeAttrValues, schemaDoc);
                throw e;
            }
        }

        //------------------------------------------------------------------------
        // XML Schema 1.1
        // Applies open content, if present
        //------------------------------------------------------------------------
        if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
            XSOpenContentDecl baseOpenContent = (XSOpenContentDecl) baseType.getOpenContent();

            // Let the wildcard element be  the appropriate case among the following:
            //    5.1 If the <openContent> [child] is present , then the <openContent> [child].
            //    5.2 If the <openContent> [child] is not present, the <schema> ancestor has an <defaultOpenContent> [child], and one of the following is true
            //      5.2.1 the {variety} of the explicit content type is not empty
View Full Code Here

Examples of org.apache.xerces.impl.xs.XSOpenContentDecl

        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) {
            XSOpenContentDecl oc = (XSOpenContentDecl)typeDecl.getOpenContent();
            if (oc == null) {
                cmValidator = fEmptyCM;
            }
            else {
                cmValidator = new XSEmptyCM(oc);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.