protected void typeSubsumption(XSComplexTypeDecl dType, XSComplexTypeDecl bType, XSGrammarBucket grammarBucket, SubstitutionGroupHandler SGHandler, CMBuilder cmBuilder, XMLErrorReporter errorReporter, SimpleLocator locator) { // When we get here, particles are not null. Neither are content models. XSCMValidator cmd = dType.getContentModel(cmBuilder); XSCMValidator cmb = bType.getContentModel(cmBuilder); if (!new XS11CMRestriction(cmb, cmd, SGHandler, grammarBucket, cmBuilder, this).check()) { reportSchemaError(errorReporter, locator, "derivation-ok-restriction.5.4.2", new Object[]{dType.fName}); } }
private void getGlobalElements() { globals = new ArrayList(); SchemaGrammar[] sgs = gb.getGrammars(); for (int i = 0; i < sgs.length; i++) { addGlobals(sgs[i]); } }
private boolean matchElementInBase() { matchedHead = false; // Look for an element decl in the base if (!findElementInBase()) { // There is a route in the derived, but no matching // route in the base. not a valid restriction. return false; } // put this pair in the unprocessed states, if it's not there addState(); // Same element decl as derived, no need to look at sub-group. if (matchedHead) { return true; } // get all sub group elements XSElementDecl[] eds = sgh.getSubstitutionGroup(ed, Constants.SCHEMA_VERSION_1_1); for (int i = 0; i < eds.length; i++) { ed = eds[i]; // check whether there is a matching edge if (!findElementInBase()) { // if not, there is a route in the derived, but no matching // route in the base. not a valid restriction. return false; } // put this pair in the unprocessed states, if it's not there addState(); } return true; }
private Boolean checkWERestriction() { // Whether element name is allowed by the wildcard if (!allowName(eb.fTargetNamespace, eb.fName)) { return null; } // Skip wildcard in derived can't restrict element in base. if (wd.fProcessContents == XSWildcardDecl.PC_SKIP) { return Boolean.FALSE; } // Must be able to find a global decl. Otherwise wildcard in derived // can't restrict element in base. ed = getGlobalElementDecl(qname); if (ed == null) { return Boolean.FALSE; } // The global element decl must match the base element if (ed != eb && !checkEERestriction()) { return Boolean.FALSE; } // Good match. Subtract the name from the wildcard. wDNList.add(eb.fTargetNamespace); wDNList.add(eb.fName); return Boolean.TRUE; }
copyDerivedWildcard(); while (!emptyWildcard() && (wd1 = derived.nextWildcardTransition(d, dn, idx)) != null) { if (wd1 != wd) { subtractWildcard(wd1, true); Boolean res = checkWERestriction(); if (res != null) { if (!res.booleanValue()) { addState(); for (int j = 0; j < ebs.length; j++) { this.eb = ebs[j]; res = checkWERestriction(); if (res != null) { if (!res.booleanValue()) { addState(); while (!emptyWildcard() && (wb = base.nextWildcardTransition(b, bn, indexb)) != null) { if (subtractWildcard(wb, false)) { addState(); if (!emptyWildcard()) { return false;
copyDerivedWildcard(); int[] idx = new int[1]; idx[0] = -1; XSWildcardDecl wd1; while (!emptyWildcard() && (wd1 = derived.nextWildcardTransition(d, dn, idx)) != null) { if (wd1 != wd) { subtractWildcard(wd1, true); if (emptyWildcard()) { return true; while ((eb = base.nextElementTransition(b, bn, indexb)) != null) { int min = allb.min(indexb[0]); if (allowName(eb.fTargetNamespace, eb.fName)) { for (int j = 0; j < ebs.length; j++) { this.eb = ebs[j]; if (allowName(eb.fTargetNamespace, eb.fName)) { if (!base.isOpenContent(wb) && overlap()) { int min = allb.min(indexb[0]);
addAN(wc.fDisallowedNamesList[i].uri, wc.fDisallowedNamesList[i].localpart); getGlobalElements(); String name = (String)globals.get(i++); if (wc.allowNamespace(ns)) { addAN(ns, name); getBaseSiblings(); String name = (String)siblingsB.get(i++); if (wc.allowNamespace(ns)) { addAN(ns, name); getDerivedSiblings(); String name = (String)siblingsD.get(i++); if (wc.allowNamespace(ns)) { addAN(ns, name);
alld = (XS11AllCM)derived; Boolean res = checkAllDerived(); if (res != null) { return res.booleanValue(); if (!matchElementInBase()) { return false; wDNList.addAll(excludedElementsCopy); if (!matchWildcardInBase()) { return false; return checkFinalStates();
private Boolean checkAllDerived() { Boolean ret = checkAllEmpty(); if (ret != null) { return ret; Boolean ret = checkAllAll(); Boolean ret = checkAllDFA();
private boolean allowName(String ns, String name) { // Check namespace first if (!allowNS(ns)) { return false; } // Whether the name is in the disallowed list for (int i = 0; i < wDNList.size(); i+=2) { if (ns == wDNList.get(i) && name == wDNList.get(i+1)) { return false; } } // Whether the name is in the allowed list for (int i = 0; i < wANList.size(); i+=2) { if (ns == wANList.get(i) && name == wANList.get(i+1)) { return true; } } // Additional ##sibling and ##defined checks qname.uri = ns; qname.localpart = name; return derived.allowExpandedName(wd, qname, sgh, this); }
private void addAN(String ns, String name) { // Only add if it's allowed by the current wildcard if (!allowNS(ns)) { return; } // Only add if the name is not in the disallowed name list. for (int i = 0; i < wDNList.size();) { if (wDNList.get(i++) == ns && wDNList.get(i++) == name) { return; } } // Only add if the name is allowed by the wildcard in terms of // ##sibling and ##defined. qname.uri = ns; qname.localpart = name; if (!derived.allowExpandedName(wd, qname, sgh, this)) { return; } // The name is allowed, add it. wANList.add(ns); wANList.add(name); }
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, ""}); } }