My xml file
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>XpertDox Home Page</title>
<link>http://www.xpertdox.com</link>
<description>Find a doctor</description>
<item>
<title>Xpertdox</title>
<link>http://www.xpertdox.com/rss.xml</link>
<description>Find an Xpert Doctor for an unknown Disease</description>
</item>
I want to add this
<item>
<title>Tony</title>
<link>startk</link>
<description>hi</description>
</item>
my node.js
var obj = {title: "Tony", link: "Stark" , "description":"hi"};
var fs = require('fs');
var xml2js = require('xml2js');
var builder = new xml2js.Builder();
var xml = builder.buildObject(obj);
fs.writeFile('feed.xml', xml, function (err){
if (err) throw err;
console.log('It\'s saved!');
});
I want to replace my title tag and link as declared in my obj but this is not working.Can any one please change my code........
titleandlinkvalues in it, and write it back to the file?