https://github.com/sibprogrammer/xq Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code + Explore + All features + Documentation + GitHub Skills + Blog * Solutions + By Plan + Enterprise + Teams + Compare all + By Solution + CI/CD & Automation + DevOps + DevSecOps + Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles + Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} sibprogrammer / xq Public * Notifications * Fork 4 * Star 197 Command-line XML and HTML beautifier and content extractor License MIT license 197 stars 4 forks Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights sibprogrammer/xq This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 1 branch 9 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/s] Use Git or checkout with SVN using the web URL. [gh repo clone sibpro] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP * Codespaces is rolling out You don't have access just yet, but in the meantime, you can learn about Codespaces Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @sibprogrammer sibprogrammer TECH Remove version number from man page to avoid release sync problems ... 5ba5473 Nov 7, 2022 TECH Remove version number from man page to avoid release sync problems 5ba5473 Git stats * 55 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github/workflows TECH Switch to Go 1.19 Oct 16, 2022 assets/images TECH Add a better screenshot for hi-res displays Oct 23, 2022 cmd TECH Use more descriptive custom messages for default commands Nov 6, 2022 docs TECH Remove version number from man page to avoid release sync problems Nov 7, 2022 internal/utils Fix #11: Add HTML formatter support Oct 22, 2022 scripts Fix build for MacOS M1 platform Aug 28, 2022 test/data Fix #11: Add HTML formatter support Oct 22, 2022 .gitignore TECH Ignore artifacts of goreleaser Nov 6, 2021 .goreleaser.yml Fix build for MacOS M1 platform Aug 28, 2022 LICENSE Add information about the license Nov 13, 2021 README.md TECH Add Homebrew badge Oct 23, 2022 go.mod Fix #11: Add HTML formatter support Oct 22, 2022 go.sum Fix #11: Add HTML formatter support Oct 22, 2022 main.go Add info about the version of the binary Nov 7, 2021 View code xq Features Usage Installation README.md xq build Homebrew Command-line XML and HTML beautifier and content extractor. xq Features * Syntax highlighting * Automatic indentation and formatting * Automatic pagination * Node content extraction Usage Format an XML file and highlight the syntax: xq test/data/xml/unformatted.xml xq also accepts input through stdin: curl -s https://www.w3schools.com/xml/note.xml | xq HTML content can be formatted and highlighted as well (using -m flag): xq -m test/data/html/formatted.html It is possible to extract the content using XPath query language. -x parameter accepts XPath expression. Extract the text content of all nodes with city name: cat test/data/xml/unformatted.xml | xq -x //city Extract the value of attribute named status and belonging to user: cat test/data/xml/unformatted.xml | xq -x /user/@status See https://en.wikipedia.org/wiki/XPath for details. Installation The preferable ways to install the utility are described below. For macOS: brew install xq For Linux: curl -sSL https://bit.ly/install-xq | sudo bash For Fedora via package manager: dnf install xq If you have Go toolchain installed, you can use the following command to install xq: go install github.com/sibprogrammer/xq@latest About Command-line XML and HTML beautifier and content extractor Topics syntax-highlighting html formatter terminal xml xpath Resources Readme License MIT license Stars 197 stars Watchers 5 watching Forks 4 forks Releases 8 v1.0.0 Latest Nov 6, 2022 + 7 releases Packages 0 No packages published Languages * Go 88.8% * HTML 6.1% * Shell 5.1% Footer (c) 2022 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.