Reply To: Script to search for an XML tag and remove it

#94317
Anonymous
Inactive

<pre class=”brush: javascript”>
var main = function() {
var doc = app.properties.activeDocument,
root, xes, n;
if ( !doc ) return;
root = doc.xmlElements[0];
xes = root.evaluateXPathExpression ( “.//myTagName” );
n = xes.length;

while ( n– ) xes[n].remove();

}

var u;

app.doScript ( “main()”,u,u,UndoModes.ENTIRE_SCRIPT, “The Script” );

Where “myTagName” is the name of the tag you want to remove. Be aware that with tagged texts, only the text object will ne removed while the container will remain.

HTH

Loic

This article was last modified on May 8, 2017

Comments (0)

Loading comments...