Edit online

Generating Java Classes from XML Schema

Oxygen XML Editor includes a tool for generating Java classes from an XML Schema (XSD) file. The Generate Java classes from XML Schema (XSD) action for invoking the tool can be found in the Tools menu. It requires an additional add-on to be installed, so the first time you invoke the action, Oxygen XML Editor will present a dialog box asking if you want to install it. Once installed, you need to restart Oxygen XML Editor and the action will invoke the Java class generator tool.

Quick Installation

You can drag the following Install button and drop it into the main editor in Oxygen to quickly initiate the installation process:

Install

Manual Installation

To manually install it the add-on, follow these instructions:
  1. Go to Help > Install new add-ons to open an add-on selection dialog box.
  2. Enter or paste https://www.oxygenxml.com/InstData/Addons/default/updateSite.xml in the Show add-ons from field or select it from the drop-down menu.
    Note: If you have issues connecting to the default update site, you can download the add-on package, unzip it, then use the Browse for local files action in the Install new add-ons dialog box to locate the downloaded addon.xml file.
  3. Select the Java Classes Generator add-on and click Next.
  4. Read the end-user license agreement. Then select the I accept all terms of the end-user license agreement option and click Finish.
  5. Restart the application.

Result: The Generate Java classes from XML Schema (XSD) dialog box is now available and can be selected from the Tools menu.

Generating Java Classes

To generate Java classes, follow these steps:

  1. Select the Generate Java classes from XML Schema (XSD) action from the Tools menu.

    Step Result: The Generate Java classes from XML Schema (XSD) dialog box is displayed:

    Figure 1. Generate Java Classes from XML Schema (XSD) Dialog Box
  2. Choose or enter the XSD URL of the XML Schema document.
  3. Choose the path for the Output folder where the generated files will be stored.
  4. [Optional] You can choose the Package name for the Java package that will contain the generated source files. If not specified, the name will be generated based on the value of the @targetNamespace attribute.
  5. [Optional] You can select the Open in Editor option to open the ObjectFactory.java file in the editor. This java class contains factory methods for all other classes in the package.
  6. Click the Generate button.

Result: The Java class files will be generated inside the new package, located in the specified output folder.