public synchronized XSCMValidator getContentModel(CMBuilder cmBuilder, boolean forUPA) { if (fCMValidator == null) { if (forUPA) { if (fUPACMValidator == null) { fUPACMValidator = cmBuilder.getContentModel(this, true); if (fUPACMValidator != null && !fUPACMValidator.isCompactedForUPA()) { fCMValidator = fUPACMValidator; } } return fUPACMValidator; } else { fCMValidator = cmBuilder.getContentModel(this, false); } } return fCMValidator; }
protected void groupSubsumption(XSParticleDecl dParticle, XSParticleDecl bParticle, XSGrammarBucket grammarBucket, SubstitutionGroupHandler SGHandler, CMBuilder cmBuilder, XMLErrorReporter errorReporter, String dName, SimpleLocator locator) { // When we get here, particles are not null. Neither are content models. XSCMValidator cmd = cmBuilder.getContentModel(dParticle); XSCMValidator cmb = cmBuilder.getContentModel(bParticle); if (!new XS11CMRestriction(cmb, cmd, SGHandler, grammarBucket, cmBuilder, this).check()) { reportSchemaError(errorReporter, locator, "src-redefine.6.2.2", new Object[]{dName, ""}); } }
/** * Get content model for a given type * * @param typeDecl get content model for which complex type * @return a content model validator */ public XSCMValidator getContentModel(XSComplexTypeDecl typeDecl, boolean forUPA) { // 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; } return getContentModel((XSParticleDecl)typeDecl.getParticle(), (XSOpenContentDecl)typeDecl.getOpenContent(), forUPA); }
private XSCMValidator getContentModel(XSParticleDecl particle, XSOpenContentDecl openContent, boolean forUPA) { // if there is no particle, 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) { if (fSchemaVersion < Constants.SCHEMA_VERSION_1_1) { cmValidator = createAllCM(particle); } else { cmValidator = createAll11CM(particle, openContent); } } else { cmValidator = createDFACM(particle, forUPA, openContent); } //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.