You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Yi-Xiong Zhou <yz...@arcturusag.com> on 2002/07/11 19:50:31 UTC

locating DTD when upload an xml file

Dear helper, 

I am using Digester to parse an xml file from web upload. The DTD file is
also in the same directory of the xml file and specified in the xml file as
<!DOCTYPE Certificate SYSTEM "BRSUCofA.dtd">. 

Could anyone tell me the best way to handle this problem? 

One way I think about is to upload the DTD file and save it somewhere in the
application directory. This directory should be specified in
ApplicationResources.PROPERTIES file. Then upload the xml file and parse it
with the saved DTD file. Could anyone tell me how to set the directory to
the parser so that the parser will know where to look for the DTD file? I
also need to know how to save the DTD files in struts to a given path. 

Thanks. 

Yi-Xiong


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: locating DTD when upload an xml file

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 11 Jul 2002, Yi-Xiong Zhou wrote:

> Date: Thu, 11 Jul 2002 10:50:31 -0700
> From: Yi-Xiong Zhou <yz...@arcturusag.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: "'struts-user@jakarta.apache.org'" <st...@jakarta.apache.org>
> Subject: locating DTD when upload an xml file
>
> Dear helper,
>
> I am using Digester to parse an xml file from web upload. The DTD file is
> also in the same directory of the xml file and specified in the xml file as
> <!DOCTYPE Certificate SYSTEM "BRSUCofA.dtd">.
>

Using this relative URL as the system identifier requires the DTD to be in
the same directory that you put the XML file.

> Could anyone tell me the best way to handle this problem?
>
> One way I think about is to upload the DTD file and save it somewhere in the
> application directory. This directory should be specified in
> ApplicationResources.PROPERTIES file. Then upload the xml file and parse it
> with the saved DTD file. Could anyone tell me how to set the directory to
> the parser so that the parser will know where to look for the DTD file? I
> also need to know how to save the DTD files in struts to a given path.
>

If the DTDs for your uploaded files are reasonably static, you might
consider just putting them on a webserver somewhere and using an "http"
system URL like the Struts DTDs do.  For better performance, you can also
configure Digester to use a copy of the DTD inside your webapp instead of
going to the external web server every time -- for an example of this,
take a look at how ActionServlet sets up its Digester to parse
struts-config.xml files, and uses the register method to register internal
copies for some specified public identifiers.

> Thanks.
>
> Yi-Xiong

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>