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>
  • Does this answer your question? [How to generate JAXB classes from XSD?](https://stackoverflow.com/questions/11463231/how-to-generate-jaxb-classes-from-xsd) – xerx593 Oct 20 '21 at 09: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. – Prashant Kumar Oct 20 '21 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. – kimbert Oct 20 '21 at 14:53
  • @kimbert I have to convert these xsd's into Avro object and send it to kafka topic. – Prashant Kumar Oct 22 '21 at 03: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. – kimbert Oct 22 '21 at 13:56

0 Answers0