XSCMValidator createAll11CM(XSParticleDecl particle, XSOpenContentDecl openContent) { 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 XS11AllCM allContent = new XS11AllCM(particle.fMinOccurs == 0, group.fParticleCount, group.fParticles, openContent); return allContent; }
public XSWildcardDecl nextWildcardTransition(int[] s, int[] sn, int[] index) { int idx = index[0] == -1 ? fNumElements : index[0] + 1; for (; idx < fNumTotal; idx++) { if (isAllowedTransition(s, sn, idx)) { index[0] = idx; return fWildcards[idx]; } } if (idx == fNumTotal && isOpenContentAllowed(s, sn)) { index[0] = fNumTotal; return fOpenContent.fWildcard; } index[0] = -1; return null; } private boolean isAllowedTransition(int[] s, int[] sn, int index) {
private Boolean checkAllAll() { if (allb.getOpenContent() != null && allb.getOpenContent().fMode == XSOpenContentDecl.MODE_SUFFIX && alld.getOpenContent() != null && alld.getOpenContent().fMode == XSOpenContentDecl.MODE_INTERLEAVE) { if (alld.hasOptionalContent()) { if (!checkOptionalContent()) { return Boolean.FALSE; else if (allb.hasOptionalContent()) { indexb[0] = matchD[indexd[0]]; if (indexb[0] >= 0) { alld.collectOccurs(min, max, indexb[0], indexd[0]); allb = allb.copy(); alld = alld.copy(); if (!allb.removeAsBase(min, max, usedB)) { alld.removeAsDerived(max, usedB, matchD);
int totalMin = allb.totalMin(); if (!allb.hasOptionalContent() && totalMin != 0) { return false; XSOpenContentDecl oc = alld.getOpenContent(); wd = oc == null ? null : oc.fWildcard; if (wd == null) { int min = allb.min(indexb[0]); if (allowName(eb.fTargetNamespace, eb.fName)) { while ((wb = base.nextWildcardTransition(b, bn, indexb)) != null) { if (!base.isOpenContent(wb) && overlap()) { int min = allb.min(indexb[0]);
return findMatchingDecl(elementName, subGroupHandler); if (allowExpandedName(fOpenContent.fWildcard, elementName, subGroupHandler, eDeclHelper)) { return fOpenContent; return findMatchingDecl(elementName, subGroupHandler); continue; if (allowExpandedName(fWildcards[i], elementName, subGroupHandler, eDeclHelper)) { if (isFinal(currentState)) { currentState[0] = STATE_SUFFIX; return findMatchingDecl(elementName, subGroupHandler); if (allowExpandedName(fOpenContent.fWildcard, elementName, subGroupHandler, eDeclHelper)) { return findMatchingDecl(elementName, subGroupHandler);
Object findMatchingDecl(QName elementName, SubstitutionGroupHandler subGroupHandler) { Object matchingDecl = findMatchingElemDecl(elementName, subGroupHandler); if (matchingDecl != null) { return matchingDecl; } for (int i = fNumElements; i < fNumTotal; i++) { if (fWildcards[i].allowQName(elementName)) { return fWildcards[i]; } } return null; }
public XSElementDecl nextElementTransition(int[] s, int[] sn, int[] index) { for (int idx = index[0] == -1 ? 1 : index[0] + 1; idx < fNumElements; idx++) { if (isAllowedTransition(s, sn, idx)) { index[0] = idx; return fElements[idx]; } } index[0] = -1; return null; } public XSWildcardDecl nextWildcardTransition(int[] s, int[] sn, int[] index) {
public boolean allowExpandedName(XSWildcardDecl wildcard, QName curElem, SubstitutionGroupHandler subGroupHandler, XSElementDeclHelper eDeclHelper) { if (wildcard.allowQName(curElem)) { if (wildcard.fDisallowedSibling && findMatchingElemDecl(curElem, subGroupHandler) != null) { return false; } if (wildcard.fDisallowedDefined && eDeclHelper.getGlobalElementDecl(curElem) != null) { return false; } return true; } return false; }
XS11AllCM copy() { int[] minOccurs, maxOccurs; if (fNumTotal > 1) { minOccurs = new int[fNumTotal]; maxOccurs = new int[fNumTotal]; System.arraycopy(fMinOccurs, 0, minOccurs, 0, fNumTotal); System.arraycopy(fMaxOccurs, 0, maxOccurs, 0, fNumTotal); } else { minOccurs = null; maxOccurs = null; } return new XS11AllCM(fHasOptionalContent, fElements, fWildcards, minOccurs, maxOccurs, fNumElements, fNumTotal, fOpenContent); } // Collect occurrence information as the derived content model.
private Boolean checkAllEmpty() { // If base (empty) has an open content, turn it into an "all". int[] idx = new int[]{-1}; if (base.nextWildcardTransition(b, bn, idx) != null) { base = new XS11AllCM(false, 0, null, ((XSEmptyCM)base).getOpenContent()); return null; } // Base allows nothing. Derived must be empty too. return Boolean.valueOf(derived.nextElementTransition(d, dn, idx) == null && derived.nextWildcardTransition(d, dn, idx) == null); }