Go Back   CodingForums.com > :: Client side development > XML

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-29-2002, 03:27 PM   PM User | #1
brothercake
Senior Coder


 
Join Date: Jun 2002
Location: near Oswestry
Posts: 4,508
Thanks: 0
Thanked 0 Times in 0 Posts
brothercake is an unknown quantity at this point
Why is this not valid ?

Here's an excerpt from the DTD

Code:
<!DOCTYPE kar_trends [

<!ELEMENT kar_trends (subject)*>
<!ELEMENT subject (about,study)>
<!ELEMENT about (#PCDATA)>
<!ELEMENT study (#PCDATA)>

<!ENTITY coi "Captains of Industry">

<!ATTLIST study year CDATA #REQUIRED>
<!ATTLIST study season CDATA #REQUIRED>

]>

And here's a sample of the XML

Code:
<kar_trends>

	<subject>
		<about>3com</about>
		<study year="1998" season="w">&coi;</study>
	</subject>

</kar_trends>

But when I validate it I get any error message, that the STUDY element has invalid content. Huh??
brothercake is offline   Reply With Quote
Old 11-29-2002, 03:40 PM   PM User | #2
mpjbrennan
Regular Coder

 
Join Date: Jun 2002
Location: Newcastle, England
Posts: 178
Thanks: 0
Thanked 0 Times in 0 Posts
mpjbrennan is an unknown quantity at this point
what happens if you put #&coi; ?

patrick
mpjbrennan is offline   Reply With Quote
Old 11-29-2002, 04:02 PM   PM User | #3
brothercake
Senior Coder


 
Join Date: Jun 2002
Location: near Oswestry
Posts: 4,508
Thanks: 0
Thanked 0 Times in 0 Posts
brothercake is an unknown quantity at this point
same thing - invalid element content
brothercake is offline   Reply With Quote
Old 11-29-2002, 05:30 PM   PM User | #4
brothercake
Senior Coder


 
Join Date: Jun 2002
Location: near Oswestry
Posts: 4,508
Thanks: 0
Thanked 0 Times in 0 Posts
brothercake is an unknown quantity at this point
I found it! I was assuming, since the error pointed the line with that entity on it, that the entity was the issue. But no. In fact it was my fault - the DTD specifies only a single instance of <study> in each <subject>. It should have been:

Code:
<!ELEMENT subject (about,study+)>

I should have posted a more complete code sample - the sample I posted actually is valid by that DTD, but what I'm actually using, which produced the error, is like this:

Code:
	<subject>
		<about>3com</about>
		<study year="1998" season="w">&coi;</study>
		<study year="1999" season="w">&coi;</study>
		<study year="2000" season="w">&coi;</study>
		<study year="2000" season="w">&itp;</study>
	</subject>
doh thanks for the help though

Last edited by brothercake; 11-29-2002 at 05:45 PM..
brothercake is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:35 AM.


Advertisement
Log in to turn off these ads.