Assuming your bean property is set via setName(), I think you want to use:

digester.addSetProperties( "/Employee" );

If it were set via setFoo(), you use: 
digester.addSetProperties( "/Employee", new String [] { "Name" }, new String
[] { "foo" } );

Is the sample code you provided working?  I would expect it to fail because
Name_Key = "Name", not "name".  I'm not positive that my original piece of
code will work with an attribute named "Name".  I think it expects "name". 

Silly bean naming rules...

K.C.

> -----Original Message-----
> From: Venkatarman, Rajagopal
> [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, February 25, 2003 11:17 AM
> To: '[EMAIL PROTECTED]'
> Subject: [Digester] Attribute Mapping
> 
> 
> Im trying to use the Digester to map attribute key-value to a 
> bean property.
> This is the format of my XML
> 
> <Employee Name="Raj">
> 
> Now to parse this using digester, i had to split the 
> Attribute into key and
> value, like
> <Employee Name_Key="Name" Name_Value="Raj">
> And using digester code as
> 
> digester.addSetProperty("Root", "Name_Key", "Name_Value");
> which would assign the Attribute Name to "Raj" in my bean.
> 
> Is there an easier way to do this? Right now, i have to use a 
> stylesheet to
> convert my original XML into the Name-Value formatted XML and 
> pass through
> Digester.
> 
> TIA
> Raj
> 
> 
> LEGAL NOTICE
> Unless expressly stated otherwise, this message is 
> confidential and may be privileged. It is intended for the 
> addressee(s) only. Access to this E-mail by anyone else is 
> unauthorized. If you are not an addressee, any disclosure or 
> copying of the contents of this E-mail or any action taken 
> (or not taken) in reliance on it is unauthorized and may be 
> unlawful. If you are not an addressee, please inform the 
> sender immediately.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Reply via email to