0
3.7kviews
What is the purpose of XML and DTD? Design DTD for address book XML document.
1 Answer
written 6.3 years ago by |
Internal DTD for Address Book XML Document
< ?xml version=’1.0′ encoding=’utf-8′? >
< !– DTD for a AddressBook.xml — >
< !DOCTYPE AddressBook [
< !ELEMENT AddressBook (Address+) >
< !ELEMENT Address (Name, Street, City) >
< !ELEMENT Name (#PCDATA) >
< !ELEMENT Street (#PCDATA) >
< !ELEMENT City (#PCDATA) >
] >
< AddressBook >
< Address >
< Name >Jeniffer< /Name >
< Street >Wall Street < /Street >
< City >New York< /City >
< /Address >
< /AddressBook >
External DTD for Address Book XML Document - The DTD for AddressBook.xml is contained in a file AddressBook.dtd. AddressBook.xml contains only XML Data with a reference to the DTD file.
< ?xml version="1.0" encoding="UTF-8"? >
< !DOCTYPE AddressBook SYSTEM "file:/// c:/XML/AddressBook.dtd dtd" > " >
< AddressBook >
< Address >
< Name >Jeniffer< /Name >
< Street >Wall Street< /Street >
< City >New York< /City >
< /Address >
< /AddressBook >