0

I have 3 xsd schema in which one xsd is referring to 2 other xsd's. How to convert these xsd schema into java object. I have tried unmarshalling using JAXB and also tried many things.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.AAA.com/BookingNotification"
    targetNamespace="http://www.AAA.com/BookingNotification" 
    xmlns:dt="http://www.AAA.com/DataTypes" 
    xmlns:bdt="http://www.AAA.com/BookingDataTypes"
    version="1.0.0">
    
    <xs:import namespace="http://www.AAA.com/DataTypes" schemaLocation="DataTypes.xsd" />
    <xs:import namespace="http://www.AAA.com/BookingDataTypes" schemaLocation="BookingDataTypes.xsd" />

    <xs:element name="bookingNotification">
        <xs:complexType>
            <xs:annotation>
                <xs:documentation>
                    Notificacion enviada de Booking.
                    Version: "1.0.0"
                </xs:documentation>
            </xs:annotation>
            <xs:sequence maxOccurs="1" minOccurs="1">
            
                <xs:element name="header" minOccurs="1" maxOccurs="1" nillable="false" type="dt:header" />
                
                
                <xs:element name="bookingId" type="xs:unsignedLong" nillable="false"/>
            
                
                <xs:element name="details"  minOccurs="0" maxOccurs="1" type="bdt:bookingDetails" />                
                
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
5
  • Does this answer your question? How to generate JAXB classes from XSD? Commented Oct 20, 2021 at 9:33
  • @xerx593 No, i have generated the classes using xjc. My question is I am getting xml schema as input msg in queue and I have convert that msg into java object. Commented Oct 20, 2021 at 10:13
  • Why are you receiving xml schema? What exactly does your application do with these xsds? Normally, an application receives XML, and it uses (static) xsds to validate the XML. Commented Oct 20, 2021 at 14:53
  • @kimbert I have to convert these xsd's into Avro object and send it to kafka topic. Commented Oct 22, 2021 at 3:46
  • I think you have misunderstood the requirement. You are probably receiving XML documents on the input queue. So the first comment by xerx593 is worth a second look. Commented Oct 22, 2021 at 13:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.