Generating Java beans from an XML schema

To allow developers to quickly build an XML application, the XML schema editor supports the generation of beans from an XML schema. Using these beans, you can quickly create an instance document or load an instance document that conforms to the XML schema.

The following instructions were written for the Resource perspective, but they will also work in many other perspectives.

To generate beans from an XML schema, follow these steps:

  1. Create a project that is configured to work with Java™ source code. The beans you generate from your XML schema must be contained in a project that is configured to work with Java source code. Projects such as a Java, Web, or Fragment project are all configured to work with Java source code. You do not have to store the XML schema file in a project that is configured to work with Java source, however, we recommend it. 
  2. In the Navigator view, right-click the XML schema file and click Generate > Java. The Generate Java wizard opens.
  3. From the Generator list, select SDO Generator.
  4. In the Container field, specify your project or folder to contain the Java beans. Click Browse to select from a list of all valid projects and folders that exist in the workbench.
  5. Click Finish.
  6. The beans and classes appear in the Navigator view in the location you specified. Double-click them to edit them in the Java or Class editor. To use the generated code, a utility class is provided with a set of methods that can be used to load and save XML instance documents.
    Note: The Samples gallery contains a Generating SDO from XML schema sample that explains how to use the generated SDOs.
Related concepts
Generating files
Related information
Service Data Objects

Feedback