Re: Error messages from TagLibFactory xml validation...
Attila Szegedi <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Now, this is curious -- I was under impression that not setting an
error handler will simply cause a SAXParserException on the first
validation problem. But if not, then yeah, we can remedy it by adding
an error handler that'll do precisely that.
Attila.
On 2008.03.20., at 15:48, Newman, John W wrote:
> Hi guys,
>
> For about 6 months I have been on a quest to find the source of this
>
> 13:38:17,393 ERROR [STDERR] Warning: validation was turned on but an
> org.xml.sax.ErrorHandler was not
> 13:38:17,393 ERROR [STDERR] set, which is probably not what is
> desired.Parser will use a default
> 13:38:17,393 ERROR [STDERR] ErrorHandler to print the first 10
> errors. Please call
> 13:38:17,393 ERROR [STDERR] the 'setErrorHandler' method to fix this.
> 13:38:17,393 ERROR [STDERR] Error:URI=jndi:/localhost/dosimetry/WEB-
> INF/web.xml Line=6: Document root
> element "web-app", must match DOCTYPE root "null".
> 13:38:17,393 ERROR [STDERR] Error:URI=jndi:/localhost/dosimetry/WEB-
> INF/web.xml Line=6: Document is
> invalid: no grammar found.
> 13:38:17,409 ERROR [STDERR] Warning: validation was turned on but an
> org.xml.sax.ErrorHandler was not
> 13:38:17,409 ERROR [STDERR] set, which is probably not what is
> desired.Parser will use a default
> 13:38:17,409 ERROR [STDERR] ErrorHandler to print the first 10
> errors.Please call
> 13:38:17,409 ERROR [STDERR] the 'setErrorHandler' method to fix this.
>
> There’s also more complaining about some tld…
>
> ? I thought it was my code, something off with web.xml or the
> stripes framework, or even something with jboss or tomcat. Turns
> out it is actually from
>
> public class TaglibFactory implements TemplateHashModel {
>
> private static void parseXml(InputStream in, String url,
> DefaultHandler handler) throws
> ParserConfigurationException,
> IOException, SAXException {
> InputSource is = new InputSource();
> is.setByteStream(in);
> is.setSystemId(url);
> SAXParserFactory factory = SAXParserFactory.newInstance();
> factory.setNamespaceAware(false);
> factory.setValidating(true);
> XMLReader reader = factory.newSAXParser().getXMLReader();
> reader.setEntityResolver(new LocalTaglibDtds());
> reader.setContentHandler(handler);
> reader.parse(is);
> }
> }
>
> setValidating(false) suppresses the messages, but I don’t know if
> that’s what we want. Does anybody know what the correct settings
> are here? I think the answer is in
> http://xerces.apache.org/xerces2-j/features.html .. I have 0
> knowledge about xml (in a way I think that’s good) so I don’t know
> where to start. Any ideas what this really should look like?
>
>
> The top of my web .xml is
>
> <?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">
>
> no doctype, and if I put one in there nothing works. The top of the
> tld it complains about is
>
> <?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">
>
> Thanks!
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/