InDesign

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.

Important: 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.
  1. If you want to export only a portion of the document, select the element in the Structure pane where you want exporting to begin.
  2. Choose File > Export.
  3. For Save As Type (Windows) or Format (Mac OS), choose XML.
  4. Specify a name and location for the XML file, and then click Save.
  5. 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 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.

    Apply XSLT
    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.

  6. Choose an encoding type from the Encoding menu.
  7. To specify export options for images, click the Images tab, and then select one or more of the following:
    Original Images
    Places a copy of the original image files in an Images sub-folder.

    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.

  8. If you selected Optimized Original Images or Optimized Formatted Images in the previous step, choose options for the optimizing the images.
  9. Click Export.
Note: 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.