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

how can i find and replace xml tags?

$
0
0

Hi, i am using xml in my workflow and want to be able to remove certain tags if they contain particular text.

 

here is an example of my xml structure…

 

<entry>

    <name>DEFAULT</name>

    <tel>DEFAULT</tel>

    <address>DEFAULT</address>

</entry>

 

I am using this initial structure to set the paragraph styles to be followed when the xml data is imported.

 

This leaves DEFAULT in place wherever an entry doesn't have any content for that field.

 

I want to be able to import my XML then run a script that removes any tags that include DEFAULT, - I need the entire xml tag to be removed not just the text, if i do a normal find and replace it will only remove the text not the tags which is causing problems with styling. I also want to remove the end of para/return (^p) that i've placed at the end of the line. So it would be the same as opening up story editor and removing the content + tags + hard return in there, but i want to automate the process…

 

So i think this is what i need to search for in each case

"<name>DEFAULT</name>^p"

 

and i want to replace it with nothing ""

 

Can this be done through scripting (ideally javascript)?

 

I have a little knowledge of javascript but am not sure how to search and target that kind of string in indesign...

 

using indesign cs5

 

many thanks


Viewing all articles
Browse latest Browse all 15932

Trending Articles



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