Creating XML Schema from an XML Document

There are two ways to create XML Schema from an XML document:

l The XML to XML Schema document wizard allows you to create XML Schema from any XML document. The XML document you use to create the XML Schema is not modified with attribute information about the new XML Schema when you use this method.
l The Create Schema from XML Content feature in the XML Editor. This method allows you to create an XML Schema (or DTD) based on the current XML document in the XML Editor. The XML document is always modified with namespace and schema location attributes when you use this method. If you choose to create DTD, you have the option of creating internal or external DTD.

Both methods allow you to specify the URI for the generated files (if an XML document has multiple namespaces defined for it, Stylus Studio creates a separate XML Schema associated with each namespace).

Using the XML to XML Schema Document Wizard

Use this procedure when you want to create an XML Schema based on the content of an existing XML document.

To use the XML to XML Schema document wizard:
1. Select File > Document Wizards from the menu.
The Document Wizards dialog box appears.
2. Double-click XML to XML Schema.
The Convert XML to XML Schema dialog box appears.
3. Specify the XML document you want to use to create an XML Schema in the XML Document field.
4. Specify the URI for the generated file(s) in the Generated XSD field.
5. Click the OK button.
Stylus Studio creates the XML Schema file and opens it in the XML Schema Editor.

Using the Create Schema from XML Content Feature

Use this procedure when you want to create an XML Schema based on the content of an existing XML document.

To use the Create Schema from XML Content feature:
1. Open the XML document from which you wish to create an XML Schema.
2. Select XML > Create Schema from XML Content from the Stylus Studio menu.
The Create Schema or DTD dialog box appears.
 
Free Stylus Studio XML Training: