Get specific XML Subvalues with Commons Configuration

Lets say we have the following XML:

<root>
    <sub>
        <id>1</id>
        <values>
            <value>1</value>
            <value>2</value>
        </values>
    </sub>
    <sub>
        <id>2</id>
        <values>
            <value>16</value>
            <value>15</value> 
        </values>
    </sub>
</root>

What I want to with Apache Commons Configuration: I want to get all values for sub with id2. How could I achieve that? I find nothing in the documentation, how I can query with a dynamic hierarchy number.

Answers


You can use XPath:

//sub[id = 2]/values/value

Need Your Help

Where is the database for the built in user part of asp.net MVC2?

asp.net asp.net-mvc asp.net-mvc-2

User registration/authentication seems to be built into MVC2 but where does is the database that stores the users? It's not under data connections.

Decode html string in JQuery Mobile template

javascript json jquery jquery-mobile

I am using jquery templates which I populate using an ajax request. However, one of the values returned is encoded HTML. How can I encode it?

How to complete this python function to save in the same folder?

python image-processing python-imaging-library

I am trying to write my first real python function that does something real. What i want to accomplish is searching a given folder, and then open all images and merging them together so they make a