I want to use the Digester package to parse an xml file and create an
instance of a class.  The class has an inner class and I want to
instantiate this inner class from digester, but I run in to some
problems.

Does anybody know of a way to use the Digester package to instantiate
an inner class?  I cannot make the class static-inner class and I
cannot make it a seperate class.

Details of my situation:

- java code
public ClassA { 
    String name;

    public ClassA() {
    }

    public void setName(String name) {
        this.name = name;
    }

    public class ClassB {
        String name;

        public ClassB() {
        }

        public void setName(String name) {
            this.name = name;
        }
    }
}

- Here are the Digester rules:
addObjectCreate("classa", "ClassA");
addCallMethod("classa/name", "setName", 0);
addObjectCreate("classa/classb", "ClassB");
addCallMethod("classa/classb/name", "setName", 0);


- Here is the xml:
<classa>
   <name>somename</name>
   <classb>
      <name>someothername</name>
   </classb>
</classa>


I get classNotFoundExcepton if have the above setup. If I change the
second last line in the Digester rules to:
addObjectCreate("classa/classb", "ClassA$ClassB");
then I get InstantiationException.


Does anyone know why I am getting these errors?  

Thanks!

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

Reply via email to