To help you quickly build an XML application, you can use
the Generate Java wizard to generate 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.
Before you begin
Your workspace must contain at least one project that is
configured to work with Java source
code, such as a Java, Web, EJB, or Application Client project.
Note: Some
products might not have the plugin required to perform this task.
About this task
The following instructions were written for the Resource
perspective, but they will also work in other perspectives.
To
generate beans from an XML schema, complete the following steps:
Procedure
- In the Navigator view, right-click the XML schema file
and click . The Generate Java wizard
opens.
Note: The XML schema that you select as input to the generator
must contain at least one global (or top-level) element declaration.
- From the Generator list, select SDO
Generator and then click Next.
- 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.
- By default, the SDO Generator will output Java classes
that comply to the same JDK level that is used by the project that
you chose for your container. To change the JDK compliance level:
- Click Advanced.
- Click Other and then select a
JDK version from the list.
- Click Finish.
Results
The beans and classes are created in the location that you
specified, as well as a utility class containing methods that can
be used to load and save XML instance documents Double-click them
to edit them in the Java or
Class editor