A Go package for querying XML, HTML, and JSON documents using XPath expressions.
antchfx/xpath is a Go package that enables selecting nodes from XML, HTML, and JSON documents using XPath expressions. It provides a powerful and flexible way to navigate and extract data from structured documents, making it essential for data parsing and web scraping tasks in Go applications.
Go developers who need to parse, query, or extract data from XML, HTML, or JSON documents, particularly those involved in web scraping, data integration, or document processing.
Developers choose this package for its unified XPath interface across multiple document formats (XML, HTML, JSON), comprehensive support for XPath 1.0 with select XPath 2.0 extensions, and dedicated integration packages (htmlquery, xmlquery, jsonquery) for type-specific optimizations.
XPath package for golang, supports HTML, XML, JSON document query and more
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Unified interface for querying XML, HTML, and JSON documents, as emphasized in the Key Features, eliminating the need for separate parsing libraries.
Implements core XPath 1.0 patterns, axes, and expressions, covering 90% of common use cases per the README, including complex node navigation.
Includes useful XPath 2.0 functions like lower-case() and string-join() for enhanced string manipulation, as noted in the supported features list.
Provides dedicated packages (htmlquery, xmlquery, jsonquery) for type-specific document handling, simplifying setup and improving performance for each format.
Lacks several XPath 1.0 and 2.0 functions, such as choose(), document(), and format-number(), as listed in the unsupported functions table, limiting advanced XML processing.
XPath queries can introduce latency compared to native Go parsing methods, especially for large documents or high-frequency queries, due to expression evaluation overhead.
Limited to the Go ecosystem, making it unsuitable for projects that require cross-language compatibility or integration with other XPath tools in polyglot environments.