users@jaxb.java.net

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

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Fri, 25 Feb 2011 09:23:07 +0100

What kind of exception? Stack trace? Type of field for which this char
sequence is intended as data?
-W


On 24 February 2011 20:30, THadC <tclotworthy_at_integratedsecure.com> wrote:

>
> 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:
>
> JAXBContext 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();
> }
>
> I would be grateful for any insights into how to resolve this. thank you
> for
> any response!
> --
> View this message in context:
> http://old.nabble.com/JAXB-Unmarshalling-Exception-when-Encountering---l-t---and---g-t---tp31007227p31007227.html
> Sent from the java.net - jaxb users mailing list archive at Nabble.com.
>
>