You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Spies, Brennan" <Br...@ejgallo.com> on 2007/12/11 21:04:00 UTC

[Commons Configuration] XML Schema support, and other questions

Hi all,

 

I am considering using Commons Configuration for my project, but am not sure
if I would be able to do the type of configuration that I want.

 

Some background: 

 

I am writing a project that uses two sources of configuration, LDAP and XML
(local). The LDAP properties represent "reserved" (user cannot override) and
"default" properties (user can override), while the local XML file
(user-defined) represents all the user-controlled configuration
properties-some have defaults in LDAP, some don't. The CompositeConfiguration
seems to support that, so far so good.

 

The XML file is defined by an XML Schema, and has namespaces associated with
it. Namespaces seems to muck with XPath expressions, as you have to use XPath
functions like 'local-name()' to correctly get the path. It looks like
Commons Configuration only supports DTDs...:-(

 

The other thing that I am doing is using a mix of properties (key = value)
and actual beans which I am binding (on the XML end) using JAXB. 

 

So, can I achieve what I want using Commons Configuration and maybe a little
custom coding? Or should I write this one myself?

 

 

Thanks,

 

Brennan

 


Re: [Commons Configuration] XML Schema support, and other questions

Posted by Oliver Heger <ol...@oliver-heger.de>.
Hi, comments inline...

Spies, Brennan wrote:
> Hi all,
> 
>  
> 
> I am considering using Commons Configuration for my project, but am not sure
> if I would be able to do the type of configuration that I want.
> 
>  
> 
> Some background: 
> 
>  
> 
> I am writing a project that uses two sources of configuration, LDAP and XML
> (local). The LDAP properties represent "reserved" (user cannot override) and
> "default" properties (user can override), while the local XML file
> (user-defined) represents all the user-controlled configuration
> properties-some have defaults in LDAP, some don't. The CompositeConfiguration
> seems to support that, so far so good.
CompositeConfiguration and also DefaultConfigurationBuilder allow to 
define an order of configuration sources in which to search for 
properties. So if your configurations are correctly ordered, you can 
achieve the desired behavior.

> 
>  
> 
> The XML file is defined by an XML Schema, and has namespaces associated with
> it. Namespaces seems to muck with XPath expressions, as you have to use XPath
> functions like 'local-name()' to correctly get the path. It looks like
> Commons Configuration only supports DTDs...:-(
> 
That's right, so far only DTDs are supported.

>  
> 
> The other thing that I am doing is using a mix of properties (key = value)
> and actual beans which I am binding (on the XML end) using JAXB. 
Not sure if I understand this requirement correctly. You can parse a XML 
file with XMLConfiguration no matter of its content. If some parts of 
the document do not represent properties, they do not disturb the 
parsing process. As long as you specify the correct keys to your 
properties you can access them.

HTH
Oliver

> 
>  
> 
> So, can I achieve what I want using Commons Configuration and maybe a little
> custom coding? Or should I write this one myself?
> 
>  
> 
>  
> 
> Thanks,
> 
>  
> 
> Brennan
> 
>  
> 
> 


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