Digester package

C

CG

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 grinder 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 grinder rules to:
addObjectCreate("classa/classb", "ClassA$ClassB");
then I get InstantiationException.


Does anyone know why I am getting these errors?

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top