commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "thomas peter" <tho...@braindumped.com>
Subject [configuration] Issue with combinedConfig from Factory
Date Tue, 01 Aug 2006 09:20:41 GMT
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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message