Posts

Showing posts from January, 2022

How to create DTD for book details in a bookstore?

DTD(Document Type Declaration) is mainly used to describe xml.  The purpose of DTD is  to check vocabulary of the xml. It also checks the validity of the structure of XML documents. It has the syntax given below. Syntax: <!DOCTYPE element DTD identifier [   Declaration 1   Declaration 2     ………………   Declaration n   ]>   It has two types listed as follows. ·        ->  Internal DTD ·        -> External DTD First, how the internal DTD is created and used in XML is shown below… Internal DTD: This type of DTD is defined inside the XML file. We can use the above syntax here. In the XML declaration, set the standalone attribute to “yes”. The sample XML code for book store is given below.   <?xml version=”1.0” encoding=”UTF-8” standalone=”yes”?> <! DOCTYPE book [ <!ELEMENT book(name,author,publisher)> <!ELEMENT   name(#PC...

How to write your first XML program?

XML is Extensible Markup Language. It is used to create user defined tags. This is derived from SGML(Standard Generalized Markup Language). Do you like to create your own tags?? If the answer is yes, you try XML. A simple XML code is given below. It is a simple birthday message for your beloved one. < Birthday>   <Wishes>  Happy birthday  </Wishes> </Birthday>     Here, the root tag is <Birthday>. <Wishes>   is the user defined tag. This basic xml program shows you to create a root tag with elements. To create a basic program, follow the below syntax. Syntax: < ?xml version=”1.0”?> <root tag>   <element1>   </element1>                     .                     .   <elem...