3 Replies Latest reply on Sep 28, 2010 6:28 AM by das_kaese

    Search for, edit, and delete XML tag (Adobe InDesign Server CS5)

    das_kaese

      Hi all,

       

      I'm working with Indesign Server CS5 and JavaScript, though having some trouble coming up with a solution to a problem...

       

      I need to build a JS script (called through SOAP) that will enable me to search an InDesign file for a given XML tag.

       

      Upon finding the XML tag, if the 'action' variable is set to delete, it should delete the tag and its contents.

       

      If the action is set to edit, it should change the contents of the tag to some user-specified content.

       

      The primary caveat is that the XML tag is variable, as is the XML structure of the InDesign file.

       

      Here's what I have in mind, in pseudocode:

       

      function findXMLTag(tag, action) {

           app.searchForTag(tag);

           if (tagIsFound) {

                if (action == "delete") {

                     tag.delete;

                } else if (action == "edit") {

                     tag.contents = "Updated content";

                }

           }

      }

       

      Any help would be greatly appreciated!

       

      Thanks,

       

      Ben Kay