The problem is probably that ConfigurationFactory and
CompositeConfiguration do not really work in a hierarchical manner and
thus cannot cope with these hierarchical list structures.
The next release will contain an alternative class called
DefaultConfigurationBuilder. This class works very similar to
ConfigurationFactory, but provides true hierarchical processing.
There is already a release candidate available at [1]. You can find the
documentation for this RC under [2]. The user's guide contains also a
section about this class.
HTH
Oliver
[1] http://people.apache.org/~oheger/commons-configuration-1.3rc1/
[2] http://people.apache.org/~oheger/commons-configuration-1.3rc1/site/
thomas peter wrote:
i once wrote something about this problem, but hadn't had the time to
get back to this until now.
so here is an example:
------------<test.xml>---------------
<root>
<a>
<b>a</b>
<b>b</b>
<b>c</b>
</a>
<a>
<b>A</b>
<b>B</b>
<b>C</b>
<b>D</b>
</a>
</root>
------------</test.xml>---------------
------------<test2.xml>---------------
<root>
<a>
<b>1</b>
<b>2</b>
<b>3</b>
</a>
<a>
<b>I</b>
<b>II</b>
<b>III</b>
<b>IV</b>
</a>
</root>
------------</test2.xml>---------------
------------<config.xml>---------------
<configuration>
<additional>
<xml fileName="test.xml" />
<xml fileName="test2.xml" />
</additional>
</configuration>
------------</config.xml>---------------
and the java-code:
ConfigurationFactory factory = new ConfigurationFactory("config.xml");
Configuration conf=null;
try {
conf = factory.getConfiguration();
} catch (ConfigurationException e) {} catch(SecurityException secE){}
for (int i=0;; i++){
if(!conf.containsKey("a.b("+i+")")){
break;
}
System.out.println(conf.getString("a.b("+i+")"));
}
this outputs:
1
2
3
IV
i'm sure i'm dooing something wrong, when i want to access every node
and get a result like
1
2
3
I
II
III
IV
a
b
c
A
B
C
D
what's wrong in my understanding?
thank you in advance.
cheers,
thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]