@lowlighter/xml 5.4.15 β†’ 5.4.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +43 -0
  2. package/deno.jsonc +1 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -6,6 +6,49 @@
6
6
  - [`πŸ¦• Playground`](https://libs.lecoq.io/xml)
7
7
  - [`πŸ“š Documentation`](https://jsr.io/@libs/xml/doc)
8
8
 
9
+ ## πŸ“‘ Examples
10
+
11
+ ### Parsing XML to objects
12
+
13
+ ```ts
14
+ import { parse } from "./parse.ts"
15
+
16
+ // Parse a string
17
+ console.log(parse(`
18
+ <?xml version="1.0"?>
19
+ <root>
20
+ <text>hello</text>
21
+ <array>world</array>
22
+ <array>monde</array>
23
+ <array>δΈ–η•Œ</array>
24
+ <array>🌏</array>
25
+ <complex attribute="value">content</complex>
26
+ </root>
27
+ `))
28
+
29
+ // Parse a file
30
+ using file = await Deno.open("bench/assets/small.xml")
31
+ console.log(parse(file))
32
+ ```
33
+
34
+ ### Stringifying objects to XML
35
+
36
+ ```ts
37
+ import { stringify } from "./stringify.ts"
38
+
39
+ console.log(stringify({
40
+ "@version": "1.0",
41
+ root: {
42
+ text: "hello",
43
+ array: ["world", "monde", "δΈ–η•Œ", "🌏"],
44
+ complex: {
45
+ "@attribute": "value",
46
+ "#text": "content",
47
+ },
48
+ },
49
+ }))
50
+ ```
51
+
9
52
  ## ✨ Features
10
53
 
11
54
  - Based on the [quick-xml](https://github.com/tafia/quick-xml) Rust package (compiled to WASM).
package/deno.jsonc CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "icon": "πŸ“ƒ",
3
3
  "name": "@libs/xml",
4
- "version": "5.4.15",
4
+ "version": "5.4.16",
5
5
  "description": "XML parser/stringifier with no dependencies.",
6
6
  "keywords": [
7
7
  "xml",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowlighter/xml",
3
- "version": "5.4.15",
3
+ "version": "5.4.16",
4
4
  "type": "module",
5
5
  "scripts": {},
6
6
  "dependencies": {},