commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Heger (JIRA)" <>
Subject [jira] Commented: (CONFIGURATION-366) XMLConfiguration.getKeys() broken
Date Mon, 23 Feb 2009 17:32:02 GMT


Oliver Heger commented on CONFIGURATION-366:

Well, yes. The idea behind that is that there should be a way to query empty elements. Per
default all XML elements are listed by {{getKeys()}} that have text content. This would exclude
empty elements like the {{<XPaths>}} element in your example. Nevertheless these elements
exist in the XML document, and there may be use cases where the sole presence of an element
has a certain meaning. To address those use cases it was decided that empty elements should
be treated as regular keys with an empty string as value (this was in one of the first versions
of this library).

Due to a bug in the {{getKeys()}} method (CONFIGURATION-321) the prefix passed to this method
was never included in the iteration. That was fixed in Configuration 1.6, and that's why you
now have an additional key in the iteration.

I admit that in your specific case the behavior may seem a bit strange due to an unlucky combination
of the bug fix in CONFIGURATION-321 and the treatment of empty elements. I am not sure how
this could be made more consistent. Also, I am reluctant to changing this behavior because
of backwards compatibility.

> XMLConfiguration.getKeys() broken
> ---------------------------------
>                 Key: CONFIGURATION-366
>                 URL:
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Build
>    Affects Versions: 1.6
>         Environment: Java 6
>            Reporter: Christian Uldall Pedersen
>         Attachments: Config_1.xml, Config_2.xml,
>   Original Estimate: 48h
>  Remaining Estimate: 48h
> XMLConfiguration.getKeys(String prefix) returns iterator with the string argument "prefix",
when the xpath specified has no sub elements. The XPathExpressionEngine has been used as Expression
> Version 1.3 does not have this problem. Here an empty Iterator is returned.
> This seems related to:

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message