Scripting XML Elements. Adobe CS5 InDesign
Annonce
Annonce
C
HAPTER
12: XML
Scripting XML Elements 178
Scripting XML Elements
This section shows how to set XML preferences and XML import preferences, import XML, create XML elements, and add XML attributes. The scripts in this section demonstrate techniques for working with the
XML content itself; for scripts that apply formatting to XML elements, see
.
Setting XML preferences
You can control the appearance of the InDesign structure panel using the XML view-preferences object, as shown in the following script fragment (from the XMLViewPreferences tutorial script): tell application "Adobe InDesign CS5" set myDocument to make document tell myDocument tell XML view preferences set show attributes to true set show structure to true set show tagged frames to true end tell end tell end tell set show tag markers to true set show text snippets to true
You also can specify XML tagging preset preferences (the default tag names and user-interface colors for tables and stories) using the XML preferences object., as shown in the following script fragment (from the
XMLPreferences tutorial script): tell application "Adobe InDesign CS5" set myDocument to make document tell myDocument tell XML preferences set default cell tag color to blue set default cell tag name to "cell" set default image tag color to brick red set default image tag name to "image" set default story tag color to charcoal set default story tag name to "text" set default table tag color to cute teal set default table tag name to "table" end tell end tell end tell
Setting XML import preferences
Before importing an XML file, you can set XML import preferences that can apply an XSLT transform, govern the way white space in the XML file is handled, or create repeating text elements. You do this using the XML import-preferences object, as shown in the following script fragment (from the
XMLImportPreferences tutorial script):
Download
Annonce