This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes javax.xml.bind.UnmarshalException: unexpected element (uri: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "javax.xml.bind.UnmarshalException: unexpected element (uri:"" Watch "javax.xml.bind.UnmarshalException: unexpected element (uri:"" New topic

javax.xml.bind.UnmarshalException: unexpected element (uri:"

Suresh Sudineni

Joined: Jul 18, 2008
Posts: 3

i have generated javaclasses from XSD through JAXB. and now i want to convet my Xml to JAXB to do the xml validations.

can anyone send me the solution for below Exception

javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"orderRequest"). Expected elements are <{}WSCallback>,<{}WSContext>,<{}WSConversationId>,<{}WSCorrelationId>,<{}WSEndUserToken>,<{}WSEnterpriseLogging>,<{}WSException>,<{}WSHeader>,<{}WSMessageData>,<{}WSResponseHeader>,<{}WSResponseMessageExpiration>,<{}deliveryAcknowledgement>,<{}modifyEquipmentStatusResponse>
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Unknown Source)

i am using below code

JAXBContext jc1 = JAXBContext.newInstance("com.att.erp_epic.commondata");
Unmarshaller unmarshal = jc1.createUnmarshaller();
Object output = unmarshal.unmarshal(new StreamSource(new StringReader(xmlMessage)));
It is sorta covered in the JavaRanch Style Guide.
subject: javax.xml.bind.UnmarshalException: unexpected element (uri:"
Similar Threads
JAXB with log.xml
JAXB parser
Wanted: Help serializing Generic Maps!
javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"AirAvailabilityRS")
Problem JAXB Unmarshaller if order of XML tags differs.