+11
-3
README.md
+11
-3
README.md
···
7
7
gleam add xmleam
8
8
```
9
9
```gleam
10
-
import xmleam
10
+
import gleam/io
11
+
import gleam/result
12
+
import xmleam/builder.{Opt}
11
13
12
14
pub fn main() {
13
-
// TODO: An example of the project in use
15
+
let document = {
16
+
builder.opts_cont_tag(
17
+
"?xml",
18
+
[Opt("version", "1.0"), Opt("encoding", "UTF-8")],
19
+
{ result.unwrap(builder.basic_tag("hello", "world"), "Encoding Error") },
20
+
)
21
+
}
22
+
io.debug(document)
14
23
}
15
24
```
16
25
···
21
30
```sh
22
31
gleam run # Run the project
23
32
gleam test # Run the tests
24
-
gleam shell # Run an Erlang shell
25
33
```
+8
-8
src/xmleam.gleam
+8
-8
src/xmleam.gleam
···
1
1
import gleam/io
2
-
import xmleam/builder
2
+
import gleam/result
3
+
import xmleam/builder.{Opt}
3
4
4
5
pub fn main() {
5
-
let tag = builder.basic_tag("pubDate", "Tue Mar 12")
6
-
let complex_tag =
6
+
let document = {
7
7
builder.opts_cont_tag(
8
-
"enclosure",
9
-
[builder.Opt("url", "https://example.com")],
10
-
"hello",
8
+
"?xml",
9
+
[Opt("version", "1.0"), Opt("encoding", "UTF-8")],
10
+
{ result.unwrap(builder.basic_tag("hello", "world"), "Encoding Error") },
11
11
)
12
-
io.debug(complex_tag)
13
-
io.debug(tag)
12
+
}
13
+
io.debug(document)
14
14
}