How can i find and replace xml tags?

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

Hi,
Script should do it in two steps:
1. find all occurences of i.e. ">DEFAULT<"
2. remove whole paragraph which is a found_text's container.
For example this way -JS - (a textFrame filled with your text should be selected) :
var mStory = app.selection[0].parentStory;
app.findTextPreferences =  null;
app.findTextPreferences.findWhat = ">DEFAULT<";
var myF = mStory.findText();
var count = myF.length;
while (count--)
     myF[count].paragraphs[0].remove();
rgds

Similar Messages

  • How can I find and replace multiple words at once?

    I need to be able to find and replace words into queens English. For example, I need to replace all instances of "color" with "colour," "tire" with "tyre" etc.
    I'm new to scripting, so simple answers would be appreciated :)

    Hi hobs707,
    Please use the below code for your required output:
    Replace ("color", "colour")
    Replace("tire", "tyre")           
    //Replace("hobs707", "hobs007")     just copy and paste and edit the contents as your wish
    function Replace(input, output)
    app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
    app.findTextPreferences.findWhat = input;
    app.changeTextPreferences.changeTo = output;
    app.activeDocument.changeText();
    If the above answer is correct please provide Correct Answers for me.
    Regards
    Beginner

  • My iPhoto library just reverted to an old library: How can I find, and re-access my current library?

    My iPhoto library just reverted to an old library: how can I find and re-access my current library?  I opened my iPhoto, and got the message that it needed to "update" to use this library.  I thought maybe there had been a software update since I last opened the program (2 days ago).  The library it opened was saved in a file on the desk-top.  My current file was just in iPhoto.  Please help!

    Best option: Restore from your back up.
    Otherwise:
    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD

  • How do I find and replace a word in PDF?

    How do I find and replace a word in PDF?

    In the Find window (Ctrl+F) there's an option to replace the searched text.
    This is in Acrobat XI, and there's no Replace All-function.
    On Thu, Jan 15, 2015 at 4:27 PM, claireb88184899 <[email protected]>

  • How can I find and eliminate duplicates in iTunes 11?

    I can't seem to find the "Find exact duplicates" item in the File Menu in version 11. How can I find and deal with duplicates?

    Shift-View-Show Exact Duplicates should reveal them. Keep one of each repeated group of files and don't send to the recycle bin unless you are sure that there are multiple files on the disc as opposed to multiple entries to the same file.
    There is also my DeDuper script if you don't want to do it by hand. This can preserve ratings, play counts, playlist membership, etc. which are lost in a manual clean up. Please take note of the warning to backup your library before deduping. See this thread for background on deduping and the script.
    tt2

  • How can I find and delete duplicate files in Mt Lion?

    As a competent, but self-trained mac user for 30 years, I'm totally baffled by the sudden appearance of multiple duplicate documents and .jpgs in my imac files. How can I find and delete them?

    Duplicate Annihalitor - http://brattoo.com/propaganda/ - or Decloner - http://www.pixelespressoapps.com/decloner/
    LN

  • How can I find and delete duplicate photos?

    How can I find and delete duplicate photos in iPhoto 2011?

    Duplicate Annihalitor - http://brattoo.com/propaganda/ - or Decloner - http://www.pixelespressoapps.com/decloner/
    LN

  • How can I find and get rid of key loggers on my iPhone and ipad

    How can I find and get rid of key loggers on my iPhone and ipad

    Why do you think you have them on there? Have you allowed someone to physically have each device and jailbreak it?

  • I must have many duplicates over 10,000 photos-impossible! How can I find and eliminate duplicates

    How can I find and eliminate duplicate photos? iPhoto says I have 10,000 or more images which cannot be!
    I assume as I imported them from various discs, cameras etc there overlap?
    Thank you

    Some apps for dealing with duplicates in iPhoto
    iPhoto Library Manager
    Duplicate Annihilator
    Decliner
    iPhoto Duplicate Cleaner

  • How can I find and remove duplicate photos from my computer?

    How can I find and remove duplicate photos from my computer?

    Terence,
    Yes, the duplicates appear in the iPhoto window. I have folders with same name occuring two or even three times sometimes with exactly the same set of photos (ie photos with the same ID) and sometimes with a limited set of photos. Other  folders appear only once.
    I normally take my MacBook with me if I'm shooting a lot of photos, such as on holiday, and then want to transfer them to my iMac when i get home. Other times I transfer the camera's memory stick directly to my iMac.
    I have great difficulty transferring the photos from my MacBook to my iMac. I don't want to store my photos on my iDisk due to the length of time it takes to upload them.
    Thanks again.
    Simon

  • How can I remove and replace a purchased app that is malfunctioning.

    How can I remove and replace a purchased app that is malfunctioning.?

    Delete the App and redownload it...
    Touch the app and hold your finger down until all the apps start to jiggle.
    You will see a circled "x" in the upper left corner.
    Tap it to delete an app. When done press the Home button.
    ( You cannot delete any pre-installed iOS app.)
    http://www.apple.com/support/ipad/applications/
    Download Past Purchases
    http://support.apple.com/kb/HT2519
    Log into iTunes using the account the Purchase was made with... Click on Buy... and a notice will come up saying you already have it... do you wish to download it again... Click Yes...

  • I can not find "app of the day" from app store on my ipod,how can i find and download it?

    i can not find "app of the day" from app store on my ipod,how can i find and download it?

    It is possible that the app was removed from the App Store. If so you will not be able to get it back, unless you have it downloaded on your computer.
    If you had downloaded it before and it is still in the store, you can go to the App Store app on your iPod and go to the Updates tab. Then you tap on "Purchased" and see if it is available to download from your previous purchases.
    Hope this helps!
    PSkilton

  • My question is how can i find and redownload all my older apps ?

    HI,
    I have an Iphone 4, and bought mostly all of my Apps from my Iphone.
    I needed a certain App called Viber and tried to download it.
    I didn't work and it told me to download it from my computer (Macbook pro) Itunes,
    which i did, then i synched (my error) my iphone to my mac, then it erased all my apps from my iphone.
    My question is how can i find and redownload all my older apps ?
    Do i have to go find them manually and download them again?

    I'm guessing on the computer you connected to you were not logged into our account in iTunes and/or you never transferred your apps from your iPhone to your computer.
    Yes, you will need to download all of them again manually.

  • How can one find and remove hidden tracking software on an iphone

    How can one find and remove hidden tracking software on an iphone

    When folks did not know that it was there, they assume that it is hidden. Even the EU and the US congress got all up in arms about it.

  • I installed the trial of Media Encoder CC but cannot find the imx30 preset. Where and how can i find and install this feature.

    I installed the trial of Media Encoder CC but cannot find the imx30 preset. Where and how can i find and install this feature.

    In the case of the trial mode, the license to MXF OP1a format as well as MPEG2 format are not activated if you install only Media Encoder only.  If this is the case, in order to activate those formats in the trial mode, please also install Premiere Pro, After Effects or Prelude and launch it at least once.  After this, re-launching Media Encoder should make MXF OP1a format available.

Maybe you are looking for

  • Is there a way to leave a group chat on Imessage?

    Don't get me wrong the group chat was a wonderful addition/feature to the Imessage app. After a while of being in the chat and the messages send back and forth no longer pertain you and you get 100+ messages and every second your phone is vibrating o

  • Ipod classic 160 TV out

    I find it annoying that we have to use a dock to get the TV out signal to work. I can no longer use my video player with an ipod dock on planes. Back to trying to watch on ipod screen. It is annoying that when apple improves a product, they sometimes

  • Vista ultimate and audigy se... help for dri

    ?I have Audigy LS (SE) and Windows Vista Ultimate 32-bit...[color="#ff0000" face="Verdana" size="3">?i use last drivers "Creative Sound Blaster Audigy Value/SE/LS and Sound Blaster Li've! 24-bit Windows Vista Driver .04.0065 (0.54 MB) "? but it alway

  • How to Change Source system type of ECC6.0 in BW system

    Hi BW Experter,    I connected ECC6.0 PRD system with BI7.0 PRD system  , the connection is successful, but the source system type of ECC6.0 PRD is not collect . The ECC6.0 PRD is as a BW system type in the source system list of bw system  .    I fou

  • Popup window height and width is not as expected

    Hi I am using this peace of code to create a popup. But this popup is not created with the specified height and width. It is created with a default size. Please tell me how to rectify the problem? data:     l_api_main            type ref to if_wd_vie