DECAFFMEYER MATHIEU wrote:
Hi,

I try to get a list of elements of My XML file, see below,

The two first elements are returned, but not the two lasts.
(Actually all the elemnts must have a format like the two lasts, I added the first two just to test)

List list1 = reader.getList("list");
for(int i=0; i<list1.size(); ++i)
System.out.println(reader.getString("list("+i+")[EMAIL PROTECTED]")); // returns only german and italian

The problem here is that getList("list") will only select the nodes that have a direct text value. Because of this you only get the first two elements; the others have sub elements, but no text content.

If you change this to getList("[EMAIL PROTECTED]"), it should work. If you use Commons Configuration 1.3 you can also have a look at the getConfigurationsAt() method of HierarchicalConfiguration. This method will simplify iteration over the result list.

HTH
Oliver



<?xml version="1.0" encoding="ISO-8859-1"?>
<stopwords>

  <list name="german">
    einer eine eines
  </list>

  <list name="italian">
    einer eine eines
  </list>

  <list name="french">
        <content>
                einer eine eines
        </content>
        <files>
                <file>hello</file>
        </files>
  </list>

  <list name="dutch">
        <content>
                einer eine eines
        </content>
        <files>
                <file>world</file>
        </files>
  </list>

</stopwords>


Thank u for any Help

|

============================================
Internet communications are not secure and therefore Fortis Banque Luxembourg S.A. does not accept legal responsibility for the contents of this message. The information contained in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. Nothing in the message is capable or intended to create any legally binding obligations on either party and it is not intended to provide legal advice.
============================================
|


------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to