navigation.setPriority(priority);
next = navigator.sibling();
if (next == Element.PAGE_NODES) {
for (StaxNavigator<Element> fork : navigator.fork(Element.PAGE_NODES)) {
NavigationFragment fragment = new NavigationFragment();
navigation.addFragment(fragment);
next = fork.child();
if (next == Element.PARENT_URI) {
String parentUri = fork.getContent();
if (parentUri == null) {
parentUri = "";
} else if (parentUri.charAt(0) == '/') {
parentUri = parentUri.substring(1, parentUri.length());
}
fragment.setParentURI(parentUri);
next = fork.sibling();
}
if (next == Element.NODE) {
ArrayList<PageNode> nodes = new ArrayList<PageNode>();
for (StaxNavigator<Element> nodeFork : fork.fork(Element.NODE)) {
nodes.add(unmarshalNode(nodeFork));
}
fragment.setNodes(nodes);
} else if (next != null) {
throw unknownElement(fork);
}
}
} else if (next != null) {