On Fri, 2004-06-25 at 12:19, Bill Keese wrote:
> >><parent childClass="mypackage.childClass">
> >> <child attribute1="value1" attribute2="value2"/>
> >> <child attribute1="value3" attribute2="value4"/>
> >></parent>
> >>
> >> digester.addObjectCreate("parent", "mypackage.parentClass");
> >> digester.addSetProperties("parent");
> >>
> >>
> >>
> Did I misunderstand the meaning of the original post? I thought the
> above example should create a mypackage.parentClass object which
> contains 2 mypackage.childClass objects. Right?
No, sorry, my mistake not yours. I completely misread the original post.
Thanks for pointing that out! [and please ignore my previos post].
How about this??
public class ChildCreationFactory implements ObjectCreationFactory {
public Object createObject(Attributes x) {
ParentClass parent = (ParentClass) digester.peek();
String childClassName = parent.getChildClassName();
// create instance of child class and return it
}
}
digester.addObjectCreate("parent", ParentClass.class);
digester.addSetProperties("parent");
digester.addFactoryCreate("parent/child", new ChildCreationFactory());
digester.addSetNext("parent/child");
That looks much better...[I hope]
Regards,
Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]