[configuration] attributes in xml config don't apply to all entries of a list

2012-05-30 Thread Alexander Selg
Hi,

I'm using a different implementation of the DefaultExpressionEngine. I
use attributes in our applications conf.xml to filter the result of
DefaultExpressionEngine.query().
So I have a config file like

configuration
   someStrings environment=teststr1,str2,str3/someStrings
   someStrings environment=prodstr4,str5,str6/someStrings
/configuration

In the query() methode of MyExpressionEngine I want to access these attributes

   ListConfigurationNode queryResults = super.query(root, key);
   for (ConfigurationNode queryResult : queryResults) {
   attributes = queryResult.getAttributes();
   ...
   }

The problem is that I only get the attributes for the first node - the
subsequent nodes don't have any attributes set.
So for str1 I'll get the attribute environment=test, for str2
and str3 I'll get no attributes.

Is that a bug?
Am I doing something wrong?

I'm using commons-configuration 1.8 with jdk1.6

Any help would be appreciated,
Alex

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



Re: [configuration] attributes in xml config don't apply to all entries of a list

2012-05-30 Thread Oliver Heger

Am 30.05.2012 16:53, schrieb Alexander Selg:

Hi,

I'm using a different implementation of the DefaultExpressionEngine. I
use attributes in our applications conf.xml to filter the result of
DefaultExpressionEngine.query().
So I have a config file like

configuration
someStrings environment=teststr1,str2,str3/someStrings
someStrings environment=prodstr4,str5,str6/someStrings
/configuration

In the query() methode of MyExpressionEngine I want to access these attributes

ListConfigurationNode  queryResults = super.query(root, key);
for (ConfigurationNode queryResult : queryResults) {
attributes = queryResult.getAttributes();
...
}

The problem is that I only get the attributes for the first node - the
subsequent nodes don't have any attributes set.
So for str1 I'll get the attribute environment=test, for str2
and str3 I'll get no attributes.

Is that a bug?
Am I doing something wrong?

I'm using commons-configuration 1.8 with jdk1.6

Any help would be appreciated,
Alex


Not sure whether this behavior is somewhere documented, but it is indeed 
intended. There are unit tests for XMLConfiguration which test that 
attributes are only assigned to the first node of a list.


I guess, there are different use cases. When the code was developed a 
decision had to be taken. At that time assigning attributes only to the 
first node seemed to be straightforward.


If you have any control over your XML, I would recommend to avoid 
comma-separated properties with multiple values. In XML lists can be 
defined in a natural way by just repeating tags. Then the association 
between attributes and values nodes is obvious.


HTH
Oliver



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




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



[scxml] ANN: SCION-Java project

2012-05-30 Thread Jacob Beard
Hi,

While not specifically related to SCXML Commons, I wanted to draw your
attention to a new SCXML-related project I have just released called
SCION-Java [0]. SCION is an implementation of SCXML in JavaScript [1],
and SCION-Java provides lightweight bindings to the SCION library for
Java. Some advantages of SCION-Java are:

* liberally licensed (Apache 2)
* extremely simple Java API (just one class)
* well-tested, using the SCXML Test Framework [2]
* supports scripting with ECMAScript out of the box

The Java API is not quite complete yet, as I still need to allow
registering state change listeners from Java.

If you have any questions or comments, please do not hesitate to
contact me. Thanks,

Jake


[0] https://github.com/jbeard4/SCION-Java
[1] https://github.com/jbeard4/SCION
[2] https://github.com/jbeard4/scxml-test-framework

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