java - How to handle special characters while unmarshalling xml in JAXB -


my test xml content

    <p id="033" num="03">geopotent change&#x2 high.</p> 

and run jaxb unmarshalling, i'm getting exception

    09:58:43.748 error [main][net.serviceimpl] parsing error:      javax.xml.bind.unmarshalexception- linked exception:         [javax.xml.stream.xmlstreamexception: parseerror @ [row,col]:     [161,306]message: string "&#] 

my jaxb unmarshal source

    jaxbcontext jaxbcontext = jaxbcontext.newinstance(cndocument.class);     unmarshaller jaxbunmarshaller = jaxbcontext.createunmarshaller();     document = (cndocument) jaxbunmarshaller.unmarshal(xmlfile); 

how can escape characters? (&#x2)

you jaxb parse error because xml content not well-formed. should &#x2; (with semicolon), not &#x2.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -