XML-DTD

Write an XML file which will display the Book information which includes the following:
1. Title of the book
2. Author Name
3. ISBN number
4. Publisher name
5. Edition
6. Price
Write a Document Type Definition (DTD) to validate the above XML file.

book.dtd
<!ELEMENT BOOK-INFO (title,author,isbn,publisher,edition,price)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT isbn (#PCDATA)>
<!ELEMENT publisher (#PCDATA)>
<!ELEMENT edition (#PCDATA)>
<!ELEMENT price (#PCDATA)>

book.xml
<?xml version="1.0" ?>
<!DOCTYPE BOOK-INFO SYSTEM "book.dtd">
<BOOK-INFO>
<title>Web Programming</title>
<author>Chris Bates</author>
<isbn>1234-5678-9012</isbn>
<publisher>Wiley</publisher>
<edition>2nd edition</edition>
<price>RS. 350</price>
</BOOK-INFO>

No comments:

Post a Comment

Total Pageviews