Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/rammstein4o/xk6-xml
- Owner: rammstein4o
- License: mit
- Created: 2022-08-29T15:50:39.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-10T21:40:32.000Z (about 2 years ago)
- Last Synced: 2024-07-30T21:05:28.825Z (5 months ago)
- Topics: k6, k6-extension, xk6, xml
- Language: Go
- Homepage:
- Size: 35.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)
- GitThen:
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"]);
});
}
```