fs=require('fs'); _=require('lodash'); //extras=require("/home/users/schinthakayala/nodered/sheshi/dgxml/extras"); //puts=extras.puts; var path = require('path'); var appDir = path.dirname(require.main.filename); var dgjson = []; var level = 0; function getJSON() { var filename = process.argv[2]; console.log("reading json from flows file" + filename); //flowsJson=fs.readFileSync(appDir + "/flows_ss4nj01dev01.localdomain.json").toString(); flowsJson=fs.readFileSync(filename).toString(); // Let's make a backup while we're here... ts=Date.now().toString(); flows=JSON.parse(flowsJson); //console.log("returning flows"); return(flows); } function getStartTag(xmlStr){ var startTag= null ; if(xmlStr != null){ xmlStr = xmlStr.trim(); } try{ var regex = new RegExp("(<)([^ >]+)"); var match = regex.exec(xmlStr); if(match != null){ if(match[1] != undefined && match[2] != undefined){ startTag = match[2]; } } }catch(e){ console.log(e); } return startTag; } function getAttributeValue(xmlStr,attribute){ var attrVal=null; try{ var myRe = new RegExp(attribute + "=['\"](.*)['\"] ","m"); var myArray = myRe.exec(xmlStr); if(myArray != null && myArray[1] != null){ attrVal=myArray[1]; } }catch(err){ console.log(err); } return attrVal; } function processNodes(){ var nodes = getJSON(); //console.dir(nodes); nodes.forEach( function(node) { if( node.xml != null && node.xml.indexOf("", "m"); myArray = myRe.exec(node.xml); if(myArray != null && myArray[1] != null){ version=myArray[1]; //console.dir(myArray); } */ version=getAttributeValue(node.xml,"version"); node.type="service-logic"; //node.category="DGEmain"; node.module=module; node.version=version; if(module != null && version != null){ node.name=module+ "_" + version; } console.log("module=" + module); console.log("version=" + version); }else if( node.xml != null && node.xml.indexOf("