Re: Taglib errors (again)

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Wednesday, July 14, 2010, 8:49:05 PM, Brian Pontarelli wrote:

>
> On Jul 14, 2010, at 12:41 PM, Daniel Dekany wrote:
>
>> Wednesday, July 14, 2010, 7:25:32 PM, 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?
>> [snip]
>> 
>> It's the FreeMarker JSP support that loads these XML-s, so the user
>> has no control over the XML parsing... so the issue belongs to the JSP
>> support. It seems it doesn't find the DTD or W3C Schema, which is
>> strange as those are packed with the freemarker.jar.
>> 
>> To Brian Pontarelli: This is mainly Attila's field, but maybe it would
>> be helpful if you tell how exactly that XML file starts.
>
> The errors come from all of the taglibs and web.xml file as well.
> The taglibs are pretty standard. In fact, one of them is the Apache
> JSTL implementation, which is the reference impl I think. That
> taglib TLD file starts like this (from the standard JAR from Apache):
>
> <?xml version="1.0" encoding="UTF-8" ?>
>
> <taglib xmlns="http://java.sun.com/xml/ns/j2ee"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
>     version="2.0">
>
>
> My web.xml file starts like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
>          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>          xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
>          version="2.4">
>
> Let me know if something jumps out at you.

Unfortunately, nothing. So maybe it's some problem with the default
XML parser on that server. I briefly looked at
freemarker/ext/jsp/TaglibFactory.java, and I have seen this:

        factory.setValidating(false);

So no validation against the (missing) DTD should occur, in which case
I don't understand why the XML parser tries that, and then even thinks
the root element should be "null". (At least as far as I remember,
validation against the W3C XML Schema is unaffected by
factory.setValidating and doesn't happen automatically, and
TaglibFactory doesn't invoke it either.) What happens if you add this
before the first element in web.xml:

  <!DOCTYPE web-app [
    <!ELEMENT web-app ANY>
  ]>

> Thanks,
> -bp

-- 
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
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.