Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

How to replace a text element of XML structure with an image.

$
0
0

I need to replace specific elements within my XML structure with an image and I'm having problems using the existing XML structure for this.

I was hoping for something as simple as myDoc.xmlElements[0].xmlElements[0].xmlElements[0].contents = new File("MyImgPath.ext");

 

I can use GREP to find the text of each item in my XML structure I wish to replace, remove the text and place the image and the result is what I want.  However, in the rare situation where the same text as the header, is in one of the paragraphs it too would be replaced with the image and we can't have that.

 

My XML structure is slightly more complicated but this example has the necessary elements:

> Root

     > Group

          > Header

          > Item


Viewing all articles
Browse latest Browse all 15932

Trending Articles