You
can create an XML schema and then edit it using the XML schema editor.
Using
the XML schema editor, you can specify element names that indicates
which
elements are allowed in an XML file, and in which combinations.
Before you begin
About this task
To create an XML schema, follow these steps:
Procedure
Create a project to contain the XML schema. If
you intend
to generate Java beans from your XML schema,
we recommend that you
create a Java project to contain both the
schema and the beans.
The beans must be contained in a Java project,
however, the XML schema does
not have to be. Otherwise, it does not matter what kind of project
you create.
In the workbench, select File > New >
Other > XML > XML Schema and click Next. If you cannot see the XML option, select
the Show
All Wizards check box.
If you
are prompted to enable XML Development capabilities, click OK.
Select the project or folder that will contain the
XML schema.
In the File name field, type the
name of
the XML schema, for example MyXMLSchema.xsd.
The name
of your XML schema must end in .xsd.
Click Finish.
Results
The XML schema opens in the XML schema editor.
What to do next
The
following links explain alternate ways to create XML schemas:
Selecting an XML schema view
You can use two views to edit
an XML schema file, Simplified view
or Detailed view. Use the Simplified view if you are new to XML schemas.
Use
the Detailed view if you are familiar with XML schemas and their more
complicated
constructs (for example, groups, choices, attribute references, and
directives).
Generating XML schema files from XML files If
you have an XML file that does
not have an XML schema, you can
use your XML file to create an XML schema for it. Generating an XML
schema
from your XML file saves you time by creating an XML schema that will
work
with your XML file, and contains all of the elements that were in
your XML
file.