InDesign

TOPIC APPEARS IN:

Use DTD files to validate XML

Validating the XML in a document means to compare the structure, element tag names, and attributes against the specifications of a DTD file. To validate against a DTD file, you must first load it into your document.

Note: Loading a DTD file imports tag names into the Tags panel. These imported tag names are locked; they can’t be deleted or renamed except by deleting the DTD file from the document.

The DOCTYPE element appears at the top of the Structure pane if a DTD file has been loaded into your document. (DTDs are sometimes loaded automatically when you import an XML file.) To replace the DTD file in a document, delete the existing DTD and then load a new one.

Working with DTD files in InDesign

A.
DOCTYPE element from the DTD file (Structure pane)

B.
Locked tag from an the DTD file (Tags panel)

Load a DTD file

When you load a DTD file, InDesign embeds the file in the document.

  1. Do one of the following:
    • In the Structure pane, choose Load DTD from the Structure menu.

    • In the Tags panel, choose Load DTD from the menu.

  2. Select a DTD file to import, and click Open.
    To view tags defined in the DTD file, open the Tags panel by choosing Window > Tags.

View a DTD file in InDesign

DTDs are written in ASCII text. They may contain embedded instructions and explanations that describe how to apply tags and order elements correctly. In InDesign, you can only view a DTD that is loaded in a document.

DTD file opened for viewing in InDesign

 Do one of the following:.
  • In the Structure pane menu, choose View DTD.

  • Double-click the DOCTYPE element in the Structure pane.

To print a DTD file, copy code from the View DTD window and paste it in a text editor.

Delete a DTD file

 Choose Delete DTD from the Structure pane menu.

InDesign deletes the copy of the DTD file stored in the InDesign document, not the original DTD file. Tags that were imported with the DTD file remain in the Tags panel but are unlocked.

Validate XML structure

When you validate your document, InDesign alerts you if the XML deviates from rules established by the DTD file. It suggests ways to make the XML meet DTD file requirements. You can fix errors one at a time or view all errors in a separate window.

Structure pane with Suggestions pane

A.
Loaded DTD

B.
Error or invalidating condition

C.
Description of error with suggested fix

D.
Error count

E.
Validate button

F.
View all errors in a separate window

  1. Choose View > Structure > Show Structure.
  2. In the Structure pane, click the Validate button .
    To change the root element from which InDesign validates, choose DTD Options in the Structure pane menu.
  3. To fix errors displayed in the Suggestion pane, either click a suggested fix to try it, or edit the XML structure and tags directly using the Structure pane and the Tags panel.
  4. To view other errors, do one of the following:
    • Click the left arrow  or right arrow .

    • Click the error window button  to view all errors in a separate window.

    • Choose View List Of Errors on the Structure pane menu.

Note: InDesign stops validating after detecting 250 errors. A plus sign in the Error Count box appears when this limit is reached.