File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes UnmarshalException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "UnmarshalException" Watch "UnmarshalException" New topic


manikandan malathy

Joined: Sep 17, 2008
Posts: 13
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)
I agree. Here's the link:
subject: UnmarshalException
jQuery in Action, 3rd edition