commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "DECAFFMEYER MATHIEU" <MATHIEU.DECAFFMA...@fortis.lu>
Subject RE: Configuration - getList Issue
Date Thu, 21 Dec 2006 08:14:21 GMT
 
Thank u very much for these information.
    

-----Original Message-----
From: Oliver Heger [mailto:oliver.heger@oliver-heger.de] 
Sent: Wednesday, December 20, 2006 10:20 PM
To: Jakarta Commons Users List
Subject: Re: Configuration - getList Issue

*****  This message comes from the Internet Network *****

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+").[@name]"));

> // 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("list[@name]"), 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: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org



============================================
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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message