Chapter 2. InDesign’s XML Features

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.

Layout View

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.

Importing XML

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).

xml_interface_1.indt is a typical InDesign document with no XML structure whatsoever.

Figure 2.1. xml_interface_1.indt is a typical InDesign document with no XML structure whatsoever.

Figures 2.2 and 2.3 show how to import XML.

You can import XML from the File menu or from the Structure pane menu.

Figure 2.2. You can import XML from the File menu or from the Structure pane menu.

Select the target XML file. Select Show XML Import Options checkbox. Choose Merge Content or Append Content.

Figure 2.3. Select the target XML file. Select Show XML Import Options checkbox. Choose Merge Content or Append Content.

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.

The XML Import Options dialog usually starts the ball rolling. In this dialog you specify how you want to import the XML content. If no checkboxes are selected, the entire XML file imports into the Structure pane.

Figure 2.4. The XML Import Options dialog usually starts the ball rolling. In this dialog you specify how you want to import the XML content. If no checkboxes are selected, the entire XML file imports into the Structure pane.

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.

Structure Pane Close-up

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:

  1. Select View > Structure > Show Structure.

  2. Click anywhere on the left border of the Layout view window.

  3. Click the Show Structure button at the lower-left edge of the Layout view window.

  4. Press Option-Cmd-1 (Ctrl-Alt-1).

The Structure pane opens automatically when you import the XML file. InDesign gives you four more methods to open the pane.

Figure 2.5. The Structure pane opens automatically when you import the XML file. InDesign gives you four more methods to open the pane.

Showing Text Snippets, Attributes, Comments, and Processing Instructions

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.

Select Show Text Snippets from the Structure pane menu to get a sneak peek at the XML content in each element. Also select Show Attributes, Comments, and Processing Instructions before proceeding.

Figure 2.6. Select Show Text Snippets from the Structure pane menu to get a sneak peek at the XML content in each element. Also select Show Attributes, Comments, and Processing Instructions before proceeding.

Expanding the Structure

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.

Click on the triangle in front of the master element to reveal that it contains two artist elements.

Figure 2.7. Click on the triangle in front of the master element to reveal that it contains two artist elements.

Click on an artist element to reveal seven child elements contained within.

Figure 2.8. Click on an artist element to reveal seven child elements contained within.

Click on image to reveal the href attribute; click on name to show the firstname and lastname child elements.

Figure 2.9. Click on image to reveal the href attribute; click on name to show the firstname and lastname child elements.

Option-click (Alt-click) on the master element to expand the entire structure at once.

Figure 2.10. Option-click (Alt-click) on the master element to expand the entire structure at once.

Collapsing the Structure

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.

Option-click (Alt-click) on the master element to collapse all levels of the structure at once.

Figure 2.11. Option-click (Alt-click) on the master element to collapse all levels of the structure at once.

Structure Pane Anatomy

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).

The Structure pane also provides handy, one-stop access to all the commands for adding, editing, and deleting these components.

Figure 2.12. The Structure pane also provides handy, one-stop access to all the commands for adding, editing, and deleting these components.

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

Icon

Name

Description

Structure Pane Icons

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.

Structure Pane Icons

Open triangle or “twirlie”

Represents an open element. Click the triangle to close, or collapse, the element to hide its contents.

Structure Pane Icons

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.

Structure Pane Icons

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.

Structure Pane Icons

DOCTYPE element

Indicates that a DTD has been loaded.

Structure Pane Icons

Empty element

Represents a graphic or unassigned frame that is empty.

Structure Pane Icons

Graphic element

Represents a tagged frame that contains a graphic. Graphic elements automatically include an href attribute that defines the path or URL to the graphic file.

Structure Pane Icons

Graphic element–unplaced

Represents an XML reference to an image that has not been placed within the document.

Structure Pane Icons

Processing instruction

Represents an instruction that will trigger an action in applications that can read such instructions, such as an XML parser.

Structure Pane Icons

Root element

The first XML element that automatically contains all other elements. All XML files will have one root element. Note: Although Root is the default name in InDesign, most XML applications will probably call it something else.

Structure Pane Icons

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.

Structure Pane Icons

Table element

Represents a tagged table.

Structure Pane Icons

Table–body cell element

Represents a tagged cell within the body of a table.

Structure Pane Icons

Table–footer cell element

Represents a tagged cell in the footer row of a table.

Structure Pane Icons

Table–header cell element

Represents a tagged cell in the header row of a table.

Structure Pane Icons

Text element

Represents tagged text within a frame.

Structure Pane Icons

Text element–unplaced

Unplaced text element not yet associated with a page item.

Placing Unformatted Elements from the Structure Pane

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.

Drag a graphic element from the Structure pane to place it on the page.

Figure 2.13. Drag a graphic element from the Structure pane to place it on the page.

Figure 2.14 shows how to place a text element from the Structure pane.

Drag a text element from the Structure pane to place it in the layout.

Figure 2.14. Drag a text element from the Structure pane to place it in the layout.

Note

A placed text element will fill an existing text frame or automatically create its own frame that conforms to the page margins. If you place a text element into a frame occupied by another similarly tagged element, the new element will completely replace the existing one.

The Tags Panel Close-up

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).

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.

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.

Access the Tags panel from the Window menu.

Figure 2.16. Access the Tags panel from the Window menu.

The Tags panel is used to create, edit, import, or delete tags; to identify currently tagged elements within your layout; or to assign tags to your content or XML placeholders. The Tags panel displays all the available XML elements. Notice the color chip associated with each tag name.

Figure 2.17. The Tags panel is used to create, edit, import, or delete tags; to identify currently tagged elements within your layout; or to assign tags to your content or XML placeholders. The Tags panel displays all the available XML elements. Notice the color chip associated with each tag name.

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.

Select Show Tag Markers and Show Tagged Frames from the View menu.

Figure 2.18. Select Show Tag Markers and Show Tagged Frames from the View menu.

InDesign uses brackets and color as visual cues to the structure of your XML.

Figure 2.19. InDesign uses brackets and color as visual cues to the structure of your XML.

Identifying Tagged Elements

Use the Tags panel to identify currently tagged elements (see Figures 2.20 through 2.23)

Using the Selection tool, when you select the picture frame, the image tag highlights in the Tags palette.

Figure 2.20. Using the Selection tool, when you select the picture frame, the image tag highlights in the Tags palette.

Using the Selection tool, when you select the text frame, the artist tag highlights.

Figure 2.21. Using the Selection tool, when you select the text frame, the artist tag highlights.

Using the Text tool, select the text April 15, 1452. Note how the born tag highlights.

Figure 2.22. Using the Text tool, select the text April 15, 1452. Note how the born tag highlights.

You may notice the text Clos Lucé, France has no brackets. This text is technically untagged—there is no element for Place of death. Because the text has no tags of its own, it automatically assumes the tag of the parent element or the frame in which it resides.

Figure 2.23. You may notice the text Clos Lucé, France has no brackets. This text is technically untagged—there is no element for Place of death. Because the text has no tags of its own, it automatically assumes the tag of the parent element or the frame in which it resides.

Creating Tags

Figures 2.24 and 2.25 show you how to create a tag.

To create a tag, select New Tag from the Tags panel menu or click the New Tag button at the bottom of the panel.

Figure 2.24. To create a tag, select New Tag from the Tags panel menu or click the New Tag button at the bottom of the panel.

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.

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.

Editing Tags

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).

Select the Portrait tag in the Tags panel and then double-click it or select Tag Options from the Tags panel menu.

Figure 2.26. Select the Portrait tag in the Tags panel and then double-click it or select Tag Options from the Tags panel menu.

Edit the tag name so that portrait is entirely lowercase. Click OK.

Figure 2.27. Edit the tag name so that portrait is entirely lowercase. Click OK.

Loading Tags

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).

Select Load Tags from the Tags panel menu.

Figure 2.28. Select Load Tags from the Tags panel menu.

Select tag-list.xml from the Chapter 2 folder. You can load tags from any XML, InDesign, or InCopy file. Click Open.

Figure 2.29. Select tag-list.xml from the Chapter 2 folder. You can load tags from any XML, InDesign, or InCopy file. Click Open.

The tags placeofdeath and media appear in the Tags panel.

Figure 2.30. The tags placeofdeath and media appear in the Tags panel.

Deleting Unused Tags

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.

Select media in the Tags panel. Select Delete Tag from the Tags panel menu or click the Delete Tag button at the bottom of the Tags panel.

Figure 2.31. Select media in the Tags panel. Select Delete Tag from the Tags panel menu or click the Delete Tag button at the bottom of the Tags panel.

Deleting Used 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).

Select and delete the image tag. This tag is assigned to the graphic frame on page 1. When an assigned tag is deleted, InDesign requires that you retag tagged elements with another tag from the panel. Select portrait as the replacement tag. Click OK.

Figure 2.32. Select and delete the image tag. This tag is assigned to the graphic frame on page 1. When an assigned tag is deleted, InDesign requires that you retag tagged elements with another tag from the panel. Select portrait as the replacement tag. Click OK.

Saving Tags

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).

Select Save Tags from the Tags panel menu. The tag names are saved into an XML file. The file includes only the names themselves; no XML data from the layout is included.

Figure 2.33. Select Save Tags from the Tags panel menu. The tag names are saved into an XML file. The file includes only the names themselves; no XML data from the layout is included.

Applying Tags to Text

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.

Using the Text tool, select the text Clos Lucé, France. Click the tag placeofdeath in the Tags panel. You can also right-click on the selected text and choose placeofdeath from the Tag Text context submenu.

Figure 2.34. Using the Text tool, select the text Clos Lucé, France. Click the tag placeofdeath in the Tags panel. You can also right-click on the selected text and choose placeofdeath from the Tag Text context submenu.

Applying Tags to Graphics

To apply tags to graphics, follow Figure 2.35.

Using the Selection tool, select the picture frame. Click painting in the Tags panel.

Figure 2.35. Using the Selection tool, select the picture frame. Click painting in the Tags panel.

Note

The tag color can be difficult to see when the frame contains a graphic.

Note

With graphics, tags are applied to the frames not the contents.

Changing Tag Assignments

Figure 2.36 shows how to change tag assignments.

Using the Selection tool, select the picture frame. Click portrait in the Tags panel.

Figure 2.36. Using the Selection tool, select the picture frame. Click portrait in the Tags panel.

Untagging Graphics and Text

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.

Go to page 2. Using the Selection tool, select the picture frame. Click the Untag button in the Tags panel.

Figure 2.37. Go to page 2. Using the Selection tool, select the picture frame. Click the Untag button in the Tags panel.

Using the Text tool, select the entire text of or simply insert the cursor somewhere within Claude Monet. Click the Untag button in the Tags panel or right-click on the selection and choose Untag Text.

Figure 2.38. Using the Text tool, select the entire text of or simply insert the cursor somewhere within Claude Monet. Click the Untag button in the Tags panel or right-click on the selection and choose Untag Text.

Using the Selection tool, select the text frame on page 2. Click the Untag button in the Tags panel.

Figure 2.39. Using the Selection tool, select the text frame on page 2. Click the Untag button in the Tags panel.

Using the Selection tool, press Cmd-A (Ctrl-A) to select all objects on the spread. Click the Untag button in the Tags panel.

Figure 2.40. Using the Selection tool, press Cmd-A (Ctrl-A) to select all objects on the spread. Click the Untag button in the Tags panel.

Warning

When an object is untagged, tags are removed not only from the frame and its contents but also from all linked frames on whatever page(s) they reside on.

Tags vs. Structure

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.

Identifying Elements from the Structure Pane

Open xml_interface_4.indd from the Chapter 2 folder (Figure 2.41).

xml_interface_4.indt features a fully structured layout.

Figure 2.41. xml_interface_4.indt features a fully structured layout.

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?

If you can find these elements in the Structure pane, you can use it to find them in your layout, too.

Figure 2.42. If you can find these elements in the Structure pane, you can use it to find them in your layout, too.

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).

The icon and the actual element in the layout are, in effect, the same thing.

Figure 2.43. The icon and the actual element in the layout are, in effect, the same thing.

Notice in what ways the elements in the Structure pane and the content in the layout each indicate they are selected.

Figure 2.44. Notice in what ways the elements in the Structure pane and the content in the layout each indicate they are selected.

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).

See how the image of Leonardo da Vinci is highlighted in the layout and in the Structure pane.

Figure 2.45. See how the image of Leonardo da Vinci is highlighted in the layout and in the Structure pane.

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.

In turn, double-click the name icon, the born icon, and then the birthplace icon.

Figure 2.46. In turn, double-click the name icon, the born icon, and then the birthplace icon.

Identifying Structure from the Layout

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).

Using the Text tool, click in the text Anchiano. See how the artist and birthplace icons highlight in the Structure pane and Tag panel? Click in some other text elements and see how they are tagged and where in the XML structure they exist.

Figure 2.47. Using the Text tool, click in the text Anchiano. See how the artist and birthplace icons highlight in the Structure pane and Tag panel? Click in some other text elements and see how they are tagged and where in the XML structure they exist.

Untagging Elements from the Structure Pane

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.

Click once on the portrait icon in the Structure pane. Select Untag Element from the Structure pane menu. Note how the element is removed from the Structure pane altogether but the picture remains in the layout.

Figure 2.48. Click once on the portrait icon in the Structure pane. Select Untag Element from the Structure pane menu. Note how the element is removed from the Structure pane altogether but the picture remains in the layout.

Click once on the birthplace icon in the Structure pane. Select Untag Element from the Structure pane menu. Note how the element and the text snippet are removed from the Structure pane. However, the text remains in the layout although the tag brackets are no longer displayed.

Figure 2.49. Click once on the birthplace icon in the Structure pane. Select Untag Element from the Structure pane menu. Note how the element and the text snippet are removed from the Structure pane. However, the text remains in the layout although the tag brackets are no longer displayed.

Click the second artist element in the Structure pane. Select Untag Element from the Structure pane menu. Note how all the child elements and their text snippets are removed from the Structure pane. The content remains in the layout, but no longer displays any tag brackets.

Figure 2.50. Click the second artist element in the Structure pane. Select Untag Element from the Structure pane menu. Note how all the child elements and their text snippets are removed from the Structure pane. The content remains in the layout, but no longer displays any tag brackets.

Note

Sometimes when you press the Untag button it removes the entire XML structure from the element (Figure 2.51).

In these situations, InDesign displays a warning dialog to confirm your action.

Figure 2.51. In these situations, InDesign displays a warning dialog to confirm your action.

Deleting Elements Using the Structure Pane

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.

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.

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.

Click once on the artist icon in the Structure pane. Click the trash can icon at the top of the Structure pane. Click the Delete button.

Figure 2.53. Click once on the artist icon in the Structure pane. Click the trash can icon at the top of the Structure pane. Click the Delete button.

Note

The root element can’t be deleted.

Formatting XML Content Automatically

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.

Select Map Tags to Styles from the Tags panel menu or from the Structure pane menu. Click Map by Name if your tag names match your style names exactly—or map them manually, one by one, to the desired styles. Click OK.

Figure 2.54. Select Map Tags to Styles from the Tags panel menu or from the Structure pane menu. Click Map by Name if your tag names match your style names exactly—or map them manually, one by one, to the desired styles. Click OK.

Tagging Text Elements Automatically

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.

Select Map Styles to Tags from the Tags panel menu or from the Structure pane menu. Click Map by Name if your style names match your tag names exactly, or map them manually, one by one, to the desired XML elements. Click OK.

Figure 2.55. Select Map Styles to Tags from the Tags panel menu or from the Structure pane menu. Click Map by Name if your style names match your tag names exactly, or map them manually, one by one, to the desired XML elements. Click OK.

XML tag brackets appear automatically around some of the text in the layout. A good start, but the job isn’t done. Note how the picture and the text frames are still untagged. This layout still requires some manual tagging.

Figure 2.56. XML tag brackets appear automatically around some of the text in the layout. A good start, but the job isn’t done. Note how the picture and the text frames are still untagged. This layout still requires some manual tagging.

Note

Not all styles or tags can be mapped automatically. For example, you won’t always have style and tag names that match. Some elements will have to be tagged manually.

Exporting XML

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.

The Export XML dialog provides options for creating a usable XML file from the tagged text and images within your document. InDesign can even convert print images into GIFs or JPEGs for Web use, if necessary.

Figure 2.57. The Export XML dialog provides options for creating a usable XML file from the tagged text and images within your document. InDesign can even convert print images into GIFs or JPEGs for Web use, if necessary.

Note

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.

 

Using DTDs

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.

Loading a DTD

If a DTD is not included as an inline element within the XML file itself, you must load it manually (Figure 2.58).

The DTD can be loaded from either the Structure pane menu or the Tags panel menu. The controls for DTD validation are located at the top of the Structure pane. Select masters.dtd in the Load DTD dialog. Click Open.

Figure 2.58. The DTD can be loaded from either the Structure pane menu or the Tags panel menu. The controls for DTD validation are located at the top of the Structure pane. Select masters.dtd in the Load DTD dialog. Click Open.

Validating Structure with a DTD

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.

In this file the DTD found at least one error. But don’t make any changes yet. The suggested fix is actually incorrect!

Figure 2.59. In this file the DTD found at least one error. But don’t make any changes yet. The suggested fix is actually incorrect!

Viewing the DTD

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.

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.

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.

Fixing XML Structure

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).

Here you see the properly structured layout. Once the tag is applied to Clos Lucé, France the layout validates with no errors.

Figure 2.61. Here you see the properly structured layout. Once the tag is applied to Clos Lucé, France the layout validates with no errors.

InDesign’s Story Editor

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.

Accessing 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).

In Story Editor, text displays without differentiation in either typeface or font size, and the only graphics that appear are the icons representing inline or anchored graphics and XML tags.

Figure 2.62. In Story Editor, text displays without differentiation in either typeface or font size, and the only graphics that appear are the icons representing inline or anchored graphics and XML tags.

Showing the XML Interface

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.

Note how the polygons appear at the beginning and end of each element.

Figure 2.63. Note how the polygons appear at the beginning and end of each element.

Tag markers in Story Editor appear as colorful, 5-sided polygons at the beginning and end of tagged text. You don’t need to look at the Tags panel to identify this element as Countryname.

Figure 2.64. Tag markers in Story Editor appear as colorful, 5-sided polygons at the beginning and end of tagged text. You don’t need to look at the Tags panel to identify this element as Countryname.

Identifying Text Elements Using the Tags Panel

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.

You can also identify elements using the Tags panel. Click in the text United States, and the Countryname tag highlights in the Tags panel.

Figure 2.65. You can also identify elements using the Tags panel. Click in the text United States, and the Countryname tag highlights in the Tags panel.

Identifying Inline/Anchored Elements in Story Editor

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.

Be sure to select only the icon and none of the text or spaces that appear on either side of it. The map tag highlights in the Tags panel.

Figure 2.66. Be sure to select only the icon and none of the text or spaces that appear on either side of it. The map tag highlights in the Tags panel.

Tagging Text in Story Editor

Figure 2.67 shows how to tag untagged text in the Story Editor.

Select the text North America. Click the tag name Continent in the Tags panel.

Figure 2.67. Select the text North America. Click the tag name Continent in the Tags panel.

Retagging Text in Story Editor

Figure 2.68 shows how to retag text in the Story Editor. Select the number 9631418, which is tagged incorrectly as Population.

Make sure that the radio button Retag is selected in the Tags panel. Click the tag name Area to retag the number properly.

Figure 2.68. Make sure that the radio button Retag is selected in the Tags panel. Click the tag name Area to retag the number properly.

Adding Tags to Text in Story Editor

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.

Select the Add Tag radio button in the Tags panel and click the land tag in the Tags panel. This inserts, or nests, the land element inside the Area element.

Figure 2.69. Select the Add Tag radio button in the Tags panel and click the land tag in the Tags panel. This inserts, or nests, the land element inside the Area element.

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.

Note how the Add Tag button is selected by default. Click the AD2007 tag in the Tags panel. This wraps, or nests 295734134 and the Population tags within the AD2007 element.

Figure 2.70. Note how the Add Tag button is selected by default. Click the AD2007 tag in the Tags panel. This wraps, or nests 295734134 and the Population tags within the AD2007 element.

Note

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.

Compare the display of the identically tagged elements in Layout view (left) and Story Editor (right). Which display would you prefer to work with?

Figure 2.71. Compare the display of the identically tagged elements in Layout view (left) and Story Editor (right). Which display would you prefer to work with?

InCopy

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:

  1. Open an InDesign document to edit or add XML structure.

  2. Open an InDesign assignment or InCopy .INCX file to edit or add XML structure.

  3. Open an XML file directly.

  4. Create an XML file from scratch.

Installing InCopy Plug-Ins in InDesign

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.

Look in the folder Technical Information > InCopy CS2 Plug-ins. To install the InCopy features, copy all the plug-ins into the InDesign CS2 > Plug-Ins > InCopyWorkflow folder as shown here and restart InDesign.

Figure 2.72. Look in the folder Technical Information > InCopy CS2 Plug-ins. To install the InCopy features, copy all the plug-ins into the InDesign CS2 > Plug-Ins > InCopyWorkflow folder as shown here and restart InDesign.

Opening an InDesign Document with InCopy

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.

The Assignment Available icon indicates that this story can be checked out in InCopy to edit the text or work on its XML structure.

Figure 2.73. The Assignment Available icon indicates that this story can be checked out in InCopy to edit the text or work on its XML structure.

Opening an InCopy Assignment

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.

Right-click in the content to access the Check Out command. The right to check out content can be granted only by the InDesign user.

Figure 2.74. Right-click in the content to access the Check Out command. The right to check out content can be granted only by the InDesign user.

Opening an XML File

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.

When you’re done, simply export the content as XML.

Figure 2.75. When you’re done, simply export the content as XML.

Creating XML in InCopy

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.

InCopy is not a replacement for an XML editor, but it can pinch hit if you don’t have one available. It offers robust features for creating as well as editing XML files.

Figure 2.76. InCopy is not a replacement for an XML editor, but it can pinch hit if you don’t have one available. It offers robust features for creating as well as editing XML files.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.70.88