Creating, Opening, and Saving XML Documents
When creating, opening, or saving XML documents, the following issues are involved:
•In what view will the XML document open: Text View, Grid View, or Authentic View
•When a new XML document is created, whether a schema (XML Schema or DTD) will be automatically assigned, manually assigned, or not assigned
•If a schema is assigned to the XML document, whether the document will be validated automatically on opening and/or saving
There are application-wide settings for specifying in what view XML documents (new and existing) should open. These settings are in the Options dialog (Tools | Options).
In the File Types section of the Options dialog, select a file type of .xml and, in the Default View pane, check the required editing view (Text or Grid). Note that: (i) Schema View can be used only for XML Schema; and (ii) Browser View is a display view, not an editing view.
In the File Types tab, you can also set XMLSpy as the default editor for the selected file type.
An XML document can be edited in Authentic View if a StyleVision Power Stylesheet (SPS) has been assigned to it. When an XML file with an associated SPS is opened, you can specify that it opens directly in Authentic View. Do this by checking the Always open in Authentic View option in the View section of the Options dialog. If this option is not checked, the file will open in the default view specified for .xml files in the File Types tab (see above).
When a new XML file is to be created, select the menu command File | New. This pops up the Create New Document dialog (screenshot below).
Notice that there are several options for the XML document type. The option marked Extensible Markup Language creates a generic XML document. Each of the other options is associated with a schema, for example the DocBook DTD. If you select one of these options, an XML document is created that has (i) the corresponding schema automatically assigned to it, and (ii) a skeleton document structure that is valid according to the assigned schema. Note that you can create your own skeleton XML document. If you save it in the Template folder of the application folder, your skeleton document will be available for selection in the Create New Document dialog.
If you select the generic Extensible Markup Language document type, you will be prompted for a schema (DTD or XML Schema) to assign to the document. At this point, you can choose to browse for a schema or go ahead and create an XML document with no schema assigned to it.
You can, of course, assign a schema via the DTD/Schema menu at any subsequent time during editing.
If an existing XML document has a schema assigned to it, then it can be automatically validated on opening and/or saving. The setting for this is in the File section of the Options dialog (Tools | Options).
The automatic validation settings in the File tab can be combined with a setting in the File Types tab to disable automatic validation for specific file types. Using the settings in the two tabs together enables you to specify automatic validation for specific file types.