Tag content for XML

Note:

Equitable Language: We are replacing non-inclusive language from InDesign 2022 (version 17.0) onwards, to reflect core Adobe values of inclusivity. Any reference to Master page is replaced by Parent page in our Help articles for the English, Danish, Hungarian, Spanish, Italian, Brazilian, Portuguese, and Japanese locales.

For detailed information and instructions, click the links below.

Create and load XML tags

Before you tag page items, create (or load) tags to identify each content type or item in your document. You can create tags from scratch or load them from another source, such as an InDesign document, InCopy document, or DTD file. Use any of the following methods to create or load XML tags for your document:

  • Create a tag with the New Tag command.

  • Load tags from an XML file or another document.

  • Import a DTD file.

  • Import tags (and content) using the Import XML command.

The Tags panel with a list of available tags

Create an XML tag

  1. Choose Window > Utilities > Tags to open the Tags panel.
  2. Do one of the following:
    • Choose New Tag from the Tags panel menu.

    • Click the New Tag button  on the Tags panel.

  3. Type a name for the tag. The name must conform to XML standards. If you include a space or an illegal character in the tag name, an alert message appears.
  4. Select a color for the tag if you created your tag from the Tags panel menu. (If you created your tag with the New Tag button, you can choose a color by changing the color of the tag.)
    Note:

    You can assign the same color to different tags. The color you select appears when you apply the tag to a frame and choose View > Structure > Show Tagged Frames, or when you apply the tag to text within a frame and choose View > Structure > Show Tag Markers. (Tag colors do not appear in exported XML files.)

  5. Click OK.

Load XML tags from another source

You can load tags from an XML file, an InDesign document, or an InCopy document.

Note:

InDesign automatically adds tags to the Tags panel when you load an XML file.

  1. Choose Load Tags from the Tags panel menu.
  2. Select the file containing the tags you want to load into the Tags panel, and then click Open.

Change tag name or color

  1. Double-click a tag name in the Tags panel or choose Tag Options in the Tags panel menu.
  2. Change the name or the color of the tag, and click OK.
Note:

You cannot change the name of locked tags. InDesign automatically locks tags specified in a loaded DTD file. To change the name of these tags, you must edit the DTD file and reload it into the document.

Tag items

Before you export content to an XML file, you must tag the text and other items (such as frames and tables) that you want to export. You also need to tag items that you have created as placeholders for imported XML content. Items that have been tagged appear as elements in the Structure pane.

Create (or load) tags to identify each content element that you want to export or import. Then tag text or page items using one of these techniques:

Manual tagging

Select a frame or text, and then click a tag in the Tags panel, or simply drag a tag from the Tags panel to a text or graphics frame.

Automatic tagging

Select a text frame, table, table cells, or image, and then click the Autotag icon in the Tags panel. Items are tagged according to your tagging preset options.

Map tags to styles

Associate tags with paragraph, character, table, or cell styles, and then apply tags automatically to text, a table, table cells, and paragraphs that were assigned those styles.

When tagging page items, note the following:

  • You can apply tags to stories as well as to text within stories. For example, you might want to apply an Article tag to a story, and then apply more specific tags, such as Title and Body, to paragraphs within the story.

  • You can apply only one tag to a story. When you tag a frame in a threaded story, all other frames in the story, along with any overset text, are assigned the same tag.

  • You can apply only one tag to a graphics frame. When you tag a graphics frame, InDesign records a reference to the graphic’s location (on disk).

  • You cannot tag a group of objects. To tag an item that’s part of a group, use the Direct Selection tool  to select the item.

  • When you tag text within a tagged element (such as a paragraph within a story), it appears as a child of the existing element in the Structure pane.

  • You can tag text or images on a parent page, but only one instance of the corresponding element appears in the Structure pane regardless of how many times the item appears on document pages. However, if you manually override a parent item and then tag it on a document page, the item will appear as a separate element in the Structure pane.

  • You can’t tag a footnote.

Note:

Avoid tagging special characters, such as the Automatic Page Number character. When exporting, InDesign strips out some special characters to comply with XML standards. InDesign warns you when characters cannot be encoded in XML.

Tag frames manually

You can tag frames by using any of these methods.

  • Drag a tag from the Tags panel onto a frame.
  • Using a selection tool, select a frame, and then click a tag in the Tags panel.
Note:

If a frame is part of a group or nested within another frame, use the Direct Selection tool to select the frame.

  • Open a frame’s context menu, choose Tag Frame, and then choose a tag.
  • Using a selection tool, select an untagged text or graphics frame, drag the frame to the Structure pane, release the mouse, and then select a tag name from the menu that appears.

Tag text within a text frame manually

When you tag text within a frame, the new element appears in the Structure pane as a child of the frame element in which the text is located.

  1. Make sure that the story in which the text appears is tagged. (If a story isn’t tagged and you tag text within the story, InDesign automatically tags the story using the tag specified in the Tagging Preset Options dialog box.)
  2. Using the Type tool, select text within the text frame.
  3. Click a tag in the Tags panel.
Note:

You can’t tag footnotes.

Tag text frames, tables, table cells, and images automatically

By clicking the Autotag icon in the Tags panel, you can tag a text frame, table, table cells, or an image automatically. To tag the item, InDesign applies a default tag that you specify in the Tagging Preset Options dialog box.

  1. Select the text frame, table, table cells, or image that you want to tag.
  2. In the Tags panel, click the Autotag icon  .

    InDesign adds the default tag’s name to the Tags panel after you click the Autotag icon.

Tag content according to paragraph or character style

Paragraph styles and character styles you assign to text can be used as a means of tagging paragraphs and text for XML. For example, a paragraph style called Caption can be associated with a tag called FigureName. Then, using the Map Styles To Tags command, you can apply the FigureName tag to all text in your document assigned the Caption paragraph style. You can map more than one style to the same tag.

Note:

The Map Styles To Tags command tags content automatically, including paragraphs and characters that are tagged already. For example, if a paragraph assigned the Context style has been tagged with the Body tag, but you then associate the Context style with the Expository tag, the paragraph is retagged; it is stripped of the Body tag and given the Expository tag instead. If you want to retain existing tags, apply tags manually (or use the Map Styles To Tags command very carefully).

  1. Choose Map Styles To Tags from the Tags panel menu.
  2. For each style in your document, specify the tag that you want it to be mapped to.
    Map Styles To Tags dialog box

  3. To match style names to tag names, click Map By Name. Styles that are named identically to tag names are selected in the dialog box. Map By Name is case-sensitive; Head1 and head1, for example, are treated as different tags.
  4. To use style mappings from a different InDesign file, click Load and select the file.
  5. Select or deselect Include options:

    Parent Page Stories

    Maps styles found on parent page text frames to tags.

    Pasteboard Stories

    Maps styles found on text frames on the pasteboard to tags. (Deselect this option to avoid tagging content on the pasteboard.)

    Empty Stories

    Maps styles located on empty text frames to tags. (Deselect this option to avoid tagging empty frames.)

  6. Click OK.

The new XML tags are applied throughout your document to paragraph and character styles that you specified in the Map Styles To Tags dialog box.

Note:

You cannot tag images with the Map Styles To Tags command. You need to manually tag images if you want to include them in an XML file.

Tag text in tables

When you tag a table for XML, you create a table element as well as one cell element for each cell in the table. The cell elements are child elements of the table element, and are created automatically.

  1. Click in the table and choose Table > Select > Table.
  2. Select a tag for the table in the Tags panel.

    InDesign creates a cell element for each cell in the table (you can display them in the Structure pane). The tag applied to table cell elements depends on your Autotag default settings.

  3. If needed, tag table cells with a different tag.

    For example, you can tag the first-row cells with a different tag to identify them as heading cells. To apply tags to cells, select the actual table cells in your document, and then select a tag. (Selecting cells in the table also selects the corresponding cell elements in the Structure pane.)

Note:

You can also tag a table by selecting it and then clicking the Autotag icon in the Tags panel. The Table tag (or another tag of your choice) is applied immediately to the table, according to your Autotag default settings.

Untag an item

Untag an item to remove its tag but retain the associated content.

  1. Select the element in the Structure pane, or select the page item or tagged text in the document layout.
  2. Click Untag in the Tags panel.

Retag items

Retag an item to replace the existing tag (you don’t need to untag it first). Use one of these techniques to retag an item:

  • Using a selection tool, select a text frame, a graphics frame, or an element in the Structure pane, and then click a different tag in the Tags panel.
  • To retag a story, use the Type tool to place a insertion point anywhere in the story’s text. Select Retag in the Tags panel, and then click a different tag.
  • To retag a text block, use the Type tool to select the entire block of text. Select Retag in the Tags panel, and then click a different tag. (If you select Add Tag and then click a different tag, a new child element appears in the Structure pane.)

Specify Autotag defaults

When you select a text frame, table, table cells, or an image, and then click the Autotag icon in the Tags panel, InDesign applies a default tag to the item you selected. You can specify these default tags in the Tagging Preset Options dialog box.

Note:

InDesign applies a default tag when you create an element that requires a parent element, but doesn’t yet have one. For example, if you tag text within a text frame but the frame itself isn’t tagged, InDesign assigns the frame a tag according to the Tagging Preset Options. The capability to apply default tags helps InDesign maintain correct XML structure.

  1. Choose Tagging Preset Options from the Tags panel menu.
  2. Choose a default tag for text frames, tables, table cells, and images.
    Note:

    If the tag you need isn’t listed, you can choose New Tag from the menu and create a tag.

Show or hide tag markers and tagged frames

Tag markers are brackets that appear on the page around text that has been tagged. Show tag markers to see where titles, headings, and other text has been tagged on a page. Tagged frames indicate where items such as text frames, tables, and images have been tagged. The color assigned to a tag in the Tags panel determines the color of tag markers and tagged frames. Tag markers and tagged frames only appear in Normal view.

A tagged frame and, within it, tag markers.

  1. Do any of the following:
    • To display color-coded tagged frames, choose View > Structure > Show Tagged Frames.

    • To hide the color-coding of tagged frames, choose View > Structure > Hide Tagged Frames.

    • To display color brackets around tagged text, choose View > Structure > Show Tag Markers.

    • To hide color brackets around tagged text, choose View > Structure > Hide Tag Markers.

Note:

To minimize the risk of accidentally deleting a tag marker, edit tagged text in Story Editor, where tag markers are more visible.

Delete tags

  • To delete a tag from the Tags panel, drag it to the Delete icon  at the bottom of the panel. If the tag has been applied to content, an alert message appears. Select another tag to replace the deleted tag and click OK.
  • To delete all unused tags, choose Select All Unused Tags from the Tags panel menu, and then click the Delete icon at the bottom of the panel.
Note:

Tags that were loaded with a DTD file cannot be deleted until the DTD file is deleted.

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online