/** * Finds the leaf node at the given offset * * @param document root node * @param line the line * @param column the column, or -1 * @return the leaf node at that offset, if any */ @Nullable public static Node findNodeAtLineAndCol(@NonNull Document document, int line, int column) { Element root = document.getDocumentElement(); if (root != null) { return findNodeAtLineAndCol(root, line, column); } return null; }
for (int i = 0, n = children.getLength(); i < n; i++) { Node item = children.item(i); Node match = findNodeAtLineAndCol(item, line, column); if (match != null) { return match; for (int i = 0, n = attributes.getLength(); i < n; i++) { Node item = attributes.item(i); Node match = findNodeAtLineAndCol(item, line, column); if (match != null) { return match;