1.0.9 • Published 5 years ago

@ayn/xmljs v1.0.9

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

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

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago