{"id":13490749,"url":"https://github.com/sibprogrammer/xq","last_synced_at":"2025-10-21T04:56:53.116Z","repository":{"id":44476664,"uuid":"425244819","full_name":"sibprogrammer/xq","owner":"sibprogrammer","description":"Command-line XML and HTML beautifier and content extractor","archived":false,"fork":false,"pushed_at":"2025-09-30T13:57:47.000Z","size":542,"stargazers_count":1015,"open_issues_count":10,"forks_count":31,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-09-30T15:31:08.373Z","etag":null,"topics":["cli","formatter","golang","html","syntax-highlighting","terminal","xml","xpath"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sibprogrammer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-11-06T12:59:34.000Z","updated_at":"2025-09-30T13:56:51.000Z","dependencies_parsed_at":"2024-01-03T04:14:24.984Z","dependency_job_id":"9acce936-af83-4546-8a88-30fd2a680f84","html_url":"https://github.com/sibprogrammer/xq","commit_stats":{"total_commits":100,"total_committers":5,"mean_commits":20.0,"dds":0.12,"last_synced_commit":"e8f8be6f785dc9afbe7084923933febbf79d7f39"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/sibprogrammer/xq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sibprogrammer%2Fxq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sibprogrammer%2Fxq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sibprogrammer%2Fxq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sibprogrammer%2Fxq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sibprogrammer","download_url":"https://codeload.github.com/sibprogrammer/xq/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sibprogrammer%2Fxq/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280207209,"owners_count":26290616,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","formatter","golang","html","syntax-highlighting","terminal","xml","xpath"],"created_at":"2024-07-31T19:00:50.600Z","updated_at":"2025-10-21T04:56:53.110Z","avatar_url":"https://github.com/sibprogrammer.png","language":"Go","readme":"# xq\n\n[![build](https://github.com/sibprogrammer/xq/workflows/build/badge.svg)](https://github.com/sibprogrammer/xq/actions)\n[![Go Report Card](https://goreportcard.com/badge/github.com/sibprogrammer/xq)](https://goreportcard.com/report/github.com/sibprogrammer/xq)\n[![Codecov](https://codecov.io/gh/sibprogrammer/xq/branch/master/graph/badge.svg?token=G6QX77SQOH)](https://codecov.io/gh/sibprogrammer/xq)\n[![Scc Count](https://sloc.xyz/github/sibprogrammer/xq/)](https://github.com/sibprogrammer/xq/)\n[![Homebrew](https://img.shields.io/badge/dynamic/json.svg?url=https://formulae.brew.sh/api/formula/xq.json\u0026query=$.versions.stable\u0026label=homebrew)](https://formulae.brew.sh/formula/xq)\n[![Macports](https://repology.org/badge/version-for-repo/macports/xq-sibprogrammer.svg)](https://repology.org/project/xq-sibprogrammer/versions)\n\nCommand-line XML and HTML beautifier and content extractor.\n\n![xq](./assets/images/screenshot.png?raw=true)\n\n# Features\n\n* Syntax highlighting\n* Automatic indentation and formatting\n* Automatic pagination\n* Node content extraction\n\n# Usage\n\nFormat an XML file and highlight the syntax:\n\n```\nxq test/data/xml/unformatted.xml\n```\n\n`xq` also accepts input through `stdin`:\n\n```\ncurl -s https://www.w3schools.com/xml/note.xml | xq\n```\n\nHTML content can be formatted and highlighted as well (using `-m` flag):\n\n```\nxq -m test/data/html/formatted.html\n```\n\nIt is possible to extract the content using XPath query language.\n`-x` parameter accepts XPath expression.\n\nExtract the text content of all nodes with `city` name:\n\n```\ncat test/data/xml/unformatted.xml | xq -x //city\n```\n\nExtract the value of attribute named `status` and belonging to `user`:\n\n```\ncat test/data/xml/unformatted.xml | xq -x /user/@status\n```\n\nSee https://en.wikipedia.org/wiki/XPath for details.\n\nIt is possible to use CSS selector to extract the content as well:\n\n```\ncat test/data/html/unformatted.html | xq -q \"body \u003e p\"\n```\n\nExtract an attribute value instead of node content additional option `--attr` (`-a`) can be used:\n\n```\ncat test/data/html/unformatted.html | xq -q \"head \u003e script\" -a \"src\"\n```\n\nExtract part of HTML with tags (not only text content) using CSS selector:\n\n```\ncat test/data/html/unformatted.html | xq -n -q \"head\"\n```\n\nOutput the result as JSON:\n\n```\ncat test/data/xml/unformatted.xml | xq -j\n```\n\nThis will output the result in JSON format, preserving the XML structure. The JSON output will be an object where:\n- XML elements become object keys\n- Attributes are prefixed with \"@\"\n- Text content is stored under \"#text\" if the element has attributes or child elements\n- Repeated elements are automatically converted to arrays\n- Elements with only text content are represented as strings\n\n# Installation\n\nThe preferable ways to install the utility are described below.\n\nFor macOS, via [Homebrew](https://brew.sh):\n```\nbrew install xq\n```\n\nFor macOS, via [MacPorts](https://www.macports.org):\n```\nsudo port install xq\n```\n\nFor Linux using custom installer:\n```\ncurl -sSL https://bit.ly/install-xq | sudo bash\n```\n\nFor Linux using custom installer, changing INSTALL_DIR, without sudo:\n```\ncurl -sSL https://bit.ly/install-xq | INSTALL_DIR=$(pwd) bash\n```\n\nFor Ubuntu 22.10 or higher via package manager:\n```\napt-get install xq\n```\n\nFor Fedora via package manager:\n```\ndnf install xq\n```\n\nA more detailed list of Linux distros that package the `xq` utility can be found here:\nhttps://repology.org/project/xq-sibprogrammer/versions\n\nIf you have Go toolchain installed, you can use the following command to install `xq`:\n```\ngo install github.com/sibprogrammer/xq@latest\n```\n\nYou can play with the `xq` utility using the Dockerized environment:\n\n```\ndocker compose run --rm xq\nxq /opt/examples/xml/unformatted.xml\n```\n","funding_links":[],"categories":["Data Manipulation","Go","cli","Command-Line Tools"],"sub_categories":["Processors","Libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsibprogrammer%2Fxq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsibprogrammer%2Fxq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsibprogrammer%2Fxq/lists"}