Skip to main content
Write a program to demonstrate conditional sections in DTD.
CODING:
.XML FILE:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE test SYSTEM "DHTML_XML4_4.dtd">

<book>
<title>MyBook</title>
<author>ABC</author>
<summary>Biography</summary>
<comments>Nice Book</comments>
</book>

.DTD FILE:
<!ENTITY % draft "IGNORE">
<!ENTITY % final "INCLUDE">

<![%draft;[
<!ELEMENT book (title,author,summary)>
]]>

<![%final;[
<!ELEMENT book (title,author,summary,comments)>
]]>

<!ELEMENT comments (#PCDATA)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT summary (#PCDATA)>


Comments