@ayn/xmljs

1.0.9 • Public • Published

XMLjs

Build Status Build Status

XMLjs is a tiny beautiful XML markup generator.

API

const XML = require('@ayn/xmljs')

let doc = new XMLjs()
    .fruits(el=>{
        el.mango({ color: 'green'}, 'This mango is not ripe')
        el.bananas(el=>{
            el.babybanana('Quite small')
            el.plantain('Delicious')
        })
    })
    
console.log(doc.getMarkup())

Simple and elegant. Constructor takes a string as its argument that allows you to set the documents prolog.

Child elements return an object holding information on siblings and its parent, they also have access to the getMarkup() method which returns a subset of the markup.

Output

<fruits>
    <mango color="green">This mango is not ripe</mango>
    <bananas>
        <babybanana>Quite small</babybanana>
        <plantain>Delicious</plantain>
    </bananas>
</fruits>

License

MIT

/@ayn/xmljs/

    Package Sidebar

    Install

    npm i @ayn/xmljs

    Weekly Downloads

    2

    Version

    1.0.9

    License

    MIT

    Unpacked Size

    6.53 kB

    Total Files

    4

    Last publish

    Collaborators

    • ayn