commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simon <>
Subject Re: [Digester] How to get element values from multiple xml documents
Date Mon, 20 Aug 2007 19:47:28 GMT
On Mon, 2007-08-20 at 11:49 +0200, Amit wrote:
> Hi All,
> I am using Digester to parse xml document. My xml document looks as follows
> <addresses>
> <address id="1">
> <street>street 1</street>
> <city>city 1</city>
> </address>
> <address id="2">
> <street>street 2</street>
> <city>city 2</city>
> </address>
> </addresses>
> I create a javabean class with attributes street and city. Now every time I
> parse this file with digester I set the values of these attributes.
> The problem is everytime I parse the javabean is set with the last <address>
> attributes here street 2 and city 2 and hence the first and consecutive
> <address> values are overwritten. How can I make every <address> element
> stored or accessible without getting overwritten..?
> Any help appreciated.

You haven't posted your code or your digester rules so I can only guess
what you're doing wrong.

Do you have an object (a List or a custom object) to hold the two
different address objects you create, and define a rule to add created
address objects into it? Digester won't do this for you..

See the examples here for more help:



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

View raw message