// Calculate relative path of missing entries
Path anyParentPath = anyParent.getWorkspacePath();
Path relPath = anyParentPath.computeRelativePath(info.getPath());
Path.Element[] missingElems = relPath.getElements();
NodeEntry entry = anyParent;
int last = missingElems.length - 1;
for (int i = 0; i <= last; i++) {
if (missingElems[i].denotesParent()) {
// Walk up the hierarchy for 'negative' paths
// until the smallest common root is found
entry = entry.getParent();
} else if (missingElems[i].denotesName()) {
// Add missing elements starting from the smallest common root
Name name = missingElems[i].getName();
int index = missingElems[i].getNormalizedIndex();
if (i == last && !info.denotesNode()) {
return entry.getOrAddPropertyEntry(name);
} else {
entry = createNodeEntry(entry, name, index);
}
}
}