commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <>
Subject [configuration] iterating over structured XML
Date Thu, 22 Dec 2005 18:30:20 GMT

I'm wondering if there's a better way to iterate over structured XML?  Here's
how I'm currently doing it...

int i = 0;
while (true)
    String subset = new
    SubsetConfiguration sc = (SubsetConfiguration) config.subset(subset);
    if (sc.isEmpty()) break;

    //do stuff with subset configuration here....

...which works, but it seems like I should be able to just do an iteration over
the subconfigurations.  Maybe something like this?...

for (Iterator iter = config.getList("tables.table").iterator(); iter.hasNext();)
    SubsetConfiguration sc = (SubsetConfiguration);

    //do stuff with subset configuration here....

However, that doesn't work because config.getList() returns a list of string
contents of the table elements (which returns a list of size 0, since <table>
elements are only for structure, not for text content).  That's not what I'm
aiming for.  Isn't there a way that I can iterate over a list of subset
configurations so I don't have to resort to generating a dynamic key?  This
would make my code more clean.  I hope I'm just missing something.



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

View raw message