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