Forum Moderators: open

Message Too Old, No Replies

Xml Dtd

         

Mooncat

1:37 pm on May 1, 2008 (gmt 0)

10+ Year Member



I am a disabled student working at home. I 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, Line 21 indicated:

<?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,foliage,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>

Can you point me in the right direction, please.

cmarshall

1:59 pm on May 1, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld!

I'm a little confused. This is a DTD document. You mention XSL and CSS.

I'm not a DTD expert, and it can probably be figured out quickly, but I'm not sure if that's really the problem.

Mooncat

2:24 pm on May 1, 2008 (gmt 0)

10+ Year Member



The XML validator indicates a problem with the DTD, It was working until I added the code to include the image. The CSS is fine, shall I upload it?

httpwebwitch

3:06 pm on May 1, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm sure the html: namespace is the culprit - something isn't defined right, or it's clashing with the "html" element which is also defined in the DTD.

This is a technique I use *maybe* a few times a year if that, and I always have to look up the proper syntax+usage. If you don't find the solution soon, ping back in here and I'll take a closer look.

Mooncat

5:00 pm on May 5, 2008 (gmt 0)

10+ Year Member



So far, I have still not been able to get images just as I want to position them. I found a site which creates a dtd from your markup, elements are organised in an inverted list but it does give a useful idea about creating your own. However, the images are still the main problem. I learned too late that Firefox is not as suitable with CSS as IE.

Is there an alternative to class.one class.two etc to have two content panels side by side, with text in one, and image in the other?

The center formatting instruction doesn't work, is there an alternative?

I have uploaded all the files to a free sub-domain to see how it works online. If you want to see it, please ask.

cmarshall

5:45 pm on May 5, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I learned too late that Firefox is not as suitable with CSS as IE.

I'm not sure where you learned that. IE is ALWAYS the skunk at the CSS picnic. It is so bad that entire Web sites have been devoted to documenting its flagrant disregard for CSS. I'm told that IE8 will finally support Acid Test 2 [webstandards.org] (but not Acid Test 3 [webstandards.org]).

(For the record, FF also fails Acid 2, and don't even THINK about Acid 3).

I think that Opera, iCab and Safari are the only browsers that currently pass Acid 2, and FF 3 will as well.

Acid 3? Forget it. I don't think one single browser passes that.

Is there an alternative to class.one class.two etc to have two content panels side by side, with text in one, and image in the other?

The center formatting instruction doesn't work, is there an alternative?

I have uploaded all the files to a free sub-domain to see how it works online. If you want to see it, please ask.

You are asking CSS questions in an XML forum. You may find more answers in the CSS Forum [webmasterworld.com].

In any case, easy-peasy to do. Use the float property [w3schools.com] to do it.