@ai-sdk-tool/rxml 0.1.2 → 0.2.0
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 +1 -13
- package/dist/index.cjs +429 -1007
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -294
- package/dist/index.d.ts +9 -294
- package/dist/index.js +427 -968
- package/dist/index.js.map +1 -1
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @ai-sdk-tool/rxml
|
|
2
2
|
|
|
3
|
-
Robust XML parser/
|
|
3
|
+
Robust XML parser/builder for AI-generated and real-world XML. RXML focuses on resilience (lenient parsing when possible), JSON Schema–based coercion, and clean stringification.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -28,18 +28,6 @@ const out = parse("<title>Hello</title>", schema);
|
|
|
28
28
|
// => { title: "Hello" }
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
- Stream large XML
|
|
32
|
-
|
|
33
|
-
```ts
|
|
34
|
-
import { createReadStream } from "node:fs";
|
|
35
|
-
import { processXMLStream } from "@ai-sdk-tool/rxml";
|
|
36
|
-
|
|
37
|
-
const stream = createReadStream("./large.xml", "utf8");
|
|
38
|
-
for await (const node of processXMLStream(stream)) {
|
|
39
|
-
// node is an RXMLNode or a comment string
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
31
|
- Stringify objects to XML
|
|
44
32
|
|
|
45
33
|
```ts
|