Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/edjcase/motoko_xml
XML encoding/decoding library in motoko
https://github.com/edjcase/motoko_xml
Last synced: about 1 month ago
JSON representation
XML encoding/decoding library in motoko
- Host: GitHub
- URL: https://github.com/edjcase/motoko_xml
- Owner: edjCase
- License: mit
- Created: 2023-01-10T04:10:12.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-30T23:30:08.000Z (6 months ago)
- Last Synced: 2024-08-03T00:14:19.277Z (5 months ago)
- Language: Motoko
- Size: 263 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-motoko - motoko_xml - XML encoding/decoding library (Libraries / Encoding)
README
# Funding
This library was originally incentivized by ICDevs. You can view more about the bounty on the forum or website. The bounty was funded by The ICDevs.org commuity and the award paid to @Gekctek. If you use this library and gain value from it, please consider a donation to ICDevs.
# Overview
This is a library that handles XML serialization and deserialization with UTF8 bytes and text
# Package installation
## MOPS
### CLI
Run `mops install xml`
### Or manually:
Modify the `mops.toml` file to add:
```
[dependencies]
xml = "{version}"
```where `{version}` is the version number you want to use
See detailed MOPS documentation [here](https://mops.one/docs/install)
# Usage
```motoko
import Element "mo:xml/Element"
import Xml "mo:xml/Xml"
...let element : Element.Element = {
name = "root";
attributes = [{ name = "attr1"; value=?"value1" }];
children = #open([
{
name = "br";
attributes = [];
children = #selfClosing;
}
])
}
let serializedXml : Text = Xml.serialize(element); //let xmlObj : Element.Element = Xml.deserialize("
".chars())
```# First time setup
To build the library, the `MOPS` library must be installed. It is used to pull down packages and running tests.
MOPS install instructions: https://mops.one/docs/install
# Testing
To run tests, use the `make test` command or run manually with `mops test`.
The tests use MOPS test framework