- StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>> current = (StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>>) lookupStartStorage.getFromLocalStorage(ChildSchemaNodes.class, iterator.next());
- while(current != null && iterator.hasNext()) {
- current = (StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>>) current.getFromNamespace(ChildSchemaNodes.class, iterator.next());
+ QName nextPath = iterator.next();
+ StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>> current = (StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>>) lookupStartStorage
+ .getFromLocalStorage(ChildSchemaNodes.class, nextPath);
+ if(current == null && lookupStartStorage instanceof StmtContext<?, ?, ?>) {
+ return tryToFindUnknownStatement(nextPath.getLocalName(), (Mutable<?, ?, EffectiveStatement<?, ?>>) lookupStartStorage);
+ }
+ while (current != null && iterator.hasNext()) {
+ nextPath = iterator.next();
+ StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>> nextNodeCtx = (StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>>) current
+ .getFromNamespace(ChildSchemaNodes.class, nextPath);
+ if (nextNodeCtx == null) {
+ return tryToFindUnknownStatement(nextPath.getLocalName(), current);
+ } else {
+ current = nextNodeCtx;
+ }