3 Replies Latest reply on May 11, 2010 6:44 AM by KeithGilbert

    [JS CS4] Bug in ExportFormat.XML?

    KeithGilbert Level 1

      I'm trying to export XML from InDesign layouts, doing the script equivalent of checking the "Remap Break, Whitespace, and Special Characters" option in the Export XML dialog box.


      I've found the "characterReferences" property of XMLExportPreference, which according to the OMV says that "If true, replaces special characters with character references". However, regardless of whether I set this to true or false, I get the same results.


      The only way I can seem get this to work is to do a "dummy" export to XML first, and check (or uncheck, depending on my needs) the "Remap Break, Whitespace, and Special Characters" option, and then run my XML Export script, which sorta defeats the purpose!


      Does anyone know if XMLExportPreference.characterReferences functions properly?



        • 1. Re: [JS CS4] Bug in ExportFormat.XML?
          Peter Kahrel Adobe Community Professional & MVP



          Try this: app.xmlExportPreferences.characterReferences = true;



          • 2. Re: [JS CS4] Bug in ExportFormat.XML?
            KeithGilbert Level 1

            Peter, thanks, but that's what I tried. Sorry, it wasn't clear from my first post. Here's my code:


            with (app.xmlExportPreferences) {

            allowTransform = false;

            characterReferences = false;

            copyFormattedImages = false;

            copyOptimizedImages = false;

            copyOriginalImages = false;

            excludeDtd = true;

            exportFromSelected = true; // Causes only the XML associated with the tagged frame to be exported

            exportUntaggedTablesFormat = XMLExportUntaggedTablesFormat.CALS;

            fileEncoding = XMLFileEncoding.UTF8;

            viewAfterExport = false;


            try {

            myADescriptionFrame[0].associatedXMLElement.exportFile(ExportFormat.XML, new File(myFolder+"/"+myAFilename),false);


            It appears that characterReferences just doesn't do anything.

            • 3. Re: [JS CS4] Bug in ExportFormat.XML?
              KeithGilbert Level 1

              I figured it out. Turns out that this isn't an application preference, but a document preference. So


              myDoc.xmlExportPreferences.characterReferences = true


              works great!


              Thanks again, Peter. Your reply got me thinking in the right direction!