commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebastian Komander" <>
Subject [Digester] Inheritance ?
Date Tue, 11 Oct 2005 07:06:06 GMT
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"?>
	<description>blah blah blah</description>
	<page ID="0">
		<question required="true">
				<chooseText>b</chooseText>			                 </choose>

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

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


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message