Modules@robinpath/xml
@robinpath/xml
0.1.0PublicParse, build, query, and validate XML data
@robinpath/xml
Parse, build, query, and validate XML data
Why use this module?
The xml module lets you:
- Parse an XML string into a JavaScript object
- Convert a JavaScript object into an XML string
- Read an XML file from disk and parse it into a JavaScript object
- Convert a JavaScript object to XML and write it to a file
- Check whether an XML string is well-formed and valid
All functions are callable directly from RobinPath scripts with a simple, consistent API.
Installation
npm install @robinpath/xml
Quick Start
No credentials needed — start using it right away:
xml.stringify $data
Available Functions
| Function | Description |
|---|---|
xml.parse | Parse an XML string into a JavaScript object |
xml.stringify | Convert a JavaScript object into an XML string |
xml.parseFile | Read an XML file from disk and parse it into a JavaScript object |
xml.writeFile | Convert a JavaScript object to XML and write it to a file |
xml.isValid | Check whether an XML string is well-formed and valid |
xml.query | Parse XML and retrieve a value at a dot-separated path |
xml.toJSON | Parse an XML string and return its JSON string representation |
xml.fromJSON | Parse a JSON string and build an XML string from it |
xml.getAttribute | Retrieve an attribute value from an element at a given path |
xml.count | Count the number of elements at a given path in an XML string |
Examples
Convert a JavaScript object into an XML string
xml.stringify $data
Read an XML file from disk and parse it into a JavaScript object
xml.parseFile "/tmp/data.xml"
Convert a JavaScript object to XML and write it to a file
xml.writeFile "/tmp/output.xml" $data
Integration with RobinPath
import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/xml";
const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);
const result = await rp.executeScript(`
xml.stringify $data
`);
Full API Reference
See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.
Related Modules
@robinpath/json— JSON module for complementary functionality
License
MIT
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.0 | latest | yesterday |
Related Modules
utilities
1
@dev-tester/hello-world
v2.0.0dev-tester
Updated description
0 downloads
...
utilities
0
@robinpath/apollo
v0.1.1robinpath
Apollo module for RobinPath.
0 downloads
...
utilities
0
@robinpath/archive
v0.1.1robinpath
Create and extract .zip and .tar.gz file archives
0 downloads
...
utilities
0
@robinpath/assert
v0.1.1robinpath
Testing assertions: equal, deepEqual, truthy, falsy, type checks, includes, matches, throws, and more
0 downloads
...
Install
$ robinpath install @robinpath/xml Version0.1.0
LicenseMIT
Unpacked Size4.6 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

