oozcitak / xmlbuilder-js

An XML builder for node.js
MIT License
918 stars 107 forks source link

Feature Query(Not a issue): Possibility of adding comment from object #218

Closed arunsraga closed 5 years ago

arunsraga commented 5 years ago

Hi,

This is not a issue. Query related to use case. Is there any way to add comments using obj instead of root.com('f(x) = x^2');

For ex: let obj = { "@sequence": "1", "@id":"123", "step": [{ "id":1, "name":"step1", "comment":"comment1" }, { "id":2, "name":"step2", "comment2": "comment2" }] }

let xml = builder.create(obj).end({ pretty: true});

In above ex i want to add a dynamic comment text in step array.

Is it possible achieve this.

oozcitak commented 5 years ago

Yes. Please see: https://github.com/oozcitak/xmlbuilder-js/wiki/Conversion-From-Object#comment-decorator

arunsraga commented 5 years ago

Thank You @Ozgur Ozcitak. It's working.