Adobe InDesign CS5 is one of many applications that can produce and use XML. After you tag content in an InDesign file, you save and export the file as XML so that it can be repurposed in another InDesign file or another application. Similarly, you can import an XML file into InDesign and instruct InDesign to display and format the XML data any way you want.
XML (Extensible Markup Language) is a way to repurpose data in a file or automate the process of replacing the data in one file with data from another file. XML employs tags to describe parts of a file—a heading or a story, for example. These tags mark data so it can be stored in an XML file and handled appropriately when it is exported to other files. Think of XML as a translation mechanism for data. XML tags label text and other content in a file so that applications can recognize and present the data.
Gabriel Powell provides a video tutorial about using XML in InDesign at Creating a Basic XML-ready Template.
XML is considered an extensible language because individuals create their own XML tags—they can create one tag for each type of information that they want to repurpose. XML tags don’t carry information about how data is supposed to be displayed or formatted. XML tags are strictly for identifying content.
In InDesign, for example, you can create a Heading1 tag and assign it to each first-level heading in a document. After you save the document as an XML file, the Heading1 content can be imported and put to use—by any application that can read XML—as a web page, printed catalog, directory, price list, or database table.
InDesign is one of many applications that can produce and use XML. After you tag content in an InDesign file, you save and export the file as XML so that it can be repurposed in another InDesign file or another application. Similarly, you can import an XML file into InDesign and instruct InDesign to display and format the XML data any way you want.
Adobe InCopy is one of many applications that can produce and use XML. After you tag content in an InCopy file, you save and export the file as XML so that it can be repurposed in another InCopy file, InDesign file, or another application.
In InDesign, you can create XML tags and tag parts of a document even if you’re not experienced with XML. InDesign handles XML programming behind the scenes and creates the XML for you when you export a document in XML format.
Do not confuse XML tags with InDesign tagged text. For more information about tagged text, which is a different method of exporting and importing InDesign content, view the Tagged Text PDF at www.adobe.com/go/learn_id_taggedtext_cs5_en (PDF).
The element is the building block of XML data; an element is data that has been tagged. In XML files, elements are nested within other elements to create a hierarchical structure for the data.
You can see the structure of XML data in the Structure pane, which displays the hierarchy and sequence of elements. In the XML structure, child elements are contained by parent elements, which in turn may also be child elements. Or, seen from the other direction, parent elements contain child elements, and these child elements may in turn be parent elements to other child elements.
For example, in the following image, you can see a chapter element that contains (is the parent of) several recipe elements. Each recipe element, in turn, is the parent of elements called recipename, ingredients, instructions, notes, and servings. All elements are contained inside the Root element, which appears at the top of the Structure pane.
For example, in the following image, you can see a chapter element that contains (is the parent of) a recipe element. The recipe element, in turn, is the parent of elements called recipename and ingredients. All elements are contained inside the Story element, which always appears at the top of the Structure pane.
For more information on using XML in InDesign, visit www.adobe.com/go/learn_id_XMLscript.
InDesign provides the Structure pane and the Tags panel for working with XML content. The Structure pane displays all the elements in the document and their hierarchical structure. To help you identify each element, InDesign displays its element tag and an icon that indicates what type of content it holds. In addition, the Structure pane can display the first few words of text in an element, called a text snippet, which is not to be confused with snippet files that store objects for reuse.
A. Triangle to expand or collapse elements B. Element (placed in layout) C. Element (not in layout) D. Text snippet E. Element tag
A. Triangle to expand or collapse elements B. Element placed in layout C. Text snippet D. Element tag
The Structure pane lets you view, edit, and manage XML elements. You use the Structure pane in many ways when working with XML. For example, to place imported XML content into the layout, you can drag elements from the Structure pane directly to a page. You also use the Structure pane to adjust the hierarchy of the elements. You can add elements, attributes, comments, and processing instructions by way of the Structure pane.
The Tags panel lists tags for elements. You can import, export, add, delete, and rename tags. You use the Tags panel to apply element tags to content that you plan to export to XML, and to apply tags to frames before importing XML content into them.
The Tags panel lists tags for elements. You can import, export, add, delete, and rename tags. You use the Tags panel to apply element tags to content that you plan to export to XML.
About DTD files
To share XML data with others, you need to agree on a standard set of tag names and element attributes so that everyone in your group uses and applies tags the same way. One method for handling the sharing of XML data is to use a document type definition (DTD) file.
A DTD file provides a set of elements and attributes for members of the group to use. It also defines the rules about where elements can appear in the structural hierarchy. For example, the DTD file may require the Title element to be a child of the Story element because the title is supposed to appear inside the story; if you tag a title without tagging the story it appears in, the DTD file marks the Title element as invalid. You can search for and flag invalid structural errors in an InDesign file with a DTD file. This process is called validating.
To use a DTD file (if your document doesn’t already contain one), you load it into your document. This imports the element names from the DTD into the Tags panel. Others who have loaded the same DTD file have the same element names, which ensures that everyone in the group uses the same elements. The imported elements are locked, which means they can’t be deleted or renamed unless the DTD file is deleted from the document.
Although you cannot import a DTD file into InCopy, DTD files you import in InDesign are available when you edit the story in InCopy. You can view the DTD file in InCopy and validate stories against it to ensure that tags have been applied correctly.
You may find that a DTD file created by a group or industry similar to yours includes tags and structures that meet your needs. For a current list of registered DTDs, visit www.xml.com/pub/rg/DTD_Repositories (English only).
XML rule sets
For information on XML rule sets and other XML scripting resources, see www.adobe.com/go/learn_id_XMLscript.
Preparing XML files for K4 or InCopy workflows
To prepare files with XML tagging for use within the K4 or InDesign/InCopy workflow environments, you may need to adjust how you prepare the structure and import XML into InDesign files.
There are two methods for importing XML into InDesign: merge and append. Merge can replace the existing structure, whereas append adds to any existing structure. In both cases, it is important that the root element is not associated with a text frame. Either use the default element named "Root" or rename this element based on your current workflow or requirement as needed, again being sure that it is not associated with a text frame.
For more information on using XML in K4 or InCopy workflows, contact your system administrator.