File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes jsp xml dtd problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp xml dtd problem" Watch "jsp xml dtd problem" New topic
Author

jsp xml dtd problem

Brendan Kennedy
Ranch Hand

Joined: May 02, 2001
Posts: 65
Hey
I have the following xml file :-
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topics PUBLIC "topics.dtd"
"http://www.redbrick.dcu.ie/~keno/topics.dtd">
<topics>
<topic title="My Idea" filename="idea"/>
<topic title="My music" filename="music"/>
<topic title="My film" filename="film"/>
<topic title="My book" filename="book"/>
</topics>
It works grand if I open it up in internet explorer but if I use it
in my jsp :
<%@ taglib uri="topics.xml" prefix="tl" %>
I get the following error:
org.apache.jasper.JasperException: XML parsing error on file /topics.xml:
Invalid PUBLIC ID: topics.dtd
I've tried loads of different ways of writing the doctype tag but I think it
just comes down to me not knowing the one that the jsp expects.
Anyways, any help greatly appreciated,
Keno
--
"Every technomage knows the fourteen words that will make someone
fall in love with you forever, but she only needed one."
--Galen,Crusade
http://www.redbrick.dcu.ie/~keno/servlet/testxslserv
Sean MacLean
author
Ranch Hand

Joined: Nov 07, 2000
Posts: 621
My guess is that IE is ignoring the DTD because it can't find it, so it just displays the XML. The jaser parser is probally failing because of an issue with the DTD. For instance, I tried going to the url specified and it failed to load. This might be the issue.
Sean
Shawn Bayern
Author
Ranch Hand

Joined: May 06, 2002
Posts: 160
Originally posted by Brendan Kennedy:

org.apache.jasper.JasperException: XML parsing error on file /topics.xml:
Invalid PUBLIC ID: topics.dtd

Indeed, this is the error. You might mean for topics.dtd to be a SYSTEM id.


Shawn Bayern<br />"JSTL in Action" <a href="http://www.jstlbook.com" target="_blank" rel="nofollow">http://www.jstlbook.com</a>
Brendan Kennedy
Ranch Hand

Joined: May 02, 2001
Posts: 65
Thanks for replies,
but if I put a SYSTEM id, ie :
<!DOCTYPE topics SYSTEM "topics.dtd">
I get an error :
org.apache.jasper.JasperException: XML parsing error on file /topics.xml: Invalid PUBLIC ID: null
I am able to access http://www.redbrick.dcu.ie/~keno/topics.dtd through internet explorer, but it gives an error like it's trying to process it as a straight xml document :
Cannot have a DTD declaration outside of a DTD
Here is the DTD:
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.3 (http://www.xmlspy.com) by mike (altova) -->
<!--DTD generated by XML Spy v4.3 (http://www.xmlspy.com)-->
<!ELEMENT review EMPTY>
<!ATTLIST review
title CDATA #REQUIRED
filename CDATA #REQUIRED
>
<!ELEMENT topic (review+)>
<!ATTLIST topic
title CDATA #REQUIRED
filename CDATA #REQUIRED
>
<!ELEMENT topics (topic+)>

As you can see I generated it through xml spy, however I changed it so as that I could have any value of the given attributes instead of the ones in topics.xml. I've set it to 755 in my public_html dir (solaris). I have the latest servlet.jar, and our version of tomcat can't be more than a few months old.
I really don't know what the problem is because I got my example straight from java.sun.com If I don't use a dtd at all the public id returns null :/
Hope this info helps,
thanks,
Keno
--
"Every technomage knows the fourteen words that will make someone
fall in love with you forever, but she only needed one."
--Galen,Crusade
http://www.redbrick.dcu.ie/~keno/servlet/testxslserv
Shawn Bayern
Author
Ranch Hand

Joined: May 06, 2002
Posts: 160
Originally posted by Brendan Kennedy:
Thanks for replies,
but if I put a SYSTEM id, ie :
<!DOCTYPE topics SYSTEM "topics.dtd">
I get an error :
org.apache.jasper.JasperException: XML parsing error on file /topics.xml: Invalid PUBLIC ID: null
[/URL]

Use the correct PUBLIC id for a tag-library descriptor, and don't bother with a SYSTEM id. That is, begin the file as follows:

[ May 27, 2002: Message edited by: Shawn Bayern ]
 
wood burning stoves
 
subject: jsp xml dtd problem