Working With XML Schemas

See Also 

Like DTDs, XML schemas specify the valid grammar of an XML document. Schemas have several advantages over DTDs, such as better extensibility, support of namespaces and data types, and an XML code base.

In the IDE, you can create XML schemas and edit them in the Source Editor. You can also use schemas as XML document constraints and validate your XML documents against them.

To create an XML schema:

  1. From the main window, choose File and choose New.
  2. Expand the XML folder and select XML Schema.
  3. Specify a name and location for the file and click Finish.

    A new XML schema node (XML shcema node icon) appears in the Explorer.

To edit an XML schema:

To create an XML document that is constrained by an existing XML schema:

  1. From the main window, choose File and choose New.
  2. In the New wizard, expand the XML folder and select XML Document. Then click Next.
  3. Specify a name and location for the document. Then click Next.
  4. Select XML Schema-Constrained Document and click Next.
  5. In the Schema URI field, type or browse to the schema location. Once you have selected a schema, the wizard suggests values for the remaining fields in the pane.
  6. Specify the namespace for your document. The wizard automatically enters the schema's targetNamespace in this field.
  7. Type or select the document root for your document in the Document Root combo box. The combo box contains all of the schema's exposed elements.
  8. Click Finish.
tip You can add an XML schema constraint to an existing XML document by referencing the schema in the XML document's root element.

You can also validate an XML schema against the general grammar constraints for all XML schemas.

To validate an XML schema:

See also
Validating an XML Document
DTD Nodes in the Explorer

Editing an XML Document

Legal Notices