You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Garret Wilson <ga...@globalmentor.com> on 2004/09/19 02:39:02 UTC

using character entities and JSF XML

So I'm trying to use the &trade; character entity in a pure XML 
JavaServer faces file, and it doesn't let me, because it isn't defined. 
Fair enough; I add this:

<?xml version="1.0"?>
<!DOCTYPE jsp:root [
	<!ENTITY trade    "&#8482;" ><!-- trade mark sign, U+2122 ISOnum -->
]>
<jsp:root version="2.0"
	xmlns:jstl="http://java.sun.com/jstl/core"
	xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:jsf="http://java.sun.com/jsf/core"
	xmlns:html="http://java.sun.com/jsf/html">

I get:

org.apache.jasper.JasperException: /documents.jsp(9,44) Element type 
"jsp:root" must be declared.

I didn't know that XML required internal document types to declare the 
root element.

Strangely enough, I hit "refesh" and sometimes Tomcat 5.5.2 will show 
the *old* cached page, before I added the &trade; character entity. I 
keep hitting "refresh" and it randomly shows an error and the old cached 
page.

Garret

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: using character entities and JSF XML

Posted by Garret Wilson <ga...@globalmentor.com>.
Eric,

Eric Suen wrote:
>>I didn't know that XML required internal document types to declare the
>>root element.
> 
> see bug: http://issues.apache.org/bugzilla/show_bug.cgi?id=28207
> 
> seems tomcat guys like this stupid feature very much, even it is very easy
> add an option to disable those kind validation in production env.  I think
> the validation is necessary in developing, but in production env, for
> performance, maybe we want to disable validation, I just dont understand
> why jsp 2.0 force us to validation the xml file even it can not do it well.

Thanks so much for this helpful link! First, the <jsp:output> element is 
really cool---no more <jsf:verbatim>!

Secondly, I think I see how this whole two-step process of translating 
character entities works---I need to define a character entity with the 
ampersand escaped.

Thirdly, if I can define a DOCTYPE for my entire JSP file and stick it 
away in a file and just reference it from all my JSPs, this would be 
ultra-cool:

* I could define all my doubly-escaped character entities that I now 
realize I need.

* I can even specify the root namespace declaration attributes as 
#FIXED, so that I never have to define them.

The little problem is that I don't understand why Tomcat is requiring 
that *every* element be defined---does XML require that, if an internal 
or external DTD is present, it must define each and every element in the 
document? I didn't think so---can't one have just an external DOCTYPE 
with only character entities defined?

If this is an XML requirement, then it's the way Tomcat should go. Now I 
need to track down the official JSF and JSP element DTDs, combine them 
in one file with my doubly-escaped character entities, and I'll be ready 
to go. (Something will probably come up, though.)

Hey, wait a minute---doesn't Tomcat already tell me if certain JSF and 
JSP tags don't have attributes that the DTD requires? Where is Tomcat 
getting *that* information---is it processing some DTD in the 
background? Will my custom DTD conflict? These questions and more will 
have to be answered after I get some sleep...

Garret


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: using character entities and JSF XML

Posted by Eric Suen <er...@hotmail.com>.
> I didn't know that XML required internal document types to declare the
> root element.

see bug: http://issues.apache.org/bugzilla/show_bug.cgi?id=28207

seems tomcat guys like this stupid feature very much, even it is very easy
add an option to disable those kind validation in production env.  I think
the validation is necessary in developing, but in production env, for
performance, maybe we want to disable validation, I just dont understand
why jsp 2.0 force us to validation the xml file even it can not do it well.

Eric




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org