PDA

View Full Version : Error In Text Element Has Newbie Confused


babochka
03-29-2005, 01:25 PM
To Life Immortal

Hello this is my first posting at CodingForums and I have a problem.

I am teaching myself XML. I am creating a webpage located at http://home.earthlink.net/~babochka2a/theosis/games.xml

The first time I ran it through IE, I got a DTD error because I used a single quote at the end of an ATTLIST

Another error was that I forgot to put a + at the end of a repeating element.

After fixing those errors, another one has appeared, but I dont know how to fix it. The code is the following:

<?xml version="1.0" encoding="windows-1252" standalone="yes" ?>
<!--
open the DOCTYPE declaration
the open square bracket indicates an internal DTD
-->
<!DOCTYPE games [
<!--
define the internal DTD
games must contain 1 child element
-->
<!ELEMENT games (text)>
<!--
text must contain 8 child elements in the order listed
-->
<!ELEMENT text (opening, title, subtitle, gamename+, navilinks, credits, footer, signat)>
<!--
the elements listed below may only contain text that is not markup
-->
<!ELEMENT opening (#PCDATA)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT subtitle (#PCDATA)>
<!ELEMENT gamename (ANY)>
<!ATTLIST gamename
ACTUATE (AUTO|USER) "USER"
BEHAVIOR CDATA #IMPLIED
CONTENT-ROLE CDATA #IMPLIED
CONTENT-TITLE CDATA #IMPLIED
HREF CDATA #REQUIRED
INLINE (TRUE|FALSE) "TRUE"
ROLE CDATA #IMPLIED
SHOW (REPLACE|EMBED|NEW) "REPLACE"
TITLE CDATA #IMPLIED
XML-LINK CDATA #FIXED "SIMPLE">
<!ELEMENT navilinks (#PCDATA)>
<!ELEMENT credits (#PCDATA)>
<!ELEMENT footer (#PCDATA)>
<!ELEMENT signat (#PCDATA)>
<!--close the DOCTYPE declaration-->
]>
<games>
<text>
<opening>
To Life Immortal!<br />
The Pascha Family Presents:<br />
</opening>
<title>
The Games We Play.
</title>
<subtitle>
Yahoo! Games List.
</subtitle>
<gamename href="bridge.xml" title="contract bridge notes">bridge</gamename>
<gamename href="canasta.xml" title="canasta notes">canasta<a/>
<gamename href="chess.xml" title="chess notes">chess</gamename>
<gamename href="dominoes.xml" title="dominoes notes">dominoes</gamename>
<gamename href="euchre.xml" title="euchre notes">euchre</gamename>
<gamename href="gofish.xml" title="go fish notes">go fish</gamename>
<gamename href="literati.xml" title="literati notes">literati</gamename>
<gamename href="mah jongg.xml" title="mah jongg notes">mah jongg</gamename>
<gamename href="pinochle.xml" title="pinochle notes">pinochle</gamename>
<gamename href="sheepshead.xml" title="sheepshead notes">sheepshead</gamename>
<gamename href="spades.xml" title="spades notes">spades</gamename>
<navilinks>
link query.
link query.
</navilinks>
<credits>
Credits go here.
</credits>
<footer>
wiggle feet.
</footer>
<signat>
tesing testing 1 2 3.
</signat>
</text>
</games>


When I run it through IE I get:
</text> error. I'm guessing that something is wrong with the text element.

Thanks in advance
Babochka

Alex Vincent
03-29-2005, 04:25 PM
<gamename href="canasta.xml" title="canasta notes">canasta<a/>


The end tag doesn't match. :)

Also, your ATTLIST attribute declarations are in uppercase (HREF), so the attributes need to be as well.

babochka
03-30-2005, 06:18 PM
To Life Immortal

Thanks for your help Alex. I have made changes to the code and it works now. I have another question, but I will place it in another thread.

Peace and Long Life :cool:
бабочка