In this chapter we take you on a whirlwind tour of InDesign’s XML features, menus, panels, and commands. Having all this information in one place is handy for you any time you need to jog your memory concerning any of these items. It also reduces the need for repetitive instructions throughout the book. Remember, this is just a surface look at these features; we cover them all in depth in later chapters.
InDesign has a clean, straightforward implementation of XML that encompasses several aspects of the interface from the Layout view and Structure pane, to the Story Editor and InCopy. Believe it or not, the program has provided some support for XML all the way back to version 2—but it’s so well hidden that you may never stumble across the features unless you’re specifically looking for them. Let’s take a closer look.
We’re going to start off where most designers work, in Layout view. We check out the XML features in the Story Editor and InCopy later in this chapter.
InDesign’s XML import interface is your first stop in an XML workflow, but before anything can be imported you have to have an open document. Download the sample files for Chapter 2 from the book’s support site: www.peachpit.com/indesignxmlguide/. Open the file xml_interface_1.indt (Figure 2.1).
Figures 2.2 and 2.3 show how to import XML.
The XML Import Options dialog (Figure 2.4) is responsible for most of the XML magic. Take a minute to familiarize yourself with the possible settings (Table 2.1). We demonstrate what they do in detail in upcoming chapters.
Table 2.1. XML Import Options
Option | Description |
---|---|
Merge Content | Replaces all existing XML content in your layout. |
Append Content | Inserts (adds) imported XML content into the existing file. |
Create Link | Creates a live link to the XML file stored on your hard drive. When the XML is changed, the Links panel indicates the file is out of date. |
Apply XSLT | Uses an XSLT to manipulate the XML during import (InDesign CS3 only). XSLTs can be used to sort or filter the XML, or completely transform it into another data structure. |
Clone repeating text elements | Automatically replicates tagged and untagged text and inline objects within your workflow. Use this option to create repetitive layouts, such as phone directories, price lists, business cards, catalogs, and so on. |
Only import elements that match existing structure | Filters incoming XML elements against the existing document structure, preventing elements not already represented in the structure from entering the layout. |
Import text elements into tables if tags match | Filters incoming XML elements against the existing structure of a table, placing them into table cells that are similarly tagged. |
Do not import contents of whitespace-only elements | Causes InDesign to ignore white space (extra spaces, hard returns, and so on) stored within the XML file between the tagged elements. Instead, InDesign uses the spacing and alignments as depicted in your structured layout. |
Delete elements, frames, and content that do not match imported XML | Deletes tagged page elements when the imported XML does not contain a similarly tagged item. This option prevents the inclusion of empty text and picture frames in your final layout. |
Import CALS tables as InDesign tables (InDesign CS3 only) | CALS stands for Continuous Acquisition and Lifecycle Support, an initiative by the Department of Defense for the specification of standards for electronic documents. Technically speaking, XML can’t create objects, like tables. The CALS specifications were created so that the inclusion of tabular information could be compatible with the data-centric nature of XML. Choose this option to convert CALS-based tables into InDesign-supported tables. |
For the purposes of this lesson, leave all checkboxes unchecked and click OK.
When an XML file is imported into InDesign it does not automatically appear in your layout the way regular text and graphics do. Instead, InDesign loads it into an interface called the Structure pane and then populates the Tags panel with the names of the available elements.
The key word here is structure. Mention the word “structure” in a crowded room and you can instantly tell who works with XML because their eyes light up. Structure is at the heart of the technology. XML is all about how the pieces are put together. The Structure pane and the Tags panel work hand in hand to reveal the how. The Structure pane gives you the big picture—the view from 20,000 feet. The Tags panel brings you up close and personal.
Can we use any more clichés? Okay, two more: The Structure pane is the yin balancing the Tags panel’s yang. They are the one-two punch of InDesign’s XML interface. Let’s take a closer look at each one.
Although it’s pretty well hidden, we’ve heard many humorous tales from perplexed designers who revealed the Structure pane accidentally and thought that they had broken the program.
The Structure pane (Figure 2.5) is available only in Layout view. There are four ways to reveal (on purpose) the Structure pane. You can:
Select View > Structure > Show Structure.
Click anywhere on the left border of the Layout view window.
Click the Show Structure button at the lower-left edge of the Layout view window.
Press Option-Cmd-1 (Ctrl-Alt-1).
When the XML content first appears in the Structure pane, it’s hard to make heads or tails of the icon display. So InDesign provides snippets of text to help you identify the contents of each element.
Figure 2.6 shows you how to turn on Text Snippets.
By default, the XML structure schematic starts off fully closed. It may be empty or contain one or multiple elements, attributes, and/or comments. To reveal, or expand, the structure, click on the triangle in front of each element, as shown in Figures 2.7 through 2.9. To expand an entire parent element at once, see Figure 2.10.
To collapse the structure, click on each open triangle until the elements are all closed, or to close the entire structure at once, see Figure 2.11.
The Structure pane provides a graphical overview of your XML structure that displays all elements, attributes, comments and processing instructions contained within the XML (Figure 2.12).
Within the Structure pane you may see as many as 17 different icons. Table 2.2 helps you familiarize yourself with their names and descriptions.
Table 2.2. Structure Pane Icons
Name | Description | |
---|---|---|
Closed triangle or “twirlie” | Represents a closed element that contains one, or more, child element(s) or attribute(s). Click the triangle to open, or expand, the element and reveal its contents. | |
Open triangle or “twirlie” | Represents an open element. Click the triangle to close, or collapse, the element to hide its contents. | |
Attribute | Represents an XML attribute or other metadata. Attributes do not appear in the layout, nor do they print, but they may be accessed by an XML application. | |
Comment | Represents a comment. Comments are non-printing notes stored within the XML. Comments are imported with the XML content and can be added and edited within InDesign. All comments visible within the Structure pane are included whenever XML is exported from InDesign. | |
DOCTYPE element | Indicates that a DTD has been loaded. | |
Empty element | Represents a graphic or unassigned frame that is empty. | |
Graphic element | Represents a tagged frame that contains a graphic. Graphic elements automatically include an | |
Graphic element–unplaced | Represents an XML reference to an image that has not been placed within the document. | |
Processing instruction | Represents an instruction that will trigger an action in applications that can read such instructions, such as an XML parser. | |
Root element | The first XML element that automatically contains all other elements. All XML files will have one root element. Note: Although | |
Story element | Represents a story in a single frame or several linked frames. One such icon is displayed on the parent element of each story flow. | |
Table element | Represents a tagged table. | |
Table–body cell element | Represents a tagged cell within the body of a table. | |
Table–footer cell element | Represents a tagged cell in the footer row of a table. | |
Table–header cell element | Represents a tagged cell in the header row of a table. | |
Text element | Represents tagged text within a frame. | |
Text element–unplaced | Unplaced text element not yet associated with a page item. |
We said earlier that the XML content is actually stored within the Structure pane. You can place text and graphics stored in the Structure pane by dragging the elements to your layout.
Figure 2.13 shows how to place a graphic element from the Structure pane.
Figure 2.14 shows how to place a text element from the Structure pane.
The Tags panel has second billing in your XML extravaganza, just under the Structure pane. Tags are used to identify every XML element in a structured layout. They can be applied to frames—both graphic and text—paragraphs, sentences, words, and even down to individual characters. Tags can also be empty or wrapped around other elements, as when a child element is nested within a parent element (described in Chapter 1).
Open xml_interface2.indt from the Chapter 2 folder (Figure 2.15).
Figure 2.15. This file features a fully structured layout, can you tell? If your XML interface is turned off, it will look like any other InDesign document—a page with a graphic and a bunch of text. Don’t let that fool you. A structured InDesign document is just like the ocean: Most of the action is happening under the surface.
Let’s dive in and see what you’ve been missing. Figure 2.16 shows how to open the Tags panel, and Figure 2.17 shows the Tags panel.
Figure 2.18 shows how to expose the remaining parts of InDesign’s XML interface, and Figure 2.19 displays how the InDesign layout should look when the XML structure is all turned on. The tag markers appear as colored brackets at the beginning and end of each element. Tagged frames appear as if they are filled with the tag color. All this color is intended as a visual cue to help identify the XML elements. Don’t worry, the brackets and colored frames do not print or appear in exported files, such as JPEGs or PDFs.
Use the Tags panel to identify currently tagged elements (see Figures 2.20 through 2.23)
Figures 2.24 and 2.25 show you how to create a tag.
Figure 2.25. Type Portrait in the New Tag dialog. The tag name typed here must match the element name from the XML file exactly, as we explain in Chapter 1. Click OK.
Whoops! We just made a mistake. Notice how all the other XML tags in the panel shown in Figure 2.25 are typed in lowercase? You should open the actual XML file to be certain, but assume for this exercise that Portrait
should be lowercase, too. Let’s edit the tag we just created to conform with all the other element names (Figures 2.26 and 2.27).
Tag names are added to the panel automatically whenever you import an XML file. But this method imports the XML data contained in the file as well. If there is no need for the data, InDesign provides a method for importing only the tag names from XML files and even from other InDesign or InCopy documents (Figures 2.28 through 2.30).
You can delete tags at any time within your document, whether they are used or unused. Figure 2.31 illustrates how to delete unused tags.
Deleting a tag that is currently assigned to one or more elements within your document could damage your XML structure, so InDesign adds an extra step to the process to prevent any trouble (Figure 2.32).
After editing, renaming, and deleting tags, you may want to share your new list of tags with coworkers or use them in other workflows. InDesign provides an easy way to save the tag list to a separate file (Figure 2.33).
Tags can be applied to both text and graphics. Open xml_interface_3.indt. Figure 2.34 shows how to apply a tag to text.
To apply tags to graphics, follow Figure 2.35.
Figure 2.36 shows how to change tag assignments.
At some point in your workflow, the XML tags and structure may no longer be needed. While tags can sit in graphic or text frames for years without causing you a whit of trouble, InDesign provides an easy way to remove all traces of the XML structure. Figures 2.37 through 2.40 show you how to untag graphics, text, an entire text frame, and everything on a spread, in that order.
So far you’ve learned how to access and use both the Structure pane and the Tags panel. You’ve seen how the Tags panel works like a grocery list, showing you all the essential parts of your XML workflow. You’ve seen how the Structure pane works like an X-ray device, revealing how the elements are put together. Although they serve completely different purposes, their features overlap in some important and helpful ways.
Open xml_interface_4.indd from the Chapter 2 folder (Figure 2.41).
In Figure 2.42, we matched up the XML content to its display in the Structure pane. Even if you knew nothing about XML it’s easy to see the similarities. Can you see how each line in the Structure pane relates directly to the structure of the XML file? Can you figure out the element names? Can you identify the attributes?
Click the first artist
icon in the Structure pane (Figure 2.43). See the tag name highlight in the Tags panel. Also notice that the icon for this element indicates that it has been placed in the layout. Because the icon and the actual content on the page are the same thing, you can use the Structure pane to identify these elements in the layout. Double-click the first artist
icon in the Structure pane (Figure 2.44).
To identify XML graphic elements in your layout using the Structure pane, double-click on the first portrait
element in the Structure pane (Figure 2.45).
Observe the other child elements within the first artist
element. You can use the Structure pane to select them individually, too. Figure 2.46 shows how to select a single element using the Structure pane. See how each icon relates to the placed content in the layout? This connection between the Structure pane and the layout will come in very handy in our upcoming lessons as well as in your own XML workflow.
An important aspect of the relationship between the Structure pane and the layout is that it is a two-way street. Just as you used the Structure pane to identify elements in the layout, you can use layout elements to help identify the structure (Figure 2.47).
Earlier you learned how to untag elements using the Tags panel. The Structure pane can be used to untag elements, too. Figures 2.48 through 2.50 show you how to untag a placed graphic element, untag a text element, and untag multiple elements at once, in that order.
Sometimes when you press the Untag button it removes the entire XML structure from the element (Figure 2.51).
Placed (and/or unplaced) elements can be deleted using the Structure pane. Figure 2.52 shows how to delete a placed object, and Figure 2.53 shows how to delete multiple elements at once.
Figure 2.52. Click once on the portrait
element in the Structure pane. To delete it completely, click the trash can icon at the top, select Delete from the Structure pane menu, or press the Delete key. When the Delete XML Element dialog appears, it gives you the option to delete or simply untag the element. Click the Delete button.
One of the most powerful features of InDesign’s XML tools (and one of our favorites) is the ability to apply Paragraph, Character, and Table (CS3 only) styles to imported content automatically. It means that, potentially, with the right template, you could create instant documents completely formatted from scratch with a few clicks of the mouse.
Open xml_interface_5.indt and have a look at Figure 2.54.
If we can style text that’s already tagged, wouldn’t it be nice if you could tag text that was already styled? ’Nuff said. InDesign can do that, too! Open xml_interface_6.indt and check out Figures 2.55 and 2.56. For a detailed description on how to do this properly see Chapters 9 and 10.
InDesign’s XML export interface may be your last stop in an XML workflow. To export your structured layout to XML, select File > Export. Give the file a name, choose XML from the Format pull-down menu, and click Save.
The Export XML dialog (Figure 2.57) is responsible for creating the exact type and structure of XML file you want. Take a minute to familiarize yourself with the possible settings (Table 2.2). We demonstrate what they do in detail in upcoming chapters.
This point is important enough that we mention it several times within the book. When InDesign exports XML, it includes everything within a tagged story, including any untagged text as well as the text from any linked text frames. Be aware that while untagged content may not cause trouble in InDesign, it may give other XML applications fits.
Here are some brief descriptions of the XML export options:
Table 2.2. XML Export Options
General | |
Option | Description |
Include DTD Declaration | Includes the name and path of the DTD used within your structure. This option is only selectable when a DTD has been loaded by you or referenced by your imported XML content. |
View XML Using | Select the program in which you wish to view your XML after export. You can choose any program capable of viewing XML, including compatible browsers and HTML editors, such as Adobe Dreamweaver. Deselect if you do not want to view the file. |
Export from Selected Element | Allows you to export XML starting from a specific point within your structure. To use this option, you must first select the element you want to export using the Structure pane. Then choose this option within the dialog. |
Export Untagged Tables as CALS XML (CS3 only) | Converts untagged tables into CALS-compatible markup. For this option to apply in InDesign, the table must sit in a tagged frame but contain no tagged elements itself. |
Remap Break, Whitespace, and Special Characters (CS3 only) | Exports breaks, whitespace, and special characters as code entities, which we describe in Chapter 1. See “Wasting Spacing” in Chapter 3 for additional information. |
Apply XSLT (CS3 only) | Applies an XSL stylesheet transformation to the XML upon export. As described in Chapter 1, an XSLT can reformat, filter, sort or perform some other desired transformation to the data. |
Encoding | Choose among UTF-8, UTF-16, or Shift_JIS encodings for the exported data. Check what type of encoding your desired application requires before exporting. For most applications, UTF-8 or UTF-16 is fine. |
Images | |
Option | Description |
Copy to Images Subfolder: | InDesign can export tagged images within the document for use in an XML workflow. The images will be exported along with the XML markup into an Images Subfolder. |
Original Images | Exports tagged images in their original formats. |
Optimized Original Images | Exports and converts tagged images within the layout to JPEG or GIF formats. |
Optimized Formatted Images | Exports images to JPEG or GIF formats that have been transformed within InDesign. Among the transformations supported are cropping, rotation, and skewing. |
Image Conversion | Select the image format you want, GIF or JPEG. Automatic allows InDesign to select the type of format itself based on the image properties, such as color, quality, and so on. |
GIF Options | |
Option | Description |
Palette | Select from the available GIF color palettes. |
Interlace | Prepares images to download in alternating rows of pixels, which allows images to appear in a browser more quickly at slower connection speeds. |
JPEG Options | |
Option | Description |
Image Quality | Choose between high-quality, large file sizes and low-quality, small file sizes. |
The last XML feature we look at in Layout view is the use of Document Type Definitions, known as DTDs, to validate XML structure. This topic is covered in detail in Chapter 11, but here’s the dime tour.
Open xml_interface_7.indt.
If a DTD is not included as an inline element within the XML file itself, you must load it manually (Figure 2.58).
As we explain in Chapter 1, a DTD can be used to test an XML structure to make sure it follows the rules. By validating your structure against the DTD, InDesign identifies parts that don’t conform and gives you tips on how the problem may be fixed. Figure 2.59 shows how to validate an existing XML structure. Click the lightning bolt icon at the top of the Structure pane to validate the current document structure. Errors are indicated within the structure schematic and suggested fixes appear in their own section of the pane.
The error messages in the Structure pane can be somewhat cryptic and often inaccurate. This is a case where knowing how to read DTD comes in handy, and InDesign provides a simple way to get a first-hand look at the DTD that you loaded (Figure 2.60). Select View DTD from the Structure pane menu.
Figure 2.60. From our coverage of DTD syntax and grammar in Chapter 1, you should be able to parse out the proper XML structure. If so, you’ll see that the real problem with our structure is that no text is tagged with the element placeofdeath
.
Let’s put your newly acquired knowledge to the test. To fix the structure you must select the text Clos Lucé, France, tag it with the element placeofdeath
, and then revalidate the layout (Figure 2.61).
The Story Editor often gets overlooked or regarded by many as an afterthought by Adobe, but Story Editor is a fully functional word processor and a handy tool. We love it. We use it frequently for a host of tasks, especially when stories span multiple pages or when we’re working in a complex XML workflow. In this section, we look at the XML features provided by Story Editor.
Open xml_interface_8.indt. Using the Selection or Text tool, click on or in the main text frame. Select Edit in Story Editor from the Edit menu or press Cmd-Y (Ctrl-Y). If you’re used to the hubbub and clutter of Layout view, Story Editor will appear Spartan, almost severe. The interface is geared for writers and editors, not designers (Figure 2.62).
Because Story Editor is designed to work only with text, its XML functionality is basically limited to assisting in tagging and structuring text.
To show the XML interface, see Figures 2.63 and 2.64. Select View > Structure > Show Tag Markers to display the tag markers. Select Window > Tags to display the Tags panel, if it’s not visible. Story Editor has no access to the Structure pane, so the only XML tools you have to work with are the Tags panel and the tag markers, which appear as colorful five-sided polygons.
To identify text elements in the Story Editor, see Figure 2.65. Identifying XML elements within Story Editor is pretty straightforward compared to Layout view.
Although it’s true that you can’t see or edit the content of a graphic within Story Editor, we discovered a way to at least check what element is supposed to be represented in an inline/anchored object. This trick only works with objects inline or anchored within the frame being edited. We assume for the purpose of this lesson that the inline/anchored object (Figure 2.66) is a graphic, but it could just as easily be an anchored text frame instead. Select the Anchor icon that appears after the text North America by dragging your Text cursor across it.
Figure 2.67 shows how to tag untagged text in the Story Editor.
Figure 2.68 shows how to retag text in the Story Editor. Select the number 9631418, which is tagged incorrectly as Population
.
At times, you need to nest one XML element within another, or wrap an element around another. By default, InDesign wants to retag the text when you click on a different tag name in the panel. To facilitate nesting and wrapping, the Tags panel provides the Add Tag radio button. By selecting this button before you tag an element, InDesign leaves any existing tag(s) in place and then adds the new tag in the manner you designate (Figure 2.69). To add, or insert, one element within another, first select the number 9631418.
To wrap a tag around an existing element, see Figure 2.70. To add a tag outside, or wrap, another element, select the number 295734134 and the opening and closing Population
tags surrounding it.
The Retag and Add tag functionality works identically in Layout view as it does in Story Editor. We prefer to use Story Editor when we need to nest multiple elements, because the element tag icons are so much easier to identify, as you can see in Figure 2.71. Note how easy it is to identify the elements and how they are nested in Story Editor.
Adobe InCopy is a standalone application, purchased separately, that provides robust text-editing tools for non-designers. Like Story Editor, InCopy focuses almost entirely on the words and is intended to be used by the editors and writers who work side by side with designers. At less than half the price of InDesign, it’s more cost effective to give editors and writers InCopy instead of InDesign. Although InCopy has nearly all the features of a normal word processor, such as Microsoft Word, it also provides some important advantages.
First, it’s fully integrated with InDesign—for example, the menus and commands for editing and formatting text are identical. When you open an InDesign file or assignment within InCopy, you have direct access to all the Paragraph and Character styles and color swatches stored in the document. Second, InCopy provides a direct connection to the other people involved in your workflow—keeping track of who is currently working on it, what changes have been made, and then updating the layout or text as necessary. Finally, nothing beats InCopy’s advantage of working in the actual layout, especially when you need an accurate visual to fit text into a tight space, wrapping it around graphics and other stories.
The XML features in InCopy are almost the same as those in InDesign. For example, InCopy has both a Structure pane and a Tags panel. And tags and elements can be created, edited, imported, and applied exactly the same way you do as in InDesign and Story Editor.
So, in this section, we don’t waste time repeating the ways these programs are similar; instead, we briefly describe the ways these applications differ. If you need a refresher course in tagging or XML structure, turn back to the earlier descriptions of the XML features in InDesign and Story Editor.
Basically, the program has four methods of working with XML. InCopy can:
Open an InDesign document to edit or add XML structure.
Open an InDesign assignment or InCopy .INCX file to edit or add XML structure.
Open an XML file directly.
Create an XML file from scratch.
The capability of creating, editing, and opening InCopy assignments and files is an add-on feature to InDesign enabled through plug-ins. These features are installed automatically in CS3, but you have to add the plug-ins manually for CS2. The plug-ins are stored on the Resources and Extras disc in the CS2 disc set or on Disc One in the stand-alone version of InDesign CS2, as seen in Figure 2.72.
Open xml_interface_9.indd using InCopy. Here you see the Layout view of InCopy. Can you see the similarities between InCopy and InDesign, such as the Structure pane and Tags panel and their respective menus? Although InCopy users can’t create or modify the layout, they can open the actual InDesign file itself and work on the text either on the page or within Story or Galley view. However, there’s one catch: Before the InCopy user can make any changes, the InDesign user must first create an assignment or export the layout content to InCopy .INCX files. In Figure 2.73 you can see the InCopy Assignment Available icon above the main text frame.
InCopy provides three working spaces: Layout view, Story view, and Galley view. Layout view shows the actual page layout of the InDesign document, including text, pictures, graphics, margins, and column geometry, as seen in Figure 2.73. The exact amount of detail is determined by the InDesign user, who controls access by making the assignments. In Figure 2.74 you see Story view, which is similar to Story Editor in InDesign. It provides access only to the words within a story, whether it’s in a single frame or a set of linked text frames. InCopy’s Galley view also provides access to the words with the added benefit that it depicts the line breaks or line count as they appear in the actual InDesign layout. Once in an InCopy workflow, you can’t modify anything in the document until you check it out for editing as shown in Figure 2.74.
We don’t know or understand why, but InCopy has no ability to import XML. (It probably has something to do with the fact that InCopy cannot create text frames or pages in the InDesign layout). If you want XML in your layout, you first have to import it using InDesign. However, unlike InDesign, InCopy can open XML files directly (Figure 2.75). In a pinch, InCopy can be used as an XML editor, allowing you to assign, create, or delete tags, edit and restructure content, and do whatever else you need to do to prepare the file for use in your workflow.
In Figure 2.76 you see the Export dialog (File > Export) showing XML as one of the possible file formats the program can create. In Chapter 3 we’ll show you how to create XML content in InCopy as well as several other programs. To get a full appreciation of the features and utility of InCopy, check out The Adobe InCopy CS2 Book (Adobe Press) or the DVD and online training available from Lynda.com and Totaltraining.com.
18.117.70.88