Open jbpin opened 4 years ago
const {Builder} = require('xml2js');
const obj = {
data: "this is a raw string"
}
let result = new Builder({ cdata: true }).buildObject(obj);
With xml2js, you can use the attribute 'cdata' directly.
For more detail, take a look at this builder.coffee
file :)
https://github.com/Leonidas-from-XIV/node-xml2js/blob/8fc5b926846cd4ef9a2dbccd411705e0c110a708/src/builder.coffee#L47-L50
Hi,
I try to use a #raw key but I get an error
Here is a code to reproduce
Do you have any idea how I can use a raw string with xml2js? Apparently everything use txt. Do you intend to support xmlbuilder's decorators?