commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "DECAFFMEYER MATHIEU" <MATHIEU.DECAFFMA...@fortis.lu>
Subject RE: get an XMLConfig. from ConfigurationFactory
Date Tue, 20 Mar 2007 08:39:06 GMT
 
Thank u for your response,

How am I supposed to know the Index to get the XMLConfiguration ?

Thank u.

__________________________________

   Matt

    

-----Original Message-----
From: Oliver Heger [mailto:oliver.heger@oliver-heger.de] 
Sent: Monday, March 19, 2007 9:47 PM
To: Jakarta Commons Users List
Subject: Re: get an XMLConfig. from ConfigurationFactory

*****  This message comes from the Internet Network *****

DECAFFMEYER MATHIEU wrote:
> Hi,
> 
> I am using this snippet of code to get dynamically the configuration 
> settings of my app. :
> 
> URL url =
>         Thread.currentThread().getContextClassLoader().getResource(
>                 "ress/config.xml");
> ConfigurationFactory factory =* **new* ConfigurationFactory();
> factory.setConfigurationURL(url);
> Configuration conf =* null*;
> *try* {
>         conf = factory.getConfiguration();
> }* catch* (ConfigurationException e) {
>         e.printStackTrace();
> }
> 
> 
> The problem here is that I am trying to get an XMLConfiguration and
not 
> a Configuraton object,
> to do operations on the configuration file itself (change the
settings), 
> which is an XML file.
> 
> any tips on how to get an XMLConfiguration from a the 
> ConfigurationFactory ?
> 
> Thank u !
> 
> *__________________________________*
> 
> *   Matt*////
> 
You can cast the Configuration object you obtain from the factory to a 
CompositeConfiguration. This class provides the getConfiguration(int 
index) method, which gives you access to the child configurations. The 
XMLConfiguration you have loaded using the factory will be one of those.

HTH
Oliver


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org



============================================
Internet communications are not secure and therefore Fortis Banque Luxembourg S.A. does not
accept legal responsibility for the contents of this message. The information contained in
this e-mail is confidential and may be legally privileged. It is intended solely for the addressee.
If you are not the intended recipient, any disclosure, copying, distribution or any action
taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. Nothing
in the message is capable or intended to create any legally binding obligations on either
party and it is not intended to provide legal advice.
============================================


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message