commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mathis Hofer <>
Subject [configuration] Looping through multiple nodes
Date Thu, 08 Feb 2007 09:43:43 GMT

I have a question about looping through multiple nodes with

This is how my data looks like:

Now if I get the amount of images with getMaxIndex() I get 2, which is correct:
    int numImages = config.getMaxIndex("image");

But if I get the amount of tiles within the first image I get 0, although there
are a few tiles:
    int numTiles = config.getMaxIndex("image(0).tile");

Also when trying to get the property I get the output from the else statement,
so no collection is available:
    Object prop = config.getProperty("image(0).puzzletile");
    if (prop instanceof Collection) {
    } else {
        System.out.println("is not a Collection");

What am I doing wrong?

Maybe as an addition: The above data structure is simplyfied. The <image> is
already in some other node. There are other single-properties (like integers and
strings) on the same level as image which I can read out, so the path to it
should be alright.

I'm glad if someone can help me...


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message