You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matt Raible <ma...@yahoo.com> on 2002/03/06 16:41:44 UTC
"Best Practice" for parsing an XML file for application configuration parameters?
I am developing an application that will require different application settings
for different machines/customers.
Because of this, I want to to externalize certain configuration settings to a
XML file outside of web.xml - let's call this myApp.xml.
I have a StartupServlet that I can parse this file with.
1. What should I use to parse this file - SAX, DOM, Digester?
2. Should I have a bean that represents all the configuration settings, and
put this in the ServletContext as an attirubute, or each individual setting?
3. If I use Digester and a bean (seems good), should I change my XML in the
following snippet?
<application>
<respository>
<root>d:/repository</root>
<assets>assets</assets>
<viewPath>file://d:/repository/assets</viewPath>
</respository>
<assessment>
<!-- This value is a percentage -->
<default-passing-score>75</default-passing-score>
</assessment>
</application>
Any help (or URLs) are appreciated!
Matt
__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: "Best Practice" for parsing an XML file for application
configuration parameters?
Posted by Dave Weis <dj...@sjdjweis.com>.
On Wed, 6 Mar 2002, Matt Raible wrote:
> I am developing an application that will require different application
> settings for different machines/customers.
> Because of this, I want to to externalize certain configuration
> settings to a XML file outside of web.xml - let's call this myApp.xml.
> I have a StartupServlet that I can parse this file with.
> 1. What should I use to parse this file - SAX, DOM, Digester?
I have used jdom and really like it. It's not blindingly fast, but it
saves me enough time that I don't mind.
> 2. Should I have a bean that represents all the configuration settings, and
> put this in the ServletContext as an attirubute, or each individual setting?
I think the settings should all be contained in a bean.
> 3. If I use Digester and a bean (seems good), should I change my XML in the
> following snippet?
> <application>
> <respository>
> <root>d:/repository</root>
> <assets>assets</assets>
> <viewPath>file://d:/repository/assets</viewPath>
> </respository>
> <assessment>
> <!-- This value is a percentage -->
> <default-passing-score>75</default-passing-score>
> </assessment>
> </application>
Looks reasonable.
dave
--
Dave Weis "I believe there are more instances of the abridgement
djweis@sjdjweis.com of the freedom of the people by gradual and silent
encroachments of those in power than by violent
and sudden usurpations."- James Madison
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>