I am using commons-digester-1.7.jar.
I have the following xml. My requirement is during parse, I want to extract <course> node as a String, and do no parsing of the course node, but unable to do so

Please help, Please do correct me, if in case rules should be changed
Just to let you know, googled for a solution, but unable to find
<student>
    <name>S</name>

     <course>
           <elective> java </elective>
           <credits>10</credits>
     </course>
</student>

*I am having the following beans*

public class Student
{

    public Student (){}
    private  String name;
    private Course course;

public void setName(String name) {
           this.name = name;
   }

   public String getName()
  {
        return name;
   }

   public void addCourse(Course course)
   {
         this.course = course;
   }
   public Course getCourse()
   {
          return course;
} }

public Course
{
    String  s;
     public void setS(String s)
     {
           this.s = s;
     }
      public String getS()
      {
             return s;
      }
}

*Rules*

           digester.addObjectCreate("student", Student.class );
           digester.addObjectCreate("student/course", Course.class );

           digester.addBeanPropertySetter("student/name", "name");
           digester.addBeanPropertySetter("student/course", "s");
digester.addSetNext("student/course", "addCourse");


Thanks & Regards
Krithinarayanan G

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to