List<Bookmark> (@NotNull Element element) { List<Bookmark> result = new ArrayList<>(); for (Element bookmarkElement : element.getChildren("bookmark")) { String url = bookmarkElement.getAttributeValue("url"); if (StringUtil.isEmptyOrSpaces(url)) { continue; } String line = bookmarkElement.getAttributeValue("line"); String description = StringUtil.notNullize(bookmarkElement.getAttributeValue("description")); String mnemonic = bookmarkElement.getAttributeValue("mnemonic"); int lineIndex = -1; if (line != null) { try { lineIndex = Integer.parseInt(line); } catch (NumberFormatException ignore) { // Ignore. Will miss bookmark if line number cannot be parsed continue; } } Bookmark bookmark = new Bookmark(url, lineIndex, description); if (mnemonic != null && mnemonic.length() == 1) { bookmark.setMnemonic(mnemonic.charAt(0)); } result.add(bookmark); } return result; }