commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Valerio Schiavoni <>
Subject Using digester: how to create parent node knowing the child nodes...
Date Tue, 20 Dec 2005 15:43:11 GMT
this is my first post to the commons ml, thanks for the support.

i'm willing to use digester to parse this kind ofxml:

<parameters  type=3D"RenameRelationOperator Parameter">

there could be different kind of type values.

Now, the value of the parameters should be used on the
1-arg constructor for objects of type RenameRelationOperatorParameter. At
this time, there are no setParam method, and i' searching for a solution
that avoid adding them.

in my digesterReader at this time i have this (reduced to show the problem)

digester.addFactoryCreate("parameters", new OperatorParameterFactory());

and the OperatorParameterFactory (local to MyDigesterReader) is:

   public static class OperatorParameterFactory extends
AbstractObjectCreationFactory {

     public Object createObject(Attributes arg0) throws Exception {
         String operatorType =3D arg0.getValue("type");
         OperatorParameter result =3D null;

         try {
           result =3D (OperatorParameter) Class.forName
         }catch ( ClassNotFoundException e) {
           throw new UnsupportedOperationException("OperatorParameter name=
"+operatorType+" is not supported yet");

         return result;


thanks for any support you can provide,

To Iterate is Human, to Recurse, Divine
James O. Coplien, Bell Labs

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message