aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "UnmarshalException" Watch "UnmarshalException" New topic
Author

UnmarshalException

manikandan malathy
Greenhorn

Joined: Sep 17, 2008
Posts: 13
I have a problem in Unmarshall......

This s my code

package Sample;
import java.io.StringReader;

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()
{
try
{
jc=JAXBContext.newInstance("Sample");
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)
 
wood burning stoves
 
subject: UnmarshalException