public XSWildcardDecl nextWildcardTransition(int[] s, int[] sn, int[] index) { for (int idx = index[0] == -1 ? fNumElements : index[0] + 1; idx < fNumTotal; idx++) { if (isAllowedTransition(s, sn, idx)) { index[0] = idx; return fWildcards[idx]; } } index[0] = -1; return null; } private boolean isAllowedTransition(int[] s, int[] sn, int index) {
/** * one transition only * * @param curElem The current element's QName * @param state stack to store the previous state * @param subGroupHandler the substitution group handler * * @return null if transition is invalid; otherwise the Object corresponding to the * XSElementDecl or XSWildcardDecl identified. Also, the * state array will be modified to include the new state; this so that the validator can * store it away. * * @exception RuntimeException thrown on error */ public Object oneTransition(QName curElem, int[] state, SubstitutionGroupHandler subGroupHandler, XSElementDeclHelper eDeclHelper) { Object ret = oneTransition1(curElem, state, subGroupHandler, eDeclHelper); if (fOpenContent != null && ret == fOpenContent.fWildcard) { ret = fOpenContent; } return ret; } private Object oneTransition1(QName curElem, int[] state, SubstitutionGroupHandler subGroupHandler, XSElementDeclHelper eDeclHelper) {
postTreeBuildInit(fHeadNode); for (int index = 0; index < fLeafCount; index++) fFollowList[index] = new CMStateSet(fLeafCount); calcFollowList(fHeadNode); fTransTable[curState] = makeDefStateList(); statesToDo[curState] = setT; curState++; fTransTable[curState] = makeDefStateList(); fTransTable[fTransTableSize] = makeDefStateList(); fTransTable[fTransTableSize][fElemMapSize] = fTransTableSize; fFinalStateFlags[fTransTableSize] = true;
return findMatchingDecl(curElem, subGroupHandler); else if (allowExpandedName(fWildcards[elemIndex], curElem, subGroupHandler, eDeclHelper)) { matchingDecl = fWildcards[elemIndex]; break; state[1] = state[0]; state[0] = XSCMValidator.FIRST_ERROR; return findMatchingDecl(curElem, subGroupHandler); return findMatchingDecl(curElem, state, subGroupHandler, ++elemIndex, eDeclHelper); return findMatchingDecl(curElem, subGroupHandler);
buildDFA(syntaxTree);
XSCMValidator createDFACM(XSParticleDecl particle, boolean forUPA, XSOpenContentDecl openContent) { fLeafCount = 0; fParticleCount = 0; // convert particle tree to CM tree CMNode node = useRepeatingLeafNodes(particle) ? buildCompactSyntaxTree(particle) : buildSyntaxTree(particle, forUPA); if (node == null) return null; // build DFA content model from the CM tree return new XSDFACM(node, fLeafCount, fSchemaVersion, openContent); }
calcFollowList(((XSCMBinOp)nodeCur).getLeft()); calcFollowList(((XSCMBinOp)nodeCur).getRight()); calcFollowList(((XSCMBinOp)nodeCur).getLeft()); calcFollowList(((XSCMBinOp)nodeCur).getRight()); || nodeCur.type() == XSParticleDecl.PARTICLE_ONE_OR_MORE) { calcFollowList(((XSCMUniOp)nodeCur).getChild()); calcFollowList(((XSCMUniOp)nodeCur).getChild());
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; }
else if (allowExpandedName(fWildcards[elemIndex], curElem, subGroupHandler, eDeclHelper)) { matchingDecl = fWildcards[elemIndex]; break; state[1] = state[0]; state[0] = XSCMValidator.FIRST_ERROR; return findMatchingDecl(curElem, subGroupHandler);
public XSElementDecl nextElementTransition(int[] s, int[] sn, int[] index) { for (int idx = 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) {