1 Reply Latest reply on Jun 27, 2012 2:19 PM by [Jongware]

    Bulk export XML Script Empty <root> XML

    i_bullock Level 1

      I'm trying to bulk export a bunch of .indd files in a folder to XML. So far the XML results don't have any of the text content of the indesign files.

       

      The files don't have any tagging done to them, so I'm not sure it is even really possible, but the script below is what I've been trying so far:

       

       

       

      try {

           inFolderName= Folder.selectDialog ("Input Folder:");

           outFolderName= Folder.selectDialog ("Output Folder:");

           if ((inFolderName != null) && (outFolderName != null))

           {

                var idFileFolder = new Folder(inFolderName);

                var files = idFileFolder.getFiles("*.indd");

                for(myCounter = 0; myCounter < files.length; myCounter++)

                {

                     var theDocument = app.open(File(files[myCounter]));

                     with ( theDocument ) {

                     myXMLFile = new File(outFolderName + "/" + name.replace(".indd","") + ".xml" );

                     exportFile( ExportFormat.xml, myXMLFile );

                     close(SaveOptions.no);

                     }

                }

           }

      }

      catch (err ) {

      }

      alert("All files export");

       

       

       

      Thanks in advance to anyone that offers some help!

        • 1. Re: Bulk export XML Script Empty <root> XML
          [Jongware] Most Valuable Participant

          i_bullock wrote:

           

          ... So far the XML results don't have any of the text content of the indesign files.

           

          The files don't have any tagging done to them ...

           

          There is your answer. InDesign's XML Export only exports the XML for tagged items.

           

          Perhaps you could export to Tagged Text instead; or, if you need even more control, to IDML (and then unpack it and fish out the relevant Story files).