< Previous | Next >

Lesson 1.4: Generate Java beans for your XML schema

To allow developers to quickly build an XML application, the XML schema editor supports the generation of Java™ beans from an XML schema. Using these Java beans, you can quickly create an instance document or load an instance document that conforms to the XML schema without coding directly to the Document Object Model (DOM) APIs.

Before you begin, you must complete Lesson 1.3: Edit and validate your XML schema.

Create a Java project to contain the beans

The beans you generate from University.xsd file must be contained in a project that is configured to work with Java source code.
  1. Click File > New > Other. In the New window, select Java > Java Project. Click Next.
  2. Type UniversityJava in the Project name field and click Finish.
  3. You will be prompted to switch to the Java perspective. Click Yes.

Generate the beans

  1. In the Navigator view, right-click University.xsd and select Generate > Java.
  2. Ensure that SDO Beans Generator is selected in the Generator list and the UniversityJava project you just created is selected as the Container, then click Finish.
The beans appear in the Navigator view in the UniversityJava project. You can ignore any warnings that appear in the Problems view.

Lesson checkpoint

The XML Schema editor provides the necessary tools to utilize Java beans without necessarily having an in depth understanding of the DOM API.

This exercise teaches the basics of Java beans. Now that you have completed this lesson, you should be able to:
  1. Create a Java project to contain the beans.
  2. Generate the Java beans.
< Previous | Next >