Forum Moderators: open

Message Too Old, No Replies

Making XML+DTD valid

Probally just syntax errors?

         

JAB Creations

3:27 am on Feb 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm trying to understand the fundelmentals of XML & DTD before I jump head first in to XSLT. I'm curious to the opinions of others on what I've begun playing around on so far.

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)>