xmlmodule
work in progress
This JavaScript library provides a set of DOM assemblers for the following XML structures:
- The xml:base attribute
- The xml:id attribute
- The xml:lang attribute
- The xml:space attribute
- The Element DOM interface with predefined accessors for the xml:* attributes
- The XMLDocument DOM interface
- The ProcessingInstruction DOM interface
- The CDATASection DOM interface
- The xml-stylesheet processing instruction
- The xmlns attribute
Example
import {
XMLDocumentAssembler,
base, cdata, element, id, instruction,
lang, space, stylesheet, xmlns
} from 'xmlmodule'
new XMLDocumentAssembler([
stylesheet({ href : 'example.xsl' }),
element({
attributes : [
base('http://example.org/'),
id('example'),
lang('ru'),
space('preserve'),
xmlns('http://example.org/namespace')
],
childNodes : [
instruction('example'),
cdata('<<example>>')
]
})
])
This code produces an XML document with the following structure:
<?xml-stylesheet href="example.xsl"?>
<element xml:base="http://example.org/"
xml:id="example"
xml:lang="ru"
xml:space="preserve"
xmlns="http://example.org/namespace">
<?instruction example?>
<![CDATA[<<example>>]]>
</element>
Installation
npm install xmlmodule
Development
git clone git@github.com:aristov/xmlmodule.git
cd xmlmodule
npm install
npm run watch