• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XML Unmarshalling Error

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting the following exception while parsing the xml using JAXB.


javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.opentravel.org/OTA/2003/05", local:"OTA_HotelRateAmountNotifRS"). Expected elements are (none)
10:16:17,533 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:603)
10:16:17,533 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:244)
10:16:17,533 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:239)
10:16:17,533 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:116)
10:16:17,533 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1009)
10:16:17,533 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:446)
10:16:17,533 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:427)
10:16:17,533 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:137)
10:16:17,533 ERROR [STDERR] at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
10:16:17,534 ERROR [STDERR] at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
10:16:17,534 ERROR [STDERR] at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
10:16:17,534 ERROR [STDERR] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
10:16:17,534 ERROR [STDERR] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
10:16:17,534 ERROR [STDERR] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
10:16:17,534 ERROR [STDERR] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
10:16:17,534 ERROR [STDERR] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
10:16:17,534 ERROR [STDERR] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

and my XSD for OTA_HotelRateAmountNotifRS

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.opentravel.org/OTA/2003/05" elementFormDefault="qualified" version="1.005" id="OTA2006A" xmlns="http://www.opentravel.org/OTA/2003/05" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="OTA_HotelRateAmountNotifRS">
<xs:annotation>
<xs:documentation xml:lang="en">The OTA_HotelInvCountNotifRS is the message used to indicate the status of processing the OTA_HotelInvCountNotifRQ message.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:complexContent>
<xs:extension base="MessageAcknowledgementType">
<xs:sequence>
<xs:element name="Inventories" type="InvCountType" minOccurs="0"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:schema>

"MessageAcknowledgementType" is defined as follows

<xs:complexType name="MessageAcknowledgementType">
<xs:sequence>
<xs:choice>
<xs:sequence>
<xs:element name="Success" type="SuccessType">
<xs:annotation>
<xs:documentation xml:lang="en">The presence of the empty Success element explicitly indicates that the OTA versioned message succeeded. </xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Warnings" type="WarningsType" minOccurs="0">
<xs:annotation>
<xs:documentation xml:lang="en">Used in conjunction with the Success element to define one or more business errors.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:element name="Errors" type="ErrorsType">
<xs:annotation>
<xs:documentation xml:lang="en">Errors is returned if the request was unable to be processed.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
<xs:element name="UniqueID" type="UniqueID_Type" minOccurs="0">
<xs:annotation>
<xs:documentation xml:lang="en">May be used to return the unique id from the request message.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element ref="TPA_Extensions" minOccurs="0"/>
</xs:sequence>
<xs:attributeGroup ref="OTA_PayloadStdAttributes"/>
</xs:complexType>

attributeGroup "OTA_PayloadStdAttributes" contains the following attributes
1.EchoToken
2.TimeStamp
3.Target
4.Version
5.TransactionIdentifier
6.SequenceNmbr
7.TransactionStatusCode



Anyone please advice me what are the changes i need to do in XSD for successful parsing of XML ?
 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That must mean that your XML doesn't conform to those schemas. That's just a guess, though, because you didn't post any of the XML you claim is causing the problem. If you still haven't fixed the problem, I suggest you post your XML.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic