removed.put(removedNodePath, removedNodePath);
Name name = removedNodePath.getName();
int index = removedNodePath.getNormalizedIndex();
if (index > Path.INDEX_DEFAULT) {
Path.Element[] elems = removedNodePath.getElements();
PathBuilder pb = new PathBuilder();
for (int i = 0; i <= elems.length - 2; i++) {
pb.addLast(elems[i]);
}
Path parent = pb.getPath();
while (index > Path.INDEX_UNDEFINED) {
Path siblingP = getPathFactory().create(parent, name, --index, true);
if (removed.containsKey(siblingP)) {
// as the previous sibling has been remove -> the same index
// must be used to remove the node at removedNodePath.