2 Replies Latest reply on Feb 7, 2013 2:40 AM by vincent 1982

    Importing xml is not working

    vincent 1982

      Hello i am trying to import an xml file into a document but its not allowing the import.


      Let me clarify a bit, i have allready imported the same xml in about 50-60 different documents without any problems, but now i have a document that does not allow me to import the xml.

      After looking a bit deeper i found the following:


      Schermafbeelding 2013-02-06 om 09.44.02.png


      You can see that the parameter "Only import elements that match existing structure" is checked. When i uncheck this param, the xml is imported correctly.


      Now i tried to simulate is via scripting but with no success.

      Here's what i tried:


      InDesign.app.xmlImportPreferences.importToSelected = true;
      InDesign.app.xmlImportPreferences.importStyle = XMLImportStyles.MERGE_IMPORT;
      InDesign.app.xmlImportPreferences.ignoreUnmatchedIncoming = false;
        • 1. Re: Importing xml is not working
          R-Bala-Krishnan Level 2

          same snippet is working:



              ignoreWhitespace = true;

              createLinkToXML = false;

              ignoreUnmatchedIncoming = false;          

              importToSelected = false;

              importStyle = XMLImportStyles.MERGE_IMPORT;

              importTextIntoTables = false;                     



          • 2. Re: Importing xml is not working
            vincent 1982 Level 1

            And the document import xml settings are the same as in the screenshot? Also, you are using extendscript, my example is actionscript and i've noticed quite some differneces between the 2 in the past (although they use the same API).


            Edit: There is also the fact that i didnt test your code ( ignorent as i am) and didnt see that your example actually DOES work. Thank you very much for your help,


            On a sidenote: can you explain me why it works if you call:




            but not when you call:




            My thought was that when you call it on the document, then it's only for the current document, but when you call it on the application, then it is for all documents that get processed by that application.

            Is this wrong? Or is it the way it is meant to be?