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:

        <uda>
            <name>Foundation/PDM Requirement</name>
            <value>Yes</value>
            <type>LIST</type>
        </uda>

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

        digester.addCallMethod("report/criteria/uda",
                               "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>
            <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.


Thanks,


Erik


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to