Fork me on GitHub


InDesign, XML Import, and Whitespace

November 10, 2006 | Computers

This is as much a note to myself as it is an attempt to make this information easier to find by others.

Seemingly still undocumented in the InDesign Scripting Guide is a setting for controlling whitespace in imported XML files.

So, if you don’t want whitespace between XML elements honored on import while using a script run the import then set the preference for xmlImportPreferences ignoreWhitespace and set it to true. The syntax is slightly different whether you are using JavaScript, Applescript or (shudder) VBScript. Since I’m using Javascript to be cross platform compatible that’s the only one I’ve bothered to set up. So, if you’re interested, simply use this:

app.xmlImportPreferences.ignoreWhitespace = true;

When trying to find this information I had found several suggestions that were close but had wrong capitalization or other very slightly off spellings. This works.

So, hopefully this helps somebody.