0.2.0 • Published 4 years ago
modify-xml v0.2.0
modify-xml
An easy way to modify XML documents without changing the formatting of the original. This module is part of the atscm project.
This module is still under development, do not use it in production yet
Installation
As usual, run npm i modify-xml
.
Usage
import { promises } from 'fs';
import { parse, render } from 'modify-xml';
const xml = `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<script>
<metadata>
<parameter name="stringParam" type="string" trigger="false" relative="false" value="Sample string" />
<parameter name="numberParam" type="number" trigger="false" relative="false" value="0" />
</metadata>
<code><![CDATA[/*
* Yes, it supports cdata
*/]]></code>
</script>`;
// Parse the XML string
const document = parse(xml);
// Process the resulting document
// Render the document back to XML using two spaces as indent
const result = render(document, { indent: ' ' });
1.0.0-beta.0
4 years ago
0.2.0
5 years ago
0.1.0
5 years ago
0.1.0-beta.1
5 years ago
0.1.0-beta.0
5 years ago