• 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

JAXB Unmarshalling Exception when Encountering & l t ; and & g t ;

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am getting unmarshalling exceptions at any encounter of sequences & l t ; and & g t ; (NOTE: I had to put spaces between the chars so they would turn into < and > in this post) in my xml. I tried wrappering the corresponding pieces with CDATA like <![CDATA[& g t ;]]>, but the exception still occurs.

I am using the following classes for performing the unmarshalling activities:


import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;

and the exception takes place in the "f = (Filter) u.unmarshal(s);" part of the code below:

J[code=java]AXBContext jbc = null;
Unmarshaller u = null;
Filter f = null;
try {
jbc = JAXBContext.newInstance(Filter.class);
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
u = jbc.createUnmarshaller();
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
StringReader sr_xml = new StringReader(filter);
Source s = new StreamSource(sr_xml);
try {
f = (Filter) u.unmarshal(s);
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
[/code]
I would be grateful for any insights into how to resolve this. thank you for any response!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic