• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Jersey/JAXB: parsing xml response that has inner tags/elements

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Building a Jersey Client to retrieve a response in XML.

Sample XML response from a WS:



Using Jersey and JAXB, I am able to get the XML response parsed into a class object (Book)


The problem I am having is with the "inner elements".
The "summary" field of the Book object is null after it's decoded by JAXB.
If I remove the inner element "<p>", I am able to get a value for summary.
I would like JAXB to treat everything within <Summary></Summary> as a string value but how do I let it know to treat inner elements as a string value instead of an xml element?
 
Sam Yim
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
make sure the content is surrounded by <![CDATA[ {content} ]]>
 
reply
    Bookmark Topic Watch Topic
  • New Topic