explain dtd and write the coding also...
Answers
Syntax
Basic syntax of a DTD is as follows −
<!DOCTYPE element DTD identifier
[
declaration1
declaration2
........
]>
In the above syntax −
DTD starts with <!DOCTYPE delimiter.
An element tells the parser to parse the document from the specified root element.
DTD identifier is an identifier for the document type definition, which may be the path to a file on the system or URL to a file on the internet. If the DTD is pointing to external path, it is called external subset.
The square brackets [ ] enclose an optional list of entity declarations called internal subset.
Internal DTD
A DTD is referred to as an internal DTD if elements are declared within the XML files. To reference it as internal DTD, standalone attribute in XML declaration must be set to yes. This means the declaration works independent of external source.
Syntax
The syntax of internal DTD is as shown −
<!DOCTYPE root-element [element-declarations]>
where root-element is the name of root element and element-declarations is where you declare the elements.
Example
Following is a simple example of internal DTD −
<?xml version = "1.0" encoding = "UTF-8" standalone = "yes" ?>
<!DOCTYPE address [
<!ELEMENT address (name,company,phone)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT company (#PCDATA)>
<!ELEMENT phone (#PCDATA)>
]>
<address>
<name>Tanmay Patil</name>
<company>TutorialsPoint</company>
<phone>(011) 123-4567</phone>
</address>
Answer:
DTD :-
A DTD is a Document Type Definition.
A DTD defines the structure and the legal elements and attributes of an XML document.
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE note SYSTEM "Note.dtd">
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE note SYSTEM "Note.dtd"><note>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE note SYSTEM "Note.dtd"><note><to>Tove</to>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE note SYSTEM "Note.dtd"><note><to>Tove</to><from>Jani</from>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE note SYSTEM "Note.dtd"><note><to>Tove</to><from>Jani</from><heading>Reminder</heading>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE note SYSTEM "Note.dtd"><note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</body>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE note SYSTEM "Note.dtd"><note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note>
Explanation:
hiiii mate
hope this helps you ✌️✌️
please mark me as braienliest
✌️✌️❤️❤️✌️✌️