in xmlschema-walker/src/main/java/org/apache/ws/commons/schema/docpath/XmlSchemaPathFinder.java [1524:1571]
private void walkUpTree(QName currElem) {
final XmlSchemaStateMachineNode state = currentPath.getStateMachineNode();
switch (state.getNodeType()) {
case ANY:
break;
case ELEMENT:
if (!state.getElement().getQName().equals(currElem)) {
throw new IllegalStateException("We expected to walk upwards from element " + currElem
+ ", but our current element is "
+ state.getElement().getQName());
}
break;
default:
throw new IllegalStateException("We expected to walk upwards from element " + currElem
+ ", but our current position is in a node of type "
+ state.getNodeType());
}
XmlSchemaDocumentNode<U> iter = currentPath.getDocumentNode();
XmlSchemaPathNode<U, V> path = currentPath;
do {
if (iter.getIteration() < iter.getStateMachineNode().getMaxOccurs()) {
break;
}
if (!isPositionFulfilled(path, null).equals(Fulfillment.COMPLETE)) {
break;
}
iter = iter.getParent();
if (iter == null) {
// We are exiting the root node. Nothing to see here!
break;
}
final XmlSchemaPathNode<U, V> nextPath = pathMgr
.addParentSiblingOrContentNodeToPath(path, XmlSchemaPathNode.Direction.PARENT);
path.setNextNode(-1, nextPath);
path = nextPath;
} while (!iter.getStateMachineNode().getNodeType().equals(XmlSchemaStateMachineNode.Type.ELEMENT));
currentPath = path;
}