You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ludovic Maitre <Lu...@fr.oleane.com> on 2003/01/20 13:48:38 UTC

Sample test case : Unresolved entities in included JSP file

Hello,
My first mail wasn't very clear, a simple test case follow.

Sample test case
----------------

File test_include.jsp :
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE toto [
	<!ENTITY nbsp  "&#160;">
]>

<jsp:root
	xmlns:jsp="http://java.sun.com/JSP/Page"
	version="1.2">
<div>
     <p>&nbsp;</p>
	<jsp:directive.include file="test_included.jsp"/>
</div>
</jsp:root>

File test_included.jsp :
<p>&nbsp;</p>

When i access to test_include.jsp :

XML Parsing Error: undefined entity
Location: http://localhost:8080/test_include.jsp
Line Number 1, Column 17:
<div><p> </p><p>&nbsp;</p></div>
----------------^

If somebody has an idea thanks per advance.
Regards,
Ludo

Ludovic Maitre wrote:
> Hello,
> 
> I have a JSP 1.2 page who include some french character like &ocirc; .
> 
> The problem is that i have added the entity ocirc; to the dtd of my JSP 
> and it seems that the DTD doesn't apply to the JSP files included from 
> this page.
> 
> I have the following pages :
> index.jsp
> recherche.jsp
> 
> My index.jsp page is written in JSP 1.2 with XML syntax and include a 
> declaration of the JSP1.2 DTD :
> <?xml version="1.0" encoding="iso-8859-1"?>
> <!DOCTYPE root PUBLIC "-//Sun Microsystems Inc.//DTD JavaServer Pages 
> Version 1.2//EN"
>  "http://localhost:8080/awrgfa/dtd/jspxml.dtd">
> 
> The JSP 1.2 DTD come from the website of Sun (it's annotated "DTD for 
> JSP 1.2 thanks to Bob Foster, WebGain") and i use a modified version 
> locally who include the following last lines :
> <!ENTITY % ISOLat1 SYSTEM "http://localhost:8080/awrgfa/dtd/latin1.dtd" >
> %ISOLat1;
> 
> the file latin1.dtd contain lines like :
> 
> <!ENTITY ocirc "&#244;">
> 
> (the normative syntax, used on the W3C website, is :<!ENTITY ocirc CDATA 
> "&#244;">. It doesn't work and trigger  :
> 
> org.apache.jasper.JasperException: 
> http://localhost:8080/awrgfa/dtd/latin1.dtd(12,18) OpenQuoteMissingInDecl
> 
> I don't know why, i think it concern the people of Xerces)
> 
> So after this little work, my JSP page can contain HTML entities 
> references like  &ocirc;.
> 
> The problem is that i include the menu to the JSP page with an include 
> directive in index.jsp :
> <jsp:root
>     xmlns:jsp="http://java.sun.com/JSP/Page"
>     version="1.2">
> 
> <html xmlns="http://www.w3.org/1999/xhtml">
> 
> <head><title>H&ocirc;tes</head>
> 
> <body link="#000000" vlink="#333333" alink="#000000" leftmargin="0" 
> topmargin="0">
> ...
>     <jsp:directive.include file="/pages/menu.jsp"/>
> ...
> </body>
> </html>
> </jsp:root>
> 
> The file /pages/menu.jsp is only a fragment of XHTML, he has a reference 
> to the entity icirc; :
> <form>
> ...
> <option>H&ocirc;tes</option>
> ...
> </form>
> 
> The problem is that this entity is unresolved at compilation :
> 
> XML Parsing Error: undefined entity
> Location: http://localhost:8080/awrgfa/pages/modele.jsp
> Line Number 10, Column 37:                <option>H&ocirc;tes</option>
> ------------------------------------^
> 
> So my questions are :
> 1 - why the DTD defined in the document who include the others isn't 
> applicable to the included documents ?
> 2 - Who is responsible for this bug (if this is a bug) : Xerces ? Jasper 
> ? Me ?
> 
> So thanks per advance for any answer and  best regards,


-- 
Ludovic Maître

Factory Productions                 | Tél: (33) 04 93 07 08 00
149, avenue des mimosas             | Fax: (33) 04 93 07 04 02
06700 Saint-Laurent-du-Var (France) | Web: http://www.factory.fr




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>