commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Price <>
Subject [digester] parsing XML attributes but not as bean props
Date Mon, 24 Mar 2003 16:36:59 GMT
I've been reading through the Digester documentation and it appears that 
XML attributes can map nicely to JavaBean properties, but I have a 
somewhat different situation and was wondering if someone could tell me 
where I should be looking for the answer to this question:

My XML file looked like this:

             <name>Foundation/PDM Requirement</name>

My client code (that used Digester) looked like this:

                                "addUserDefinedAttribute", 3);
             digester.addCallParam("report/criteria/uda/name", 0);
             digester.addCallParam("report/criteria/uda/value", 1);
             digester.addCallParam("report/criteria/uda/type", 2);

and everything was fine.  However, I would like to change my XML file to 
look like this:

         <uda type="LIST">
             <name>Foundation/PDM Requirement</name>

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.



View raw message