{"id":21766985,"url":"https://github.com/wvbe/xquery-cli","last_synced_at":"2025-10-23T23:40:37.373Z","repository":{"id":40671439,"uuid":"233005361","full_name":"wvbe/xquery-cli","owner":"wvbe","description":"A command-line tool for XQuery","archived":false,"fork":false,"pushed_at":"2023-01-08T16:46:55.000Z","size":1085,"stargazers_count":8,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-13T15:13:37.914Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/xquery-cli","language":"TypeScript","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/wvbe.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}},"created_at":"2020-01-10T08:50:52.000Z","updated_at":"2024-05-15T20:39:38.000Z","dependencies_parsed_at":"2023-02-08T06:45:21.410Z","dependency_job_id":null,"html_url":"https://github.com/wvbe/xquery-cli","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvbe%2Fxquery-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvbe%2Fxquery-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvbe%2Fxquery-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvbe%2Fxquery-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wvbe","download_url":"https://codeload.github.com/wvbe/xquery-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248732488,"owners_count":21152852,"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","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":[],"created_at":"2024-11-26T13:21:18.362Z","updated_at":"2025-10-23T23:40:37.246Z","avatar_url":"https://github.com/wvbe.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XQuery CLI\n\nThis lib lets you run XPath/XQuery or XQUF on XML files. Uses child processes to support traversing\nlarge amounts of content.\n\n### Install\n\n```sh\nnpm i xquery-cli -g\n```\n\nYou can now use the `xq` command.\n\nAlternative to installing `xq`, you can run `npx xquery-cli`\n\n### XPath and XQuery 3.1 Expressions\n\nXPath or XQuery expressions can be piped from another process, loaded from an `.xqm` file, or in the\n`--expression` (`-x`) option.\n\nThe following input is all equal:\n\n```sh\nxq --expression \"fn:current-date()\"\nxq -x \"fn:current-date()\"\nxq --module ./examples/simple-example.xqm\n```\n\nOr you pipe it in:\n\n```sh\necho \"fn:current-date()\" | xq\ncat ./examples/simple-example.xqm | xq\ncurl -s https://pastebin.com/raw/53pFDEbk | xq\n```\n\n### XML files\n\nAny argument that is an option counts as an XML file location for which the expression is evaluated.\n\n```sh\nxq ./foo.xml -x \"()\"\nxq ./foo.xml ./bar.xml -x \"()\"\nxq ./foo.xml -x \"()\" ./bar.xml\nxq ./*.xml -x \"()\"\n```\n\nFor terminals that don't expand file patterns, or to circumvent a \"Too many arguments in command\nline\" error, use `--glob` (`-g`):\n\n```sh\nxq --glob \"./examples/**/*.xml\" -x \"()\"\nxq -g \"./examples/**/*.xml\" -x \"()\"\n```\n\nIf you want to use both pattern expansion and the `--glob` flag you are a mad lad. It would be\nuseful to know that you may get duplicate results, and results may be ordered differently.\n\n### Updating XML\n\n[fontoxpath](https://www.npmjs.com/package/fontoxpath) supports XQuery Update Facility, therefore\n`xq` does too. Simply make your expression updating to use it, and `xq` will update the affected\nfiles in place -- It's recommended that you do this in version controlled content only. Optionally\ncombine with the `--dry` option to not _actually_ make file changes just yet.\n\n```sh\nxq ./foo.xml -x \"replace node /* with \u003cbar /\u003e\"\n```\n\n### Variables\n\nWhen running a query on files you are provisioned with the `$document-uri` variable. It is set to\nthe name of the file that that query is evaluated on at the time.\n\n```sh\nxq ./foo.xml -x \"\\$document-uri\"\n```\n\nOn Windows you might _not_ have to escape the `$`.\n\n### Reporting\n\nBy default XQuery returns are logged to STDOUT, and event data is logged to STDERR. Use\n`--no-stdout` (`-o`) or `--no-stderr` (`-O`) if you want.\n\n```sh\nxq -x \"fontoxpath:version()\" --no-stderr\n```\n\nYou can also control the amount of messages, by picking to limit yourself to ` rawOutput``verbose `,\n`info`, or `error` and everything \"above\" it like so:\n\n```sh\nxq -x \"fontoxpath:version()\" --log-level verbose\n```\n\n## Acknowledgements\n\nThis tool relies on the excellent [fontoxpath](https://www.npmjs.com/package/fontoxpath),\n[slimdom](https://www.npmjs.com/package/slimdom) and [saxes](https://www.npmjs.com/package/saxes).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwvbe%2Fxquery-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwvbe%2Fxquery-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwvbe%2Fxquery-cli/lists"}