[ 
https://issues.apache.org/jira/browse/CONFIGURATION-504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13440082#comment-13440082
 ] 

Adrien CLERC edited comment on CONFIGURATION-504 at 8/23/12 5:31 PM:
---------------------------------------------------------------------

It's quite like this. In fact, I call {{configurationsAt(key)}}, so I get a 
{{List<HierarchicalConfiguration>}} (whose elements are in fact 
{{SubnodeConfiguration}}, but I can't rely on that).
I then iterate on each element to perform some attribute manipulations, and on 
some elements of that list, I'd like to remove them completely from the 
complete configuration.

I used to call {{clear()}} for that, but it seems that the behavior has changed 
since 1.8.

I hope I'm clearer now :)
                
      was (Author: adrien.clerc):
    It's quite like this. In fact, I call {{configurationsAt(key)}}, so I get a 
{{List<HierarchicalConfiguration>}} (whose elements are in fact 
{{SubnodeConfiguration}}, but I can't rely on that).
I then iterate on each element to perform some attribute manipulations, and on 
some elements of that list, I'd like to remove them completely from the 
complete configuration.

I used to call {{clear()}} for that, but it seems that the behavior has changed 
since 1.7.

I hope I'm clearer now :)
                  
> HierarchicalConfiguration clear() method doesn't remove the node from its 
> parent anymore in XML source
> ------------------------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-504
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-504
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.8
>            Reporter: Adrien CLERC
>            Priority: Minor
>
> Using an XML source file, I used to call HierarchicalConfiguration.clear() on 
> an object to remove it from its parent. Now, it just clear the text and the 
> subnodes, but not the node itself, nor its own attribute, when the file is 
> saved.
> Here is the code that works :
> {code}
>             ConfigurationNode oldNode = configuration.getRootNode();
>             oldNode.getParentNode().removeChild(oldNode);
> {code}
> configuration belong to a list of HierarchicalConfiguration that I obtained 
> from configurationsAt. I didn't see any other way to remove a node I got from 
> that method, without explicit casting to SubnodeConfiguration.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to