commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Qaiser Mehmood" <>
Subject help for Commenos Digester
Date Tue, 11 Apr 2006 17:28:39 GMT


I am using Commons Digester to parse one XML file to a Java Object and
the code is not populating my Java Bean. The XML Files are 


Rules.xml :


<?xml version="1.0"?>




 <pattern value="messages/message">

classname="com.rhg.infrastructure.dao.bean.Message" />

            <set-next-rule methodname="add"

            <set-properties-rule />

            <bean-property-setter-rule pattern="application_name"/>

            <bean-property-setter-rule pattern="createDate"/>

            <bean-property-setter-rule pattern="createdBy"/>

            <bean-property-setter-rule pattern="id"/>

            <bean-property-setter-rule pattern="index_page"/>

            <bean-property-setter-rule pattern="message_text"/>

            <bean-property-setter-rule pattern="priority"/>

            <bean-property-setter-rule pattern="signature"/>

            <bean-property-setter-rule pattern="user_id"/>





Test.xml :


<?xml version="1.0" ?>  



    <application_name>Find Doc</application_name>

    <createDate>2006-04-11 09:48:22.406</createDate>




    <message_text>Error on Index.jsp</message_text>


    <signature>Revolution Team</signature>





And the code :


List messagesList = new ArrayList( );

URL rules = getClass( ).getResource("/rules.xml");

Digester digester = DigesterLoader.createDigester(rules);


InputStream input = getClass( ).getResourceAsStream("/test.xml");

Object root = digester.parse(input);

message = (Message) messagesList.get(0);


 System.out.println("message application name "+message);


There are elements in messageList , bu the fileds in message are null.
So Field from the 2nd XML file are not populated. Any help. I will
appreciate prompt response.


Qaiser Mehmood

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