commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rashid Jilani" <>
Subject How to map the following xml uisng digester
Date Fri, 13 Mar 2009 21:11:27 GMT
Hi: gurus I have the following xml file that I like to map to Java objects
but don't know the right approach after just reading the Digester  document





            <Item Name="Title" Type="String">The American journal of
obstetrics and diseases of women and children</Item>

            <Item Name="MedAbbr" Type="String">Am J Obstet Dis Women

            <Item Name="IsoAbbr" Type="String"></Item>

            <Item Name="NlmId" Type="String">14820330R</Item>


            <Item Name="pISSN" Type="String">0894-5543</Item>

            <Item Name="eISSN" Type="String"></Item>

            <Item Name="PublicationStartYear" Type="String">1868</Item>

            <Item Name="PublicationEndYear" Type="String">1919</Item>

            <Item Name="Publisher" Type="String">W.A. Townsend &amp;

            <Item Name="Language" Type="String">eng</Item>


            <Item Name="Country" Type="String">United States</Item>

            <Item Name="BroadHeading" Type="List"></Item>

            <Item Name="ContinuationNotes" Type="String"></Item>







My objects are 


public class DocumentSummary implements Serializable {


    private long id = 0;

    private List<Item> listItems = null;


 // Omitted Setter and getters for Brevity




public class Item implements Serializable{

    private String name;

    private String type;

    private String value;


// Omitted Setter and getters for Brevity






Here is my rules file, but I got stuck after parsing the "Id" tag and don't
know how to proceed further, any help would be appreciated.




  <pattern value="eSummaryResult/DocSum">


    <object-create-rule classname="digesterexample.DocumentSummary"/>



    <set-next-rule methodname="add"




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











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