Tagging content for XML

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

    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.

Pastaba:

InCopy 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.
Pastaba:

You cannot change the name of locked tags. InCopy 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.

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

XML elements and tags

A. Elements appear in the Structure pane. B. Tag markers surround text to which tags have been applied. 

When tagging page items, note the following:

  • Text frames must be tagged before you can tag the text inside them.

  • You can apply only one tag to a frame.

  • Threaded text frames share a single tag, which applies to all text in the thread, including overset text.

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

  • When you tag an element within a frame with the Autotag button, InCopy automatically tags the frame using the tag specified in the Tagging Preset Options dialog box.

Tag text within a text frame

  1. Choose View > Layout View.
  2. Make sure that the text frame in which the text appears is tagged. (If the frame isn’t tagged when you try to tag text within the frame, InCopy tags the story using default tags.)
  3. Do one of the following:
    • Using the Type tool , select text within a text frame, and then click a tag in the Tags panel. If you select all of the text within the frame, the tag is applied to the frame, not to the block of text (unless you’ve selected Add Tag in the Tags panel).

    • Select the text frame, table, table cells, or image that you want to tag, and click the Autotag icon in the Tags panel to apply a default tag. (See Specify Autotag defaults.)

    • Automatically tag text to which paragraph or character styles have been applied using the Map Styles To Tags command.

Tag text in tables

When you tag a table for export to 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. Choose View > Layout View.
  2. Click in the table and choose Table > Select > Table.
  3. Select a tag for the table in the Tags panel.

    InCopy 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 tagging present options.

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

Pastaba:

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.

Tag content according to styles

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

Pastaba:

The Map Styles To Tags command tags content automatically, including paragraphs and characters that have been tagged already. To retain existing tags, apply tags manually.

  1. Choose Map Styles To Tags from the Tags panel menu or Structure pane 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 set up in an InDesign file, click Load and select the file.
  5. Select or deselect Include options:

    Master Pages Stories

    Maps styles found on the parent page to tags.

    Pasteboard Stories

    Maps styles found on stories on the pasteboard to tags. (Deselect this option to keep stories on the pasteboard from being tagged.)

    Empty Stories

    Maps styles located in empty stories to tags. (Deselect this option to keep styles on empty stories from being tagged.)

  6. Click OK.

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

Untag a page item

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

  1. Select the element in the Structure pane window, or select the page item in the document layout.
  2. Do one of the following:
    • Click Untag Element in the Structure pane menu.

    • Click the Untag button in the Tags panel.

Retag a page item

Retag an item to replace the existing tag (you don’t need to untag it first).

  1. Select the Type tool  .
  2. Do one of the following:
    • Select the text or text frame, and then click a different tag in the Tags panel.

    • Place the insertion point in a tagged text frame within a story element (not a child element). Select Retag at the top of the Tags panel, and click a different tag in the Tags panel.

    • Select the entire block of text to which a tag has been applied, select Retag at the top of the Tags panel, and click a different tag. (If you select Add Tag at the top of the Tags panel, and then click a different tag, a new child element will appear 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.

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

Pastaba:

InCopy 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, InCopy assigns the frame a tag according to the Tagging Preset Options. The capability to apply default tags helps InCopy 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.
    Pastaba:

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

Map XML tags to styles

XML tags are merely data descriptions; they carry no formatting instructions. As such, you need to format XML content after you import it and lay it out. One way to do that is to map XML tags to paragraph, character, table, or cell styles. For example, the Byline tag could be mapped to the Author character style, so that all imported and placed XML content that is tagged Byline is automatically assigned the Author character style. Mapping tags to styles makes formatting imported XML content easier and less time-consuming.

You don’t need to map every tag to a paragraph or character style. Some elements may not appear in the layout and others may be easier to format one at a time. Moreover, child elements take on the paragraph or character style that is assigned to their parent, which can cause confusion unless you are careful to map parent and child elements separately.

Pastaba:

The Map Tags To Styles command reapplies styles throughout a document, sometimes with unwanted results. When you map a tag to a style, text that was previously assigned to one style may be reassigned to another, depending on its XML tag. If you’ve already formatted some text, you might prefer to apply styles manually to prevent your paragraph and character style choices from being overridden.

  1. Choose Map Tags To Styles from the Tags panel menu or the Structure pane menu.
    A menu of styles appears for each tag in the Map Tags To Styles dialog box

  2. Do any of the following:
    • To import styles, tags, and mapping definitions from another document, click Load, choose a document, and click Open.

    • To map tags to styles individually, click the Style column adjacent to a tag, and choose a paragraph or character style from the menu that appears. (The paragraph symbol identifies paragraph styles in the menu; an “A” identifies character styles.) Repeat for each tag you want to map.

    • To automatically map tags to styles with the same names, click Map By Name. Styles with names that are identical to tag names are selected in the Style column. To match, a tag and style must not only have the same name, but the same case; H1 and h1, for example, are not considered a match. (If the same style name exists in two different style groups, Map By Name doesn’t work and you are alerted to rename one of the styles.)

  3. Click OK.

Show or hide tagged frames or tag markers

In Galley and Story views, tag markers indicate where items on a page have been tagged. In Layout view, tagged frames indicate where items such as tables and images have been tagged. The tag color determines the color of the marker or frame.

In this example, all page items are tagged except for the subhead below the title.

  1. Do any of the following:
    • To display tagged frames in color, 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.

Delete tags or elements

  • To delete a tag from the Tags panel, drag it to the Delete Tag 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 then click OK.
  • To delete all unused tags, choose Select All Unused Tags from the Tags panel menu, and click the Delete Tag icon at the bottom of the panel.
  • To delete an element from the Structure pane, select the element, and then click the Structure pane Delete icon or choose Delete from the Structure pane menu. If the element contains any content, an alert message appears. Click Untag to leave the content in the document; click Delete to delete both the element and its content.
Pastaba:

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

 Adobe

Gaukite pagalbą greičiau ir lengviau

Naujas vartotojas?

Adobe MAX 2024

Adobe MAX

The Creativity Conference

Spalio 14–16 d. Miami Beach ir internetu

Adobe MAX 2024

Adobe MAX

The Creativity Conference

Spalio 14–16 d. Miami Beach ir internetu