commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From José Antonio Pérez Testa <>
Subject Re: [Digester]what's the difference when parsing xml files like these?
Date Wed, 18 Aug 2004 08:45:32 GMT
Hi Gao, as always i recommed you my reference reading:
you must use addSetProperties method. Following changes would work!

//digester.addCallMethod("devices/device", "addDevice",1);
//digester.addCallParam("devices/device/name", 0);
digester.|addSetProperties|("devices/device/name", "device");

//public void addDevice(String name, ){
public void setDevice(String name) {
  Device device = new Device(name);



Gao Di wrote:

>i have the xml file as below:
>  <name>Gw1</name>
>  <name>Gw2</name>
>then i can use digester to parse it with this class
>it's aim it to put the <device> to a javabean and then
>put all <deivce> to a arraylist.
>List devices = new ArrayList();
>public void parsedevice(){ 
>Digester digester = new Digester();
>digester.addCallMethod("devices/device", "addDevice",
>digester.addCallParam("devices/device/name", 0);
>public void addDevice(String name, ){
>Device device = new Device(name);
>but after some consideration,i changed the xml file
>like this:
><device name='Gw1'/>
><device name='Gw2'/>
>then,the parse code doesn't work any more,anyone can
>help me how to parse this kind of xml file?
>Do You Yahoo!?
>To unsubscribe, e-mail:
>For additional commands, e-mail:
Este correo electrnico y, en su caso, cualquier fichero anexo al mismo, contiene informacin
de carcter confidencial exclusivamente dirigida a su destinatario o destinatarios. Queda
prohibida su divulgacin, copia o distribucin a terceros sin la previa autorizacin escrita
de Indra. En el caso de haber recibido este correo electrnico por error, se ruega notificar
inmediatamente esta circunstancia mediante reenvo a la direccin electrnica del remitente.

The information in this e-mail and in any attachments is confidential and solely for the attention
and use of the named addressee(s). You are hereby notified that any dissemination, distribution
or copy of this communication is prohibited without the prior written consent of Indra. If
you have received this communication in error, please, notify the sender by reply e-mail

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

View raw message