/** * Finds the leaf node at the given offset * * @param document root node * @param offset offset to look for * @return the leaf node at that offset, if any */ @Nullable public static Node findNodeAtOffset(@NonNull Document document, int offset) { Element root = document.getDocumentElement(); if (root != null) { return findNodeAtOffset(root, offset); } return null; }
@Nullable @Override public Node findNodeAt(@NonNull XmlContext context, int offset) { return PositionXmlParser.findNodeAtOffset(context.document, offset); }
for (int i = 0, n = children.getLength(); i < n; i++) { Node item = children.item(i); Node match = findNodeAtOffset(item, offset); if (match != null) { return match; for (int i = 0, n = attributes.getLength(); i < n; i++) { Node item = attributes.item(i); Node match = findNodeAtOffset(item, offset); if (match != null) { return match;