Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gkawamoto/xmlq
XPath your way into XML files
https://github.com/gkawamoto/xmlq
Last synced: about 2 months ago
JSON representation
XPath your way into XML files
- Host: GitHub
- URL: https://github.com/gkawamoto/xmlq
- Owner: gkawamoto
- Created: 2023-08-18T22:03:12.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-21T17:47:38.000Z (over 1 year ago)
- Last Synced: 2023-09-05T04:19:48.002Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# xmlq
`xmlq` is a tool to query a XML document using [XPath](https://www.w3schools.com/xml/xpath_intro.asp). It is written in Go and uses [github.com/antchfx/xmlquery](github.com/antchfx/xmlquery) to parse the XML and query it using XPath.
For information on XPath support, see the documentation of the underlying [github.com/antchfx/xpath lib](https://pkg.go.dev/github.com/antchfx/xpath).
## Installation
```bash
$ go install github.com/gkawamoto/xmlq@main
```## Usage
```bash
$ xmlq -h
Usage of xmlq:
-p pretty print
-t inner text
```## Examples
### Fetching a value from a path
```bash
$ echo "value" | xmlq -t '/payload/key'
value
```### Formatting a XML
```bash
$ echo "value" | xmlq -pvalue
```
## Contributing
Push your changes to a branch and open a pull request.