Files
sousa-gecko/mobile/android/android-components/components/lib/bookmark-parser-jsoup
Ryan VanderMeulen c9be87198e Bug 2044785 - Update AndroidX Core to version 1.19.0. r=android-reviewers,ai4dev-reviewers,adhingra,suhaib
AndroidX Core 1.19 folds the core-ktx artifact into core, so drop the androidx-core-ktx catalog
alias and move consumers from libs.androidx.core.ktx to libs.androidx.core.

Differential Revision: https://phabricator.services.mozilla.com/D309650
2026-06-30 19:00:44 +00:00
..
…
…

android-components > Lib > Bookmark Parser Jsoup

A jsoup-based implementation of concept-bookmarks-parser that parses HTML bookmark files in the Netscape Bookmark format.

Usage

Setting up the dependency

Use Gradle to download the library from maven.mozilla.org:

implementation "org.mozilla.components:lib-bookmark-parser-jsoup:{latest-version}"

JsoupBookmarksFileParser

JsoupBookmarksFileParser parses a bookmark file URI into a tree of InsertableBookmarkNodes using Jsoup.

val parser = BookmarksFileParser.jsoupParser(...)

lifecycleScope.launch {
    context.contentResolver.openInputStream(uri) { stream ->
        parser.parse(stream)
            .onSuccess { parseResult: BookmarksParseResult ->
                // use like:
                // parseResult.bookmarksCount
                // parseResult.foldersCount
                // parseResult.tree
            }
    }
}

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/