commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mihai C." <comi...@videotron.ca>
Subject digester newbie question
Date Sun, 05 Dec 2004 18:30:59 GMT
Hi all, being new to digester, I have no clue how to get around my problem. 
Here's the story:
I'm trying to parse a config xml that looks like this:
<root>
     <a>
     .......
          <b>
          .....
          </b>
          <b>
          .....
          </b>
     </a>
     <a>
     .......
          <b>
          .....
          </b>
          <b>
          .....
          </b>
     </a>
</root>

I have two beans (ABean and BBean)
and the factory :
class Factory {
 processA(ABean ab){
  .......
 }
 processB(BBean bb){
  ........
 }
 digest(){
      Digester d = new Digester();
      d.push(this); //stack bottom
      d.addSetNext(      "root/a/b",   "processB" , "BBean"); // when 
root/a/b pattern mathes, execute processB on 'this' with BBean type param
      d.addSetNext(      "root/a",   "processA", "ABean"); // when root/a 
pattern mathes, execute processA on 'this' with ABean type param
      d.addObjectCreate( "root/a",   ABean.class);
      d.addObjectCreate( "root/a/b", BBean.class);

      ............... //var addCallMethod()
 }
}

I get this error:

[DEBUG] Digester - -[SetNextRule]{root/a/b} Call 
Factory.processB(ABean@fe64b9)
[ERROR] Digester - -End event threw exception 
<java.lang.IllegalArgumentException: argument type 
mismatch>java.lang.IllegalArgumentException: argument type mismatch

Obviously, processB() was called with the wrong arg type(ABean instead of 
BBean) and that because the BBean obj was just poped from the stack.

Can you please help?

-- mihai 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message