This content has been marked as final.
Show 4 replies
-
1. Re: renaming XML tags via Javascript
Shonkyin Sep 3, 2010 9:20 AM (in response to mattaca)Yes you are right Matt, its very easy.
var myDoc = app.activeDocument; var myTag = myDoc.xmlTags.itemByName("Old"); myTag.name = "New";Shonky
-
-
3. Re: renaming XML tags via Javascript
Shonkyin Sep 3, 2010 9:40 AM (in response to Shonkyin)Or
You can use this function for multiple rename tag
var myDoc = app.activeDocument; RenamXMLTag("Old", "New"); RenamXMLTag("Old", "New"); function RenamXMLTag(Old, New) { if(myDoc.xmlTags.itemByName(Old).isValid) { myDoc.xmlTags.itemByName(Old).name = New; } }Shonky
-
4. Re: renaming XML tags via Javascript
mattaca Sep 3, 2010 10:30 AM (in response to Shonkyin)Thanks! It looks like in that second version it also accomodates situations where the tag name doesn't exist—right? Is that what the "if" is for? Why is it "ReNam" and not "ReName"? Could you use this for paragraph styles too by changing "XMLTag" to "ParagraphStyle"? It seems there is always more than one way to do things in Javascript...
Thanks again. You have been so helpful today!

