Question

I have a xml and it has a list tag with number of items.

Example:

    <param>
       <id>12345</id>
       <date>2012/07/10</date>
       <list>
         <item>
           <name>Test1</name>
           <code>C1</code>
         </item>
         <item>
           <name>Test2</name>
           <code>C2</code>
         </item>
       </list>
    </param>   

I want to map this in to Java a object using Jakarta Digester framework.

My plan is this.

  1. Create a main ResponseDTO
  2. Create a ItemDTO
  3. Add a ItemDTO Array List to ResponseDTO

So after parsing this xml to Jakarta Digester engine I'm expectibg a ResponseDTO with ItemDTO list which are having real values.

Could some one kindly let me know how I can do this using Digester framework.

Was it helpful?

Solution

Have a look to this article: http://www.devx.com/Java/Article/21832

But there are dozen of XML de/serialization frameworks that are much more user friendly... (http://x-stream.github.io/tutorial.html#init).

M.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top