IntelliJ IDEA 2025.2 Help

Generate an XML Schema from Java Code

This topic describes how to have an XML Schema generated on the basis of a Java class, which involves mapping the members of the Java class to the elements of the XML Schema. With IntelliJ IDEA, this transformation can be done using the JAXB.

Install the Jakarta EE: Web Services (JAX-WS) plugin

This functionality relies on the Jakarta EE: Web Services (JAX-WS) plugin, which you need to install and enable.

  1. Press Ctrl+Alt+S to open settings and then select Plugins.

  2. Open the Marketplace tab, find the Jakarta EE: Web Services (JAX-WS) plugin, and click Install (restart the IDE if prompted).

Generate an XML Schema from a Java class using JAXB

  1. Open the necessary class in the editor.

  2. In the main menu, go to Tools | XML Actions | Generate XML Schema From Java Using JAXB.

  3. In the dialog that opens, specify the method parameter and return types to be reflected in the generated Schema:

    • To have all the class methods involved, clear the Include parameter and return type of the following methods checkbox.

    • To select specific methods to be involved, select the Include parameter and return type of the following methods checkbox, then select the Add to JAXB generation checkbox next to the desired methods.

18 July 2025