How to insert strings into a xml file by action language?

(imported topic written by icet91)

I want to insert some string into xml file,but I don’t have the method.

xml file content is :

<?xml version="1.0" encoding="UTF-8"?>

I want to insert a property string “level” ,like below:

<?xml version="1.0" encoding="UTF-8"?>

thanks!

(imported comment written by gjeremia91)

I would suggest that you use vbscript or even javascript for that.

delete __appendfile

appendfile var doc = new ActiveXObject(“Microsoft.XMLDOM”);

appendfile doc.async=false;

appendfile doc.load(“myxmlfile.xml”);

appendfile WScript.Echo(“Before:\n” + doc.xml);

appendfile //appendfile var node = doc.selectSingleNode("/path/to/node");

appendfile var node = doc.selectSingleNode("/property");

appendfile node.setAttribute(“level”, “xxxx”);

appendfile // now either save the whole doc, or use it’s XML as doc.xml

appendfile WScript.Echo(“After:\n” + doc.xml);

move __appendfile test.js

wait cmd.exe /c “{pathname of system folder}\wscript.exe” “{pathname of client folder of site “actionsite”}\test.js”