Hi all,
I try to load an XML file into JavaBeans with Jakarta Digester.
The xml-File looks like the following:
<?xml version="1.0" encoding="UFT-8"?>
<survey>
<title>test</title>
<description>blah blah blah</description>
<page ID="0">
<question required="true">
<text>Testfrage</text>
<freeAnswer/>
</question>
<question>
<text>Testfrage</text>
<choose>
<chooseText>a</chooseText>
<chooseText>b</chooseText>
</choose>
</question>
</page>
</survey>
I have a abstract class question. And two concret classes:
TextQuestion: For a normal Textquestion(xml: survey/page/question, the
first question)
SelectQuestion: For a SelectQuestion(xml: survey/page/question, the second
question).
So, if there is an element "freeAnswer", the class "TextQuestion" should
be initiated, if there is an element "choose" found under
survey/page/question, the SelectQuestion should be initiated and added to
the Survey class.
It works well with only one type of question, and a concrete class
"Question". But if I change the type to abstract and create two classes
(TextQuestion and SelectQuestion), I geht an
"java.lang.InstantiationException", cause the Digester tries to initiate
the class "Question".
Can you tell me how I can use inheritance in digester.
I can use a CreateFactory, but this isn't what I want.
Kind regards
Sebastian
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]