I want to read specific xml tag and update it.
here is the xml file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.ionicframework.myapp450442" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>myApp</name>
<description>
An Ionic Framework and Cordova project.
</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">
Ionic Framework Team
</author>
<content src="index.html"/>
<access origin="*"/>
<preference name="webviewbounce" value="false"/>
<preference name="UIWebViewBounce" value="false"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="android-minSdkVersion" value="16"/>
<preference name="BackupWebStorage" value="none"/>
<feature name="StatusBar">
<param name="ios-package" value="CDVStatusBar" onload="true"/>
</feature>
</widget>
I followed this similar question on stack over flow but it did n't work for me.
here is the code which i used
fs.readFile(configFile, 'utf-8',function(err, data) {
if (err) {
return console.log(err);
}
var name="<name>"+appName+"</name>";
var cursor = "//cursor";
var result = data.replace(/\/\/cursor/,name);
fs.writeFile(configFile, result, 'utf-8', function(err) {
if (err) return console.log(err);
});
fs.writeFile(appIconFile, icon, 'base64', function(err) {
if (err) return console.log(err);
});
});
Can somebody tell me what might be the issue here?
is there any better npm module ..?