Add nodes to XML


my script asks different types of input user , want store info in settings xml file. way dialogs can fall on entered data.

i found out how read xml file , search specific values (xpath), want add new "settings" file. there easy way indesign javascript? code in bold pseudocode want replace real code.

 

 

    var settingsfile = new file(ksettingsfilename);

    if (settingsfile.open("r")) {

        var settingsxml = new xml(settingsfile.read());

        settingsfile.close();

        var currentsettingelement = settingsxml.xpath (settingname);


        if currentsettingelement not exist

            create element , set value

        else

            currentsettingelement.setchildren(settingvalue);

the xml commands in scripting reference include "insertchildafter", "insertchildbefore", "appendchild", "prependchild", , "setchildren". @ least 1 of these ought

 

but it's kind of hard find out how supposed use commands. wasn't there specific xml guide somewhere in scripting resources section of adobe's indesign site?



More discussions in InDesign Scripting


adobe

Comments

Popular posts from this blog

Hur installera Joomla på One.com - Joomla! Forum - community, help and support

removing index.php from URL address - Joomla! Forum - community, help and support

「イメージマップのアンカー名には、...」のエラーが出ないようにしたい