How to Generate XML from XSD in Eclipse Example

If you work on web services, you must have been using XSD. To test the web service, you need to generate XML from XSD file.

Generate XML from XSD

We can use Eclipse IDE to easily generate XML from the XSD file. Just follow the below steps to get XML from XSD.

    1. Select XSD File in project, right click for Menu and select Generate > XML File…
    2. Provide the XML file Name and XML File location in the popup window. Click on next button.
    3. Select the root element for which you want to generate the sample XML file, make sure to select checkboxes for “Create optional attributes” and “Create optional elements”. Below image shows how the window will look.
  1. Click on Finish button and it will generate the XML File for you with the default values. Now you can change the values according to your requirement.

XSD to XML Example

Here is the XSD for which I will be generating XML files.


Since Employee.xsd has two root elements; empRequest and empResponse; I can generate two XML files.

Here are the XML files generated by Eclipse, the values are changed by me.



I hope this quick tip will help you in generating XML from XSD easily.

By admin

Leave a Reply

%d bloggers like this: