XML Data Island and DTD

D

Duncan

Hi there, I'm getting my feet wet experimenting with some
XML, something I haven't done before.

I created an XML Document that looks like the one below:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE CATALOG [
<!ELEMENT CATALOG (CD+)>
<!ELEMENT CD (TITLE+, ARTIST+, LABEL*)>
<!ELEMENT TITLE (#PCDATA)>
<!ELEMENT ARTIST (#PCDATA)>
<!ELEMENT LABEL (#PCDATA)>
]>

<CATALOG>
<CD>
<TITLE>Achtung Baby</TITLE>
<ARTIST>U2</ARTIST>
<LABEL>Universal</LABEL>
</CD>
</CATALOG>

My HTML code for the webpage looks like this:

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1" />
<title>Duncan's CD Collection</title>
<link rel="stylesheet" type="text/css"
href="/mainstyle.css" />
</head>

<body>
<h2 style="text-align:center;">Duncan's CD
Collections</h2>
<h5 style="text-align:center;">Made using an XML data
island, so cool.</h5>
<!--Creates the XML data island-->
<xml src="cd_catalog.xml" id="xmldso" async="false">
</xml>
<table datasrc="#xmldso" width="100%" border="1">
<thead>
<th>Title</th>
<th>Artist</th>
<th>Label</th>
</thead>
<tr align="left">
<td><span datafld="TITLE"></span></td>
<td><span datafld="ARTIST"></span></td>
<td><span datafld="LABEL"></span></td>
</tr>
</table>
</body>
</html>

My problem is that when I view the page, it creates the
table, but doesn't draw the data from the xml fine into
it. If I remove the DTD declaration however, it will fill
the cells in with the XML data. Can somebody explain this
problem to me? Does it mean that I have to make an
external DTD file for the .xml file? Thanks for your
help. Sorry for making you read all the code :)

-Duncan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top