sbanerjee
sbanerjee

Reputation: 179

How can I convert the below xsd file to java file?

plz help me to convert the below xsd into java code. I am using maven also.

![an xsd for login web service]

<xs:element name="loginRequest">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="channel" type="xs:string"/>
            <xs:element name="username" type="xs:string"/>
            <xs:element name="password" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>

<xs:element name="loginResponse">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="response" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>

Upvotes: 0

Views: 142

Answers (1)

laune
laune

Reputation: 31300

You can use xjc, which comes with your Java development kit to create Java classes from an XML schema file. You can run this from the command line:

xjc schemafile.xsd

You'll have to wrap the elements like this:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <!-- your elements -->
</xs:schema>

Upvotes: 1

Related Questions