if (!isDerived && base.isOpenContent(wc) && wANList.size() > 0) { for (int i = 0; i < wANList.size();) { qname.uri = (String)wANList.get(i++); if (!base.allowExpandedName(wc, qname, sgh, this)) { return false;
private boolean checkFinalStates() { for (int i = 0 ; i < states.size(); i++) { StatePair sp = (StatePair)states.get(i); sp.getStates(b, d); if (derived.endContentModel(d) && !base.endContentModel(b)) { return false; } } return true; }
public boolean check() { b = base.startContentModel(); bn = base.startContentModel(); d = derived.startContentModel(); dn = derived.startContentModel(); while ((ed = derived.nextElementTransition(d, dn, indexd)) != null) { while ((wd = derived.nextWildcardTransition(d, dn, indexd)) != null) {
while ((eb = base.nextElementTransition(b, bn, indexb)) != null) { int ib = indexb[0]; if (eb.getName() == ed.getName() && eb.getNamespace() == ed.getNamespace()) {
int[] matchD = derived.startContentModel(); int[] usedB = base.startContentModel(); indexd[0] = -1; while ((ed = derived.nextElementTransition(d, dn, indexd)) != null) { wDNList.addAll(siblingsD); indexd[0] = -1; while ((wd = derived.nextWildcardTransition(d, dn, indexd)) != null) { if (!matchWE(usedB)) { int[] min = base.startContentModel(), max = base.startContentModel(); indexd[0] = -1; while ((ed = derived.nextElementTransition(d, dn, indexd)) != null) { indexb[0] = matchD[indexd[0]]; if (indexb[0] >= 0) {
idx[0] = -1; XSWildcardDecl wd1; while (!emptyWildcard() && (wd1 = derived.nextWildcardTransition(d, dn, idx)) != null) { if (wd1 != wd) { subtractWildcard(wd1, true); while ((eb = base.nextElementTransition(b, bn, indexb)) != 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]);
qname.uri = (String)wANList.get(i++); qname.localpart = (String)wANList.get(i++); if (base.allowExpandedName(wb, qname, sgh, this)) { return true;
private boolean matchWE(int[] usedB) { indexb[0] = -1; while ((eb = base.nextElementTransition(b, bn, indexb)) != null) { int ib = indexb[0];
if (derived.isOpenContent(wd)) { 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); while ((eb = base.nextElementTransition(b, bn, indexb)) != null) { while (!emptyWildcard() && (wb = base.nextWildcardTransition(b, bn, indexb)) != null) {
private boolean findElementInBase() { // for all edges in the base that leaves the base state // check whether it's an edge matching the base edge. // if it is, return the next state. indexb[0] = -1; while ((eb = base.nextElementTransition(b, bn, indexb)) != null) { // Base element edge, check whether it matches the derived element if (matchElementWithBaseElement()) { // If name matches, check type, nil, fixed etc. return checkEERestriction(); } } // No matching element edge, try wildcards. indexb[0] = -1; while ((wb = base.nextWildcardTransition(b, bn, indexb)) != null) { // Base wildcard edge, check whether it matches the derived element qname.uri = ed.fTargetNamespace; qname.localpart = ed.fName; if (base.allowExpandedName(wb, qname, sgh, this)) { // If name matches, check whether there is a matching global. return checkEWRestriction(); } } return false; }
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); }
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 getBaseSiblings() { siblingsB = base.getDefinedNames(sgh); }
private void addState() { // Optimize the states when possible. derived.optimizeStates(base, bn, dn, indexb[0]); // Reuse the "pair" object if (pair == null) { pair = new StatePair(bn, dn); } else { pair.set(bn, dn); } // Only add if the pair isn't already in the list if (!states.contains(pair)) { states.add(pair); pair = null; } }
private void getDerivedSiblings() { siblingsD = derived.getDefinedNames(sgh); }
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); }