[kaffe] Problem with Strings/Xml Parsing while trying to run an embedded Jetty

Ito Kazumitsu kaz at maczuka.gcd.org
Thu Oct 20 02:46:52 PDT 2005


Hi,

From: Rafael Teixeira <monoman at gmail.com>
Date: Wed, 19 Oct 2005 21:22:13 -0200

> I think you've found the right spot on my second problem. Thank you
> for your time: I will set org.mortbay.xml.XmlParser.NotValidating to
> true, as the web application is fixed and embedded in the same big jar
> as jetty and all the other components.

That will be nice.

I said,

> > I am afraid gnu.xml package is not mature enough as a validating
> > XML parser.  Much work will be needed to make it stable.

> > Switching the SAX parser to xerces solves the problem. So I think
> > the problem exists in gnu.xml package.

But a further study indicates that the XML validation of gnu.xml
is not necessarily wrong.  The problem is that Jetty 5.1 has
gone beyond the point gnu.xml can reach.

Let's look at org/mortbay/jetty/servlet/webdefault.xml.

Jetty 4.2 had this:

| <?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
| 
| <!-- ===================================================================== -->
| <!-- This file contains the default descriptor for web applications.       -->
| ...
| <web-app>

It was a valid document according to the DTD web-app_2_3.dtd.

But now Jetty 5.1 has this.

| <?xml version="1.0" encoding="ISO-8859-1"?>
| 
| <!-- ===================================================================== -->
| <!-- This file contains the default descriptor for web applications.       -->
| ...
| <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">

The DTD has gone.  So a normal validating XML parser cannot help but
treat this as an invalid document. The error of "Element type 'web-app'
was not declared" occurred not on your web.xml file but on Jetty's
webdefault.xml file.

Jetty has chsen to use XML Schema instead of DTD, but gnu.xml's
XML Schema support is still being worked on.




More information about the kaffe mailing list