commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <si...@ecnetwork.co.nz>
Subject Re: [digester] parsing XML attributes but not as bean props
Date Mon, 24 Mar 2003 22:57:07 GMT
On Tue, 2003-03-25 at 04:36, Erik Price wrote:

>          <uda type="LIST">
>              <name>Foundation/PDM Requirement</name>
>              <value>Yes</value>
>          </uda>
> 
> Now the "uda" element has an attribute "type" with a value of "LIST", 
> but rather than pass the string "LIST" to a JavaBean set method, I need 
> to store the value and pass it as the 3rd argument to the 
> "addUserDefinedAttribute" method.
> 
> Does anyone know how to refer to an attribute in the same fashion as 
> referring to a nested element using Digester?  I did not find evidence 
> that Digester documentation actually uses XPath so I am not certain that 
> I can use an XPath-like pattern to refer to the attribute in an 
> "addCallParam" method.

XPath isn't supported, but the method
   digester.addCallParam(pattern, index, attributeName)
should do the job, eg
   digester.addCallParam("uda", 2, "type");
will pass the value of the "type" attribute on the node matched by the
pattern "uda" as the third parameter.


Mime
View raw message