Re: Taglib errors (again)

Brian Pontarelli <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
On Jul 14, 2010, at 11:25 AM, Jonathan Revusky wrote:

> On Wed, Jul 14, 2010 at 5:20 PM, Brian Pontarelli <[email protected]> wrote:
>> I've asked this question a couple of times before, but it is becoming more of a priority for me because my products use FreeMarker and these errors really freaking customers out. I need to have them turned off and before I file a bug for it or hack up FreeMarker myself, I wanted to try the list one more time.
> 
> It seems to me offhand that if you just turned off validation on the
> XML parsing, these messages would go away, wouldn't they?
> 
> All of these messages are not coming from FreeMarker, but just
> bubbling up from the XML parsing library being used.

True, but FreeMarker is creating the XML parser and using it. I don't know if I have access to that SAX parser instance.


> 
>> 
>> Here are the errors I'm seeing:
>> 
>> Warning: validation was turned on but an org.xml.sax.ErrorHandler was not
>> set, which is probably not what is desired.  Parser will use a default
>> ErrorHandler to print the first 10 errors.  Please call
>> the 'setErrorHandler' method to fix this.
> 
> Of course, if you want validation, you could get rid of this one by
> setting some ErrorHandler object.

I don't really want validation and if FreeMarker isn't setting an error handler and handling the errors appropriately it should probably turn validation off right?


>> Error: URI=jndi:/localhost/WEB-INF/web.xml Line=5: Document root element "web-app", must match DOCTYPE root "null".
>> Error: URI=jndi:/localhost/WEB-INF/web.xml Line=5: Document is invalid: no grammar found.
> 
> I guess the XML parser is not finding the DTD schema, so this relates
> to setting up the catalog file or whatever, I can't remember, so long
> since I cared at all about XML parsing....

I wonder if I could register the DTD with the SAX API. I think this might also be an instance method.


>> Warning: validation was turned on but an org.xml.sax.ErrorHandler was not
>> set, which is probably not what is desired.  Parser will use a default
>> ErrorHandler to print the first 10 errors.  Please call
>> the 'setErrorHandler' method to fix this.
>> Error: URI=jar:file:/Users/bpontarelli/dev/inversoft/cleanspeak/cleanspeak-management-interface/web/WEB-INF/lib/standard-1.1.2.jar!META-INF/c.tld Line=6: Document root element "taglib", must match DOCTYPE root "null".
>> Error: URI=jar:file:/Users/bpontarelli/dev/inversoft/cleanspeak/cleanspeak-management-interface/web/WEB-INF/lib/standard-1.1.2.jar!META-INF/c.tld Line=6: Document is invalid: no grammar found.
>> Warning: validation was turned on but an org.xml.sax.ErrorHandler was not
>> set, which is probably not what is desired.  Parser will use a default
>> ErrorHandler to print the first 10 errors.  Please call
>> the 'setErrorHandler' method to fix this.
>> 
>> Anyone know a quick method of getting rid of these?
> 
> Yeah, I think just turn off validation. That's some API hook in
> javax.xml.parsers package, isn't it?

The SAX API uses an ErrorHandler interface that is associated with the DefaultHandler sub-class passed to the parse methods. I think this is the issue. FreeMarker is setting the validation and not setting an error handler. I guess I might have to dive into the FM code for this stuff and figure out which SAX API it is using.  That is unless someone else has found a fix for this.

-bp


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.