Page 1 of 1

XML DTD problem

Posted: Fri May 02, 2008 12:03 pm
by HairyHarry (imported)
! am creating a website with 10 pages, each with its own separate stylesheet, 6 XSL and 4 CSS. It was OK until I try to add images and a table of links. The XML validator informs me of an error on line 21. The CSS validates OK. Here is the code, I am not sure what the attributes of the photo element are. (I've put the <code></code> tags in to stop it activating here)

<code>

<?xml version="1.0" encoding="ISO-8859-1"?>

<?xml-stylesheet type="text/css" href="trees.css"?>

<!DOCTYPE trees[

<!ELEMENT trees (tree)+>

<!ELEMENT tree (common_name,latin_name,origin,type,flower,fruit,f oliage,size,photo,table,LINK)>

<!ELEMENT common_name (#PCDATA)>

<!ELEMENT latin_name (#PCDATA)>

<!ELEMENT origin (#PCDATA)>

<!ELEMENT type (#PCDATA)>

<!ELEMENT flower (#PCDATA)>

<!ELEMENT fruit (#PCDATA)>

<!ELEMENT foliage (#PCDATA)>

<!ELEMENT size (#PCDATA)>

<!ELEMENT photo (#PCDATA)>

<!ATTLIST photo source CDATA #REQUIRED

a CDATA #REQUIRED

img CDATA #REQUIRED

alt CDATA #IMPLIED>

<!ELEMENT html (#PCDATA)>

<!ATTRIBUTE html xmlns CDATA #REQUIRED Line 21

html CDATA #REQUIRED

img CDATA #REQUIRED>

<!ELEMENT table (tr,th1,th2,td)>

<!ATTLIST table tr CDATA #REQUIRED

a href CDATA #REQUIRED

th1 CDATA #REQUIRED

th2 CDATA #REQUIRED

td CDATA #REQUIRED

a CDATA #REQUIRED>

<!ELEMENT LINK (#PCDATA)>

<!ATTLIST LINK VALUE CDATA #REQUIRED>

]>

<trees>

<tree>

<common_name>Common name:Mountain Ash, Rowan</common_name>

<latin_name>Latin name:Sorbus aucuparia</latin_name>

<origin>Origin:Europe, Asia</origin>

<type>Type:Deciduous</type>

<flower>Flower:pale, insignificant</flower>

<fruit>Fruit:Red berries</fruit>

<foliage>Leaves:Dark green above, blue-green below, turning red in autumn</foliage>

<size>Size:15M height, 7M spread</size>

<photo><html:img xmlns:html="http://www.w3.org/TR/REC-html40"

src="m ash.jpg" alt="Mountain Ash"/></photo>

</tree>

<table>

<tr>

<th1><td>Links to the other pages</td></th1>

</tr>

<tr>

<th2><td><a href="boats.xml">Boats</a></td></th2>

<th2><td><a href="books.xml">Books</a></td></th2>

<th2><td><a href="cars.xml">Cars</a></td></th2>

<th2><td><a href="CDs.xml">CDs</a></td></th2>

<th2><td><a href="countries.xml">Countries</a></td></th2>

</tr>

<tr>

<th2><td><a href="family.xml">Family</a></td></th2>

<th2><td><a href="football.xml">Football</a></td></th2>

<th2><td><a href="houses.xml">Houses</a></td></th2>

<th2><td><a href="tools.xml">Tools</a></td></th2>

<th2><td><a href="trees.xml">Trees</a></td></th2>

</tr>

</table>

</trees></code>

Can you point me in the right direction, please.

Re: XML DTD problem

Posted: Fri May 02, 2008 3:50 pm
by Paolo
Keep in mind that the use of the ":" character with some letters triggers smilies to pop up.

Re: XML DTD problem

Posted: Sat May 03, 2008 7:43 am
by HairyHarry (imported)
Good point, Paolo, I hadn't seen that happen before, but I'll change a bit of the text.