Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble trying to link to external dtd file.

Status
Not open for further replies.

JProg

Programmer
Apr 4, 2002
88
JP
Hi Everyone,

I am doing a simple lab for Uni. This lab requires me to write out a small xml file and link a style sheet to it. I have done these things no worries. However the lab also asks me to reference an external dtd. My xml document shows up in explorer without a doctype, with an internal doctype but not with an external doctype.

The code for these files is shown below:
file -- book.xml
Code:
<?xml version="1.0"?>
<!DOCTYPE booklist SYSTEM “booklist.dtd”>
<?xml-stylesheet type="text/css" href="booklist.css" ?>
<booklist>
	<book>
		<name>Backpacker's Field Manual</name>
		<author>Rick Curtis</author>
		<publisher>Crown Publishers Inc.</publisher>
		<ISBN>0517887835</ISBN>
		<date>March 1998</date>
	</book>
	<book>
		<name>Modern Backpacker's Handbook</name>
		<author>Glen Randall</author>
		<publisher>Lyons and Burford Publishers</publisher>
		<ISBN>1558212485</ISBN>
		<date>February 1994</date>
	</book>
	<book>
		<name>Backpacker's Handbook</name>
		<author>Chris Townsend</author>
		<publisher>Ragged Mountain Press</publisher>
		<ISBN>0070653151</ISBN>
		<date>October 1996</date>
	</book>
</booklist>
file -- booklist.css
Code:
book 
{
	font-family: 	"Arial",sans-serif; 
	font-size:		10pt;
}
name 
{
	display:		block; 
	font-size: 		12pt; 
	background-color:	#ffffcc
}
author 
{
	display:		block; 
	color: 		#cc6600;
}
publisher 
{
	display:		inline; 
	color: 		navy;
}
ISBN 
{
	display:		inline; 
	color: 		blue;
}
date 
{
	display:		inline; 
	font-style:		italic; 
	color: 		navy;
}
file -- booklist.dtd
Code:
<!DOCTYPE booklist [
<!ELEMENT booklist (book+)>
<!ELEMENT book (name,author,publisher,ISBN?,date?)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT publisher (#PCDATA)>
<!ELEMENT ISBN (#PCDATA)>
<!ELEMENT date (#PCDATA)>
]>

Sorry about the amount of code included, just needed to paint the picture. Like I said this code works fine except when I try and externalize the dtd. I just don't get why it isn't working. I got the following error message from IE6
Code:
The XML page cannot be displayed 
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later. 

An invalid character was found in text content. Error processing resource 'file:///E:/Web Design 1/book.xml'. Line 2, Position 27 

<!DOCTYPE booklist SYSTEM

If anybody could help me with this small dilemma I will be greatly appreciative. Thanks

Regards

Davo



 
You've declared booklist twice: once in tour xml, and once in the dtd.
Remove
<!DOCTYPE booklist [
and the last
]>
from the dtd-file, and you'll be allright.
 
jel,

Thanks for the info, it certainly did the trick, now works like a charm. Thanks again.

Regards

Davo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top