xml-tokenizer 0.0.2 → 0.0.3
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.
- package/README.md +12 -12
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<h1 align="center">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/builder-group/monorepo/develop/packages/
|
|
2
|
+
<img src="https://raw.githubusercontent.com/builder-group/monorepo/develop/packages/xml-tokenizer/.github/banner.svg" alt="xml-tokenizer banner">
|
|
3
3
|
</h1>
|
|
4
4
|
|
|
5
5
|
<p align="left">
|
|
6
6
|
<a href="https://github.com/builder-group/monorepo/blob/develop/LICENSE">
|
|
7
7
|
<img src="https://img.shields.io/github/license/builder-group/monorepo.svg?label=license&style=flat&colorA=293140&colorB=FDE200" alt="GitHub License"/>
|
|
8
8
|
</a>
|
|
9
|
-
<a href="https://www.npmjs.com/package/
|
|
10
|
-
<img src="https://img.shields.io/bundlephobia/minzip/
|
|
9
|
+
<a href="https://www.npmjs.com/package/xml-tokenizer">
|
|
10
|
+
<img src="https://img.shields.io/bundlephobia/minzip/xml-tokenizer.svg?label=minzipped%20size&style=flat&colorA=293140&colorB=FDE200" alt="NPM bundle minzipped size"/>
|
|
11
11
|
</a>
|
|
12
|
-
<a href="https://www.npmjs.com/package/
|
|
13
|
-
<img src="https://img.shields.io/npm/dt/
|
|
12
|
+
<a href="https://www.npmjs.com/package/xml-tokenizer">
|
|
13
|
+
<img src="https://img.shields.io/npm/dt/xml-tokenizer.svg?label=downloads&style=flat&colorA=293140&colorB=FDE200" alt="NPM total downloads"/>
|
|
14
14
|
</a>
|
|
15
15
|
<a href="https://discord.gg/w4xE3bSjhQ">
|
|
16
16
|
<img src="https://img.shields.io/discord/795291052897992724.svg?label=&logo=discord&logoColor=000000&color=293140&labelColor=FDE200" alt="Join Discord"/>
|
|
@@ -45,7 +45,7 @@ My goal was to develop an efficient & flexible alternative by porting [roxmltree
|
|
|
45
45
|
## 📖 Usage
|
|
46
46
|
|
|
47
47
|
```ts
|
|
48
|
-
import { xmlToObject, parseString } from '
|
|
48
|
+
import { xmlToObject, parseString } from 'xml-tokenizer';
|
|
49
49
|
|
|
50
50
|
// Parse XML to Javascript object (uses `parseString` under the hood)
|
|
51
51
|
const xmlObject = xmlToObject("<p>Hello World</p>");
|
|
@@ -84,15 +84,15 @@ The following token types are supported:
|
|
|
84
84
|
|
|
85
85
|
## 🚀 Benchmark
|
|
86
86
|
|
|
87
|
-
The performance of `
|
|
87
|
+
The performance of `xml-tokenizer` was benchmarked against other popular XML parsers. These tests focus on XML to object conversion and node counting. Interestingly, the version of `xml-tokenizer` imported directly from npm performed significantly better. The reason for this discrepancy is unclear, but the results seem accurate based on external testing.
|
|
88
88
|
|
|
89
89
|
### XML to Object Conversion
|
|
90
90
|
|
|
91
91
|
| Parser | Operations per Second (ops/sec) | Min Time (ms) | Max Time (ms) | Mean Time (ms) | Relative Margin of Error (rme) |
|
|
92
92
|
|---------------------|---------------------------------|---------------|---------------|----------------|--------------------------------|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
93
|
+
| xml-tokenizer | 46.87 | 19.47 | 24.57 | 21.33 | ±2.06% |
|
|
94
|
+
| xml-tokenizer (dist)| 53.70 | 17.31 | 25.20 | 18.62 | ±3.28% |
|
|
95
|
+
| xml-tokenizer (npm) | 163.00 | 5.03 | 8.50 | 6.13 | ±2.32% |
|
|
96
96
|
| fast-xml-parser | 66.00 | 14.01 | 20.73 | 15.15 | ±3.34% |
|
|
97
97
|
| txml | 234.52 | 3.38 | 7.61 | 4.26 | ±4.00% |
|
|
98
98
|
| xml2js | 36.21 | 25.58 | 37.28 | 27.61 | ±4.39% |
|
|
@@ -101,8 +101,8 @@ The performance of `roxmltree` was benchmarked against other popular XML parsers
|
|
|
101
101
|
|
|
102
102
|
| Parser | Operations per Second (ops/sec) | Min Time (ms) | Max Time (ms) | Mean Time (ms) | Relative Margin of Error (rme) |
|
|
103
103
|
|---------------------|---------------------------------|---------------|---------------|----------------|--------------------------------|
|
|
104
|
-
|
|
|
105
|
-
|
|
|
104
|
+
| xml-tokenizer | 53.03 | 18.30 | 19.45 | 18.86 | ±0.81% |
|
|
105
|
+
| xml-tokenizer (npm) | 166.61 | 5.62 | 7.16 | 6.00 | ±0.88% |
|
|
106
106
|
| saxen | 500.99 | 1.83 | 4.79 | 2.00 | ±1.52% |
|
|
107
107
|
| sax | 64.44 | 14.96 | 16.34 | 15.52 | ±0.67% |
|
|
108
108
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xml-tokenizer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Straightforward and typesafe XML tokenizer that streams tokens through a callback mechanism",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"@types/sax": "^1.2.7",
|
|
24
24
|
"@types/xml2js": "^0.4.14",
|
|
25
25
|
"fast-xml-parser": "^4.4.1",
|
|
26
|
-
"roxmltree": "^0.0.9",
|
|
27
26
|
"sax": "^1.4.1",
|
|
28
27
|
"saxen": "^10.0.0",
|
|
29
28
|
"txml": "^5.1.1",
|
|
29
|
+
"xml-tokenizer": "^0.0.2",
|
|
30
30
|
"xml2js": "^0.6.2",
|
|
31
31
|
"@blgc/config": "0.0.16"
|
|
32
32
|
},
|