A command-line tool for formatting, highlighting, and extracting content from XML and HTML documents.
xq is a command-line XML and HTML beautifier and content extractor. It formats and highlights markup for readability and allows extraction of specific content using XPath or CSS selectors. It also converts XML to JSON, making it useful for data transformation and analysis in shell scripts.
Developers, system administrators, and data engineers who work with XML/HTML files in terminal environments and need to inspect, format, or extract data from them.
It combines formatting, highlighting, and powerful query-based extraction in a single, fast command-line tool, with support for JSON output and seamless pipeline integration, unlike many GUI-based or language-specific libraries.
Command-line XML and HTML beautifier and content extractor
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Automatically indents and colorizes XML/HTML output in the terminal, improving readability for debugging and inspection, as shown in the screenshot and usage examples with the -i flag for in-place edits.
Supports both XPath queries and CSS selectors for extracting text, attributes, or nodes, allowing versatile data retrieval from markup files, demonstrated with examples like 'xq -x //city' or '-q "body > p"'.
Converts XML documents to structured JSON with preserved hierarchy and attributes using the -j flag, facilitating integration with JSON-based tools and pipelines, as detailed in the output format description.
Designed for composability with stdin/stdout, enabling seamless use in command-line workflows, such as piping curl output directly into xq for formatting or extraction.
Cannot process dynamic HTML content rendered by JavaScript, limiting its effectiveness for modern web scraping where pages rely heavily on client-side scripting, as it only handles static markup.
Likely supports only basic XPath 1.0 based on the README examples, missing advanced functions or data types from XPath 2.0/3.0, which could restrict complex querying scenarios.
The -i flag for in-place formatting modifies files directly without backups, posing a risk of accidental data loss if misused, though this is a common trade-off in CLI tools.