Rename particular XML Tag


hi indesign experts,

          i'm confused lot in below issue. i'm have indesign document. in xml structure, if select element, , trying rename selected item's markuptag.name, it's changing elements selected elements name....

input.gif

i use below code run after selecting xml element.

 

app.selection[0].markuptag.name="test";

but output below.

output.gif

but want onlu rename selected xmlelement.

any idea perform this?

thanks , regards,

vel.


you're changing name of applied tag rather assigning different tag. try this:

 

var testtag = app.activedocument.xmltags.item("test").isvalid ? app.activedocument.xmltags.item("test") : app.activedocument.xmltags.add({name: "test"}); app.selection[0].markuptag = testtag; 

 

jeff



More discussions in InDesign Scripting


adobe

Comments