Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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 -p

value

```

## Contributing

Push your changes to a branch and open a pull request.