Deleting an XML object


hi all,

 

i've been having bit of trouble deleting xml objects extendscript's native delete() function. have xml object being passed function this:

 

makechanges(xmlobj, xmlobj.child1); makechanges(xmlobj, xmlobj.child2); makechanges(xmlobj, xmlobj.child3);  function makechanges(object, element) {      if (condition)           delete element; } 

 

however, child element not deleted, suspect because "element" variable reference still active. if code changed explicitly delete object so:

 

     if (condition)           delete object.child1 

 

then works fine, make quite few calls function , code re-usable if possible. know javascript has removechild() function xml, know if there's extendscript workaround? i've looked through documentation , haven't seen much, input appreciated.

hi carlm,

 

"delete" right way.

 

but maybe access structure of xml wrong.

 

just try little snippet:

it creates xml-structure, adds 2 items , deletes item-

 

 var gxml_root = new xml ( "<fmproperties> <item> </item><item></item></fmproperties>");   $.writeln(gxml_root);   // add items  gxml_root.fmproperties.item[0]= "item 1";  gxml_root.fmproperties.item[1]= "item 2";    $.writeln("-----------------");   $.writeln(gxml_root);   // delete item  delete gxml_root.fmproperties.item[1];    $.writeln(gxml_root); 


More discussions in FrameMaker Scripting


adobe

Comments

Popular posts from this blog

Soustraire une selection

After Effects: could not find dvaeve_dialogs.txt

Illustrator cs6 "Invalid Serial Number"