javaxmlapache-commonsapache-commons-config

Java, Apache Commons Configuration XML attributes


I'm reading config from an XML file using Apache's commons.configuration. In one of the sections, I have several lines in the form of:

<bla attr1="something" attr2="something else" />

Ideally, I would like to do something like this:

List blas = config.getList("section.bla");
String attr1 = blas.get(0).getAttribute("attr1");

(The code above does not work, obviously)

Is this possible somehow, or do I have to query each attribute separately in the XPath-like notation, iterating myself through the list?


Solution

  • Well, I ended up manually iterating and querying for everything separately.