Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

UnmarshalException  RSS feed

manikandan malathy
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a problem in Unmarshall......

This s my code

package Sample;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import org.apache.log4j.Logger;
import com.sun.jmx.remote.internal.Unmarshal;
class MarshalUnmarshal
JAXBContext jc;
Object parseObject=null;
String message="<?xml version=\'1.0\' encoding=\'UTF-8\'?><MSG_VER>1</MSG_VER><VAR_COU>0034</VAR_COU><LEG_COU>1</LEG_COU>";

private static Logger log=Logger.getLogger(MarshalUnmarshal.class);

public MarshalUnmarshal()
Unmarshaller u=jc.createUnmarshaller();
parseObject=u.unmarshal(new StringReader(message));
log.debug("parsedObject= " + parseObject);
catch(Exception e)
System.out.println("This s parsed error"+e);

public static void main(String[] s)
MarshalUnmarshal MU=new MarshalUnmarshal();


after executing i am getting this error:
errorjavax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"MSG_VER"). Expected elements are (unknown)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!