You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Carlos Obradó <mo...@gmail.com> on 2006/04/03 11:18:35 UTC

[commons-configuration] Adding XMLConfigurations objects into others

addNodes
public void addNodes(String key, Collection nodes)

Adds a collection of nodes at the specified position of the
configuration tree. This method works similar to addProperty(), but
instead of a single property a whole collection of nodes can be added
- and thus complete configuration sub trees. E.g. with this method it
is possible to add parts of another HierarchicalConfiguration object
to this object

-------------------------------

This is from the HierarchicalConfiguration class doc. My question is
how can i do that? I create a LinkedList collection of Nodes and then
add it to a XMLConfiguration Object, but when i call the save()
method, the XML file is empty. which is the correct way of creating a
tree of configuration objects and then saving it into a xml file?

thanks.

sorry for my english, i'm from spain.

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


Re: [commons-configuration] Adding XMLConfigurations objects into others

Posted by Carlos Obradó <mo...@gmail.com>.
It's 1.2 but i finally got it, my error was declaring the Nodes with a
value and then adding childs to them. Now I only declare them with a
key and the values are included in the childs, it seems to work this
way.

thanks anyway.

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


Re: [commons-configuration] Adding XMLConfigurations objects into others

Posted by Oliver Heger <he...@med.uni-marburg.de>.
Carlos Obradó wrote:
> addNodes
> public void addNodes(String key, Collection nodes)
> 
> Adds a collection of nodes at the specified position of the
> configuration tree. This method works similar to addProperty(), but
> instead of a single property a whole collection of nodes can be added
> - and thus complete configuration sub trees. E.g. with this method it
> is possible to add parts of another HierarchicalConfiguration object
> to this object
> 
> -------------------------------
> 
> This is from the HierarchicalConfiguration class doc. My question is
> how can i do that? I create a LinkedList collection of Nodes and then
> add it to a XMLConfiguration Object, but when i call the save()
> method, the XML file is empty. which is the correct way of creating a
> tree of configuration objects and then saving it into a xml file?
> 
> thanks.
> 
> sorry for my english, i'm from spain.
> 

Carlos,

can you provide a short code fragment that demonstrates how you 
initialize the configuration and construct the Node objects? From your 
description I cannot see where the problem could be.

Which version of Commons Configuration do you use?

Oliver

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