DTD Basics   «Prev 

Steps involved for creating a DTD

What are the steps involved for creating a DTD?

Mechanics of Creating a DTD

The steps needed to create an internal DTD
1) The inventory item "XML document" should describe at least one inventory item.

In this Simulation, we will go through the steps needed to create an internal DTD for XML document shown here.
Each inventory item has <ITEM-NAME>, <ITEM-SERIAL-NUMBER>, and <QUANTITY-ON-HAND> -element that must be present in that order.
Create DTD Mechanism
2) Each one of the item elements may only contain parsed character data. The next step is shown in the following slide.

Inventory Iterms
3) <!DOCTYPE INVENTORY-ITEMS [

To begin, you will define a document type declaration that specifies <INVENTORY-ITEMS> as the root element.
Type <!DOCTYPE INVENTORY-ITEMS [ and press Enter.
The root element should contain at least one inventory
4) The root element should contain at least one inventory <ITEM> element. Use the DTD symbol + to indicate one or more elements.
Type <!ELEMENT INVENTORY-ITEMS (ITEM)+> and press Enter.

Use the DTD symbol
5) An <ITEM> should contain <ITEM-NAME>, <ITEM-SERIAL-NUMBER>, and <QUANTITY--ON-HAND>, in that order.
Type <!ELEMENT ITEM (ITEM-NAME,ITEM-SERIAL-NUMBER,QUANTITY-ON-HAND)> and press Enter.

Use the DTD symbol
6) <ITEM-NAME> should contain only parsed character data.
Type <!ELEMENT ITEM-NAME (#PCDATA)> and press Enter.

ITEM-SERIAL-NUMBER
7) <ITEM-SERIAL-NUMBER> should contain only parsed character data.
Type <!ELEMENT ITEM-SERIAL-NUMBER (#PCDATA)> and press Enter.

XML PC Data
8) <QUANTITY-ON-HAND> should contain only parsed character data.
Type <!ELEMENT QUANTITY-ON-HAND (#PCDATA)> and press Enter.

DOC Type inventory iterms
9) Complete the <!DOCTYPE> declaration by typing ]> and press Enter.

This completes the Simulation. Click the Exit button.<