UnmarshalException: unexpected element while parsing xml of referenced type

viewsonic

New Member
The Exception:\[quote\] javax.xml.bind.UnmarshalException: unexpected element (uri:"http://xxx.com/xxxServices/response", local:"A"). Expected elements are <{http://xxx.com/xxxServices/common/acknowledgement}I>\[/quote\]XSD used to generate java classes using xjc:\[code\]<xs:import namespace="http://xxx.com/xxxServices/common/acknowledgement" schemaLocation="../common_acknowledgement_v1.0.xsd"/> <xs:element name="A" type="abr:AType"> </xs:element> </xs:schema>\[/code\]Sample XML I'm trying to parse:\[code\]<ns0:A xmlns:ns0="http://xxx.com/xxxServices/response" xmlns:ns1="http://xxx.com/xxxServices/common/acknowledgement"> <ns1:I UID="24" Type="Sequential"/> <ns1:S> <ns1:Date Year="2012" Month="05" Day="15"/> <ns1:Time Hour="3" Minute="31" Second="54"/> </ns1:S> <ns1:AAck> <ns1:I UID="24" Type="Sequential"/> <ns1:B>eDUA</ns1:B> <ns1:AckResult>Received</ns1:AckResult> <ns1:P>47</ns1:P> </ns1:AAck> </ns0:A>\[/code\]I have using \[code\]JAXBIntrospector\[/code\] to do the unwrapping from \[code\]unmarshal()\[/code\].Also, I've noticed that jaxb is putting the @XmlRootElement tag over another class that is generated \[code\]Ack\[/code\] rather than over \[code\]AType\[/code\] which actually should be the RootElement. I've removed the annotation from over \[code\]Ack\[/code\] to \[code\]AType\[/code\] & I checked with:\[code\]@XmlRootElement(name="A", namespace="http://xxx.com/xxxServices/response")\[/code\]&\[code\]@XmlRootElement(name="AType")\[/code\]I've also checked with \[code\]@XmlRootElement\[/code\] over \[code\]Ack\[/code\] like the way it was generated. Where & What am I doing!
 
Back
Top