Export document content to XML
Before you export content from an InDesign document to XML, you must have done the following:
Created or loaded element tags.
Applied tags to items on the pages of your document.
Adjusted the hierarchy of tagged elements in the Structure pane, if needed.
You can export all or a portion of the XML content in your document. Only content that is tagged can be exported.
If you are exporting a document that contains tables, you must tag the tables or InDesign will not export them as part of the XML.
If you want to export only a portion of the document, select the element in the Structure pane where you want exporting to begin.
Choose File > Export.
For Save As Type (Windows) or Format (Mac OS), choose XML.
Specify a name and location for the XML file, and then click Save.
In the General tab of the Export XML dialog box, choose any of the following:
Include DTD Declaration
Exports the reference to the DTD along with the XML file. This option is only available if there is a DOCTYPE element in the Structure pane.
View XML Using
Opens the exported file in a browser, XML editing application, or text editor. Choose the browser or application from the list.
Export From Selected Element
Starts exporting from the element you selected in the Structure pane. This option is only available if you selected an element before choosing File > Export.
Export Untagged Tables As CALS XML
Exports untagged tables in CALS XML format. To be exported, the table must be in a tagged frame, and the table must not be tagged.
Remap Break, Whitespace, And Special Characters
Exports break, whitespace, and special characters as decimal character entities rather than straight characters.
Applies a stylesheet to define the transformation of the exported XML to, for example, a modified XML tree or HTML. Select Browse (Windows) or Choose (Mac OS) to select an XSLT from the file system. The default setting, Use Stylesheet From XML, uses an XSLT transformation instruction if one is referenced in the XML that is applied on export.
Choose an encoding type from the Encoding menu.
To specify export options for images, click the Images tab, and then select one or more of the following:
Places a copy of the original image files in an Images subfolder.
Optimized Original Images
Optimizes and compresses the original image files and places copies of the files in an Images sub-folder.
Optimized Formatted Images
Optimizes the original image files that contain applied transformation (such as rotation or scaling) and places them in an Images sub-folder. For example, if the document contains two images, one cropped and one not, only the cropped image is optimized and copied to the Images sub-folder.
If you selected Optimized Original Images or Optimized Formatted Images in the previous step, choose options for the optimizing the images.
Not all special characters are supported in XML (such as the Automatic Page Number character). InDesign warns you if it cannot include a character in the exported XML file. This warning also appears if you didn’t tag a table.
Optimized image export options
The following options are available when you choose Optimized Original Images or Optimized Formatted Images in the Images tab of the Export XML dialog box.
Specifies which file format to use for the converted image. If you choose Automatic, InDesign chooses the best file type based on the image. Hence, you may want to specify both GIF Options and JPEG Options.
Specify the formatting for images that are converted to GIF format when exported to XML. You can set the following options:
Specifies the color palette you want the image to conform to when converted. Choose the palette for the final display format of the XML content. Adaptive (no dither) works well for images with primarily solid colors and can be used when the final output will be to multiple formats.
Downloads every other line of the image with each pass, instead of downloading the entire image in one pass. Interlacing enables a preview of the image to download quickly, as each successive pass adds resolution until the final quality is met.
Specify the formatting for images that are converted to JPEG format when exported to XML. You can set the following options:
Specifies the quality of the converted image. The higher the quality setting, the larger the file size and the longer it takes to download.
Specifies how the JPEG image is formatted for download. Baseline downloads the final quality image in one pass, so that the file displays at its final quality as soon as it opens; this format may take longer to download than a Progressive formatted image. Progressive downloads the image in a series of passes, with the first pass a low-resolution version and each successive pass adding resolution to the image until the final quality is attained.
Save tags only as XML
Save tags only so you can load the tags into an InDesign document and make use of them there.
Choose Save Tags from the Tags panel menu.
Type a name, specify a location, and then click Save.
The tags in your document, along with their assigned colors, are saved in an XML file.
Edit an exported XML file
After you’ve used InDesign to create and export an XML file, you can make changes to the XML using either of these methods:
- To make changes directly in the XML file, open it in a text or XML editor.
- To make changes that will be preserved in the source document, open the InDesign file that the XML was exported from. After you make changes to the content in InDesign, you can export it to XML again, using the original XML filename if you want to replace the file.