Importing and Creating XML Tags


Chances are that most of the time, you'll be exporting InDesign documents for use in XML databases, such as converting a publication's articles into a structured format used by a Web site's content management system. To export content properly, you need to apply tags to it. In InDesign, you can do that directly or by having InDesign translate style tags into XML tags. You'll use both methods , since some content (such as images) wouldn't have style tags associated to them but need XML tags for proper processing in an XML database.

Those tags come from two sources: They're imported from a file provided by the Web site's content engineer, or they're created in InDesign by the page designer. Most of the time, you should use tags created by the content engineer, since that engineer is creating a standard set of tags for multiple page designers (both print- and Web-based). You might create your own tags when helping develop the initial tags in concert with that content engineer ‚ or if you also are the content engineer, as well as page designer.

Importing tags

There are two places where you import tags: the Tags pane (Window Tags) and the Import XML dialog box (File Import XML). In the Tags pane, shown in Figure 34-1, you use the Load Tags option in the pane's palette menu to import tags from an XML file or an InDesign document that has tags defined in it. All tags are imported when you choose Load Tags.


Figure 34-1: The Tags pane.

The other way to import XML tags is to choose File Import XML, which imports not only XML tags but also XML content from an XML file. This process works two ways, depending on how your document is set up:

  • If your document has no content, importing an XML file adds the XML tags to the Tags pane and into the document's Structure window (covered later in this chapter). It also adds the content to the Structure pane, where you can drag it into InDesign frames in your layout.

  • If your document has content, importing an XML file brings in the content to your document and places it in frames in your document that have the same tags already applied. This is a way to automatically populate a layout in InDesign.

    Caution ‚  

    Be careful: The order of the tags in the XML file's tags definitions is important. If the XML file has three tags ‚ defined in the order of Body, Head, and Caption ‚ but the Structure pane in InDesign lists them in the order Head, Body, and Caption, InDesign will import only Body and Caption content. That's because it imports Body first and then looks for the first occurrence of the Body tag in the InDesign file. It then begins matching style tags at that point. Since Head was listed in InDesign before Body, Head is ignored. (All the tags will be in the Structure pane, so you can manually place the imported Head content.)

Creating tags

You also create XML tags in the Tags pane using the New Tag palette menu. A tag simply consists of the tag name and the tag color ‚ its formatting is defined in the XML database or in a DTD file.

Mapping tags and styles

In the Tags pane's palette menu, you can also map style tags to XML tags and vice versa using the Map Tags to Styles menu option and the Map Styles to Tags menu option, respectively. (They're also available in the Structure pane's palette menu.) Figure 34-2 shows the Map Tags to Styles dialog box; the Map Styles to Tags dialog box is nearly identical, except the two columns are switched. Here's what they do:

  • Map Tags to Styles tells InDesign what XML tag to substitute for a specified character or paragraph style during XML export. The text retains its original InDesign style tags.

  • Map Styles to Tags tells InDesign to immediately replace the specified style sheets with the XML tags. You'll see colored brackets around each string of text (paragraphs for paragraph styles and text selections for character styles) to indicate the text has an XML tag applied to it. The color corresponds to the tag color in the Tags pane. (You can change tag colors, as well as the tag name, using the Tag Options menu in the pane's palette menu or simply by double-clicking the tag name in the pane.)

    New Feature ‚  

    The ability to map character styles to tags and to map tags to character styles is new in InDesign CS

    Note ‚  

    InDesign checks to make sure that you include valid XML tag names according to XML standards. If you include a space or an illegal character in the tag name, an alert message appears when you click OK.


Figure 34-2: The Map Tags to Styles dialog box.



Adobe InDesign CS Bible
Adobe InDesign CS3 Bible
ISBN: 0470119381
EAN: 2147483647
Year: 2003
Pages: 344
Authors: Galen Gruman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net