in src/main/java/org/apache/maven/xinclude/stax/XMLElementEvaluator.java [85:104]
private XMLElement<T> evaluateElementPointerPart(ElementPointerPart elementPointerPart) {
if (elementPointerPart.hasChildSequence() && elementPointerPart.hasNCName()) { // Both NCName and childSequence.
// Find NCName.
XMLElement<T> element = evaluateShorthandPointer(elementPointerPart.getNCName());
if (element == null) {
return null;
}
// Walk through children.
return evaluateChildSequence(element, elementPointerPart.getChildSequence());
} else if (elementPointerPart.hasNCName()) { // Only NCName
return evaluateShorthandPointer(elementPointerPart.getNCName());
} else { // Only a childSequence
// XML must only have 1 root element so we can't evaluate it if its > 1
List<Integer> childSequence = elementPointerPart.getChildSequence();
if (childSequence.get(0) > 1) {
return null;
}
return evaluateChildSequence(root, childSequence.subList(1, childSequence.size()));
}
}