I have not been using the digester for a long time, but up until now I have
been able to figure out everything on my own. I have a situation that I
don't know if it can be done the way I want to do it, So I thought I would
ask.
The xml I want to digest looks like
<tran>
<processMap>
<process name="A">
<top>"AB"</top>
<top>"AC"</top>
<top>"AD"</top>
</process>
<process name="C">
<top>"AB"</top>
<top>"CC"</top>
<top>"AD"</top>
</process>
<process name="F">
<top>"CB"</top>
<top>"AC"</top>
<top>"FD"</top>
</process>
</processMap>
</tran>
The class I want to fill in is like
public class processMap {
private HashMap map;
public processMap ( ) {
}
public void setProcessMap ( HashMap map ) {
this.map = map;
}
public HashMap getProcessMap ( ) {
return map;
}
}
The digester rules are like
// Create the HashMap and push it on the stack
addObjectCreate ( "tran/processMap", HashMap.class );
// Create the ArrayList and push it on the stack
addObjectCreate ( "tran/processMap/process", ArrayList );
//
// Don't know how to get to the process attribute name
// Don't know how to call HashMap.put with the key as the
// process attribute name value ant the value as the ArrayList
// that is currently at the top of the stack
// Add the top values to the array list
addCallMethod ( "tran/processMap/process/top", add, 1 );
addCallParam ( "tran/processMap/process/top", 0 );
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]