Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/rammstein4o/xk6-xml

A k6 extension for xml parsing.
https://github.com/rammstein4o/xk6-xml

k6 k6-extension xk6 xml

Last synced: about 2 months ago
JSON representation

A k6 extension for xml parsing.

Awesome Lists containing this project

README

        

# xk6-xml

This is a [k6](https://github.com/grafana/k6) extension using the
[xk6](https://github.com/grafana/xk6) system.

## Build

To build a `k6` binary with this plugin, first ensure you have the prerequisites:

- [Go toolchain](https://go101.org/article/go-toolchain.html)
- Git

Then:

1. Install `xk6`:
```shell
go install go.k6.io/xk6/cmd/xk6@latest
```

2. Build the binary:
```shell
xk6 build --with github.com/rammstein4o/xk6-xml
```

## Example

```javascript
// script.js
import xml from 'k6/x/xml';

export default function () {
const body = `



Gambardella, Matthew
XML Developer's Guide
Computer
44.95
2000-10-01





Ralls, Kim
Midnight Rain
Fantasy
5.95
2000-12-16





`

const result = xml.parse(body);

result["catalog"]["book"].forEach(book => {
console.log(book["-id"], book["title"]);
});
}
```