Quantcast
Channel: Adobe Community : All Content - FrameMaker Scripting
Viewing all articles
Browse latest Browse all 888

Deleting an XML object

$
0
0

Hi all,

 

I've been having a bit of trouble deleting XML objects with ExtendScript's native delete() function. Basically I have an XML object being passed into a function like this:

 

makeChanges(XMLObj, XMLObj.child1);
makeChanges(XMLObj, XMLObj.child2);
makeChanges(XMLObj, XMLObj.child3);

function makeChanges(object, element)
{
     if (condition)          delete element;
}

 

However, the child element is not deleted, I suspect because the "element" variable reference is still active. If the code is changed to explicitly delete the object like so:

 

     if (condition)          delete object.child1

 

then everything works just fine, but I make quite a few calls to this function and would like the code to be re-usable if possible. I know JavaScript has a removeChild() function for XML, but does anyone know if there's an ExtendScript workaround? I've looked through the documentation and haven't seen much, so any input is greatly appreciated.


Viewing all articles
Browse latest Browse all 888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>