commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Faggart, Robin" <rfagg...@carreker.com>
Subject RE: XMLConfiguration: Keyname list
Date Mon, 27 Mar 2006 20:41:04 GMT
Thanks...the problem was that I wasn't using the latest level of the
code... 

-----Original Message-----
From: Oliver Heger [mailto:oliver.heger@t-online.de] 
Sent: Monday, March 27, 2006 2:39 PM
To: Jakarta Commons Users List
Subject: Re: XMLConfiguration: Keyname list

I think, this is a different question.

It is correct that you can access properties using indices as in your
example (though you are missing a dot before "name").

Here the question was how to obtain keys with indices when a
configuration is given. The getKeys() method returns only plain keys
without indices, e.g. "tables.table.name".

Oliver

>-----Original Message-----
>From: Oliver Heger [mailto:oliver.heger@t-online.de]
>Sent: Monday, March 27, 2006 2:15 PM
>To: Jakarta Commons Users List
>Subject: Re: XMLConfiguration: Keyname list
>
>Rishikesh.Mallesh@atradius.com wrote:
>
>  
>
>>Hi
>>
>>
>>
>>Question regarding XMLConfiguration. How could I get the list of 
>>keynames stored in an XMLConfiguration object?
>>
>>
>>
>>Say for instance my XML file looks like -
>>
>><database>
>> <tables>
>>   <table tableType="system">
>>     <name>users</name>
>>     <fields>
>>       <field>
>>         <name>uid</name>
>>         <type>long</type>
>>       </field>
>>       <field>
>>         <name>uid</name>
>>         <type>long</type>
>>       </field>
>>
>>.
>>.
>>.
>>.
>></database>
>>
>>
>>
>>Is there an  API which would return a Collection of containing the 
>>following keynames?
>>
>>
>>
>>tables.table(0).fields(0).field.name
>>
>>tables.table(0).fields(1).field.name
>>
>>
>>
>>
>>
>>If not an API is there a standard way of doing this.
>>
>>
>>
>>    
>>
>This is not directly supported. The getKeys() method defined in the 
>Configuration interface only returns the defined keys without indices.
>
>For which purpose do you need these keys? If it is only for a 
>convenient way of iterating over a hierarchical configuration, the 
>latest code in SVN contains the method 
>HierarchicalConfiguration.configurationsAt(String key), which gives you

>access to sub structures of the configuration.
>
>If you really need keys with indices, I fear you will have to traverse 
>the HierarchicalConfiguration.Node objects by yourself and construct 
>the keys.
>
>HTH
>Oliver
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>  
>


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


---------------------------------------------------------------------
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