List<Element> (@Nullable Element container, String subPath) { if (container == null) return Collections.emptyList(); int firstDot = subPath.indexOf('.'); if (firstDot == -1) { return container.getChildren(subPath); } String childName = subPath.substring(0, firstDot); String pathInChild = subPath.substring(firstDot + 1); List<Element> result = new ArrayList<>(); for (Element each : container.getChildren(childName)) { Element child = findChildByPath(each, pathInChild); if (child != null) result.add(child); } return result; }