Copied from : http://www.theserverside.com/articles/article.tss?l=Digester
.....
The reason you need to push this initial object is because Digester
keeps pushing and popping objects from the stack as it encounters tags.
So the first object is created and pushed onto the stack upon
encountering the first tag, and this object is popped off the stack when
the last tag is processed. Because you need to hold a reference to the
object for the first tag, the initial object you push before you parse
the XML serves the purpose and retains a reference to that object.
....
José Antonio Pérez Testa wrote:
>Hi Gao,
>You have to add an initial object to the Digester stack with
>digester.push (miObject);
>and add a new rule
>digester.addSetNext("CMS/CMD/GWPARAMS", "miObjectMethodName");
>in order to Digester to call <miObjectMethodName> with the Device in top
>of the stack, before pop the Device object and leave the stack empty (
>and the return null).
>
>Gao Di wrote:
>
>
>
>>my xml is:
>><CMS>
>><CMD>
>><GWPARAMS name='shanghai'>
>><PR name='OSVER' value='V001'/>
>><PR name='HWVER' value='V002'/>
>><PR name='STATUS' value='ON'/>
>><PR name='CONNECTTIME' value='2004-08-30 16:50'/>
>><PR name='UPTIME' value='2004-08-30 16:50'/>
>></GWPARAMS>
>></CMD>
>></CMS>
>>and i want to put the the value into the javabean,i
>>use;
>>digester.addObjectCreate("CMS/CMD/GWPARAMS",
>>"com.adt.service.transfer.model.Device");
>>digester.addSetProperties("CMS/CMD/GWPARAMS");
>>digester.addSetProperty("CMS/CMD/GWPARAMS/PR","name","value");
>>
>>device = (Device)digester.parse(os.getReader());
>>
>>i find the parse can find the set method and put the
>>value in it,but when i use get method to get the
>>result,i only get null,it seems the value can't be
>>persisted,that's why?
>>
>>_________________________________________________________
>>Do You Yahoo!?
>>150万曲MP3疯狂搜,带您闯入音乐殿堂
>>http://music.yisou.com/
>>美女明星应有尽有,搜遍美图、艳图和酷图
>>http://image.yisou.com
>>1G就是1000兆,雅虎电邮自助扩容!
>>http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>>
>>
>-------------------------------------------------------------------------------------------------------------------
>Este correo electr?ico y, en su caso, cualquier fichero anexo al mismo, contiene
>informaci? de car?ter confidencial exclusivamente dirigida a su destinatario o
>destinatarios. Queda prohibida su divulgaci?, copia o distribuci? a terceros sin la
>previa autorizaci? escrita de Indra. En el caso de haber recibido este correo
>electr?ico por error, se ruega notificar inmediatamente esta circunstancia mediante
>reenv? a la direcci? electr?ica 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: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
-------------------------------------------------------------------------------------------------------------------
Este correo electr?ico y, en su caso, cualquier fichero anexo al mismo, contiene
informaci? de car?ter confidencial exclusivamente dirigida a su destinatario o
destinatarios. Queda prohibida su divulgaci?, copia o distribuci? a terceros sin la
previa autorizaci? escrita de Indra. En el caso de haber recibido este correo
electr?ico por error, se ruega notificar inmediatamente esta circunstancia mediante
reenv? a la direcci? electr?ica 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]