0.0.5 • Published 5 months ago
xmltool v0.0.5
xmltool
A XML parser for JavaScript
Installation
npm install xmltool
or
yarn add xmltool
Usage
import {Parser} from "xmltool";
const xml = `
<form xmlns="https://www.swchen.com/schema/form"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.swchen.com/schema/form form.xsd">
<section margin="10"
padding="5">
user: <input/>
password: <input type="password"/>
file: <input type="file"/>
</section>
</form>
`;
const doc = new Parser(xml).parse();
Option
new Parser(text, option)
option
- Object bag of settings.
Settings supported:
namespace
- Boolean. If true, then xml namespaces are supported. default value isfalse
.
Unsupported
- This parser doesn't parse document type declaration(DTD)'s intSubset, only set the
intSubset
text to document type nodeinternalSubset
property. - This parser doesn't normalize the attribute value. Attribute-Value Normalization
Reference
- XML 1.0
- Namespaces in XML 1.0
- System.Xml.Linq
- System.Xml
- sax-js A sax style parser for JS.
- pjxml Pure JavaScript XML parser.