Forum Moderators: open
I'm avoiding attributes right now according the w3schools website. My main concern is validation and if I'm setting up my DTD correctly. Also have I made my DTD delcaration correctly or? If only there was a full fledged yet simple example on the net someplace.
Is CDATA correct for when I want to have an alphanumerical value? I want to eventually use this for an RSS feed though I'm just trying to understand the DTD for the most part right now in order to ensure this validates.
Anyway here is the code ...
** example.xml **
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE "example.dtd"><item id="item_02">
<title></title>
<date></date>
<head></head>
<body></body>
</item><item id="item_01">
<file type="gif">matrix.gif</file>
<title></title>
<date></date>
<head></head>
<body></body>
</item>
** example.dtd **
<!ATTLIST item id "CDATA">
<!ELEMENT title (#PCDATA)>
<!ELEMENT date (#PCDATA)>
<!ELEMENT head (#PCDATA)>
<!ELEMENT body (#PCDATA)>