tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject Re: WEB.XML file parsing
Date Mon, 02 Jul 2007 02:28:15 GMT

"Andrew Friebel" <andrewf@reynolds.com.au> wrote in message 
news:007d01c7bc4a$34a83870$9df8a950$@com.au...
>I am having trouble parsing a web.xml file using SAX.  The war file will
> deploy with no hassles, however, I am writing a local program that will
> allow me to change the web.xml file locally before distribution.
>
>
>
> My problem is the DTD definition in the web.xml file.  I require the DTD
> file definition, yet when I try and parse the file with the DTD 
> definition,
> I keep getting a connection timeout error.  When I remove the DTD
> definition, the file is parsed with no issues.
>
>

You are a bit sparse on details for how you are doing this and versions, but 
assuming that you are using SAX, you need to set and EntityResolver that 
does something like (for 5.5):

    public ImputSource resolveEntity(String pubid, String sysid) throws 
IOException{
         if("-//Sun Microsystems, Inc.//DTD Web Application 
2.3//EN".equals(pubid)) {
              InputStream is = 
getClassloader().getResourceAsStream("/javax/servlet/resources/web-app_2_3.dtd");
              return new InputSource(is);
         }
         return null;
    }



>
> How do I get around the timeout issue when parsing the web.xml file with 
> the
> DTD definition?
>
>
>
> The DTD definition is:
>
>
>
> <!DOCTYPE web-app
>
>    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>
>    "http://java.sun.com/dtd/web-app_2_3.dtd">
>
>
>
> Regards,
>
> Andrew
>
> 




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message