Making the Schema Association Explicit in the XML Instance Document
The schema used by the Content Completion Assistant and document validation engine can be associated
with the document using the
Associate Schema action. For most of the schema types,
it uses the
Associate Schema action. For most of the schema types,
it uses the
xml-model processing instruction, the exceptions being:- W3C XML Schema - The
xsi:schemaLocationattribute is used. - DTD - The
DOCTYPEdeclaration is used.
The association can specify a relative file path or a URL of the schema. The advantage of relative file path is that you can configure the schema at file level instead of document type level.
Select the
Associate schema action from the toolbar or menu to select the schema that will be associated with the XML document. The
Associate Schema dialog box is displayed:
Figure: Associate Schema Dialog Box
The available options are:
- URL - Contains a predefined set of schemas that are used more often and it also keeps a history of the last used schemas. The URL must point to the schema file that can be loaded from the local disk or from a remote server through HTTP(S), FTP(S) or a custom protocol.
- Schema type - Selected automatically from the list of possible types in the Schema type combo box (XML Schema, DTD, Relax NG, Relax NG Compact, Schematron, NVDL) based on the extension of the schema file that was entered in the URL field.
- Public ID - Specify a public ID if you have selected a DTD.
- Add additional association for embedded schematron rules - If you have selected XML Schema or Relax NG schemas with embedded Schematron rules, enable this option.
- Use path relative to file location - Enable this option if the XML instance document and the associated schema contain relative paths. The location of the schema file is inserted in the XML instance document as a relative file path. This practice allows you, for example, to share these documents with other users, without running into problems caused by multiple project locations on physical disk.
- Keep existing schema associations - Enable this option to keep the associations of the currently edited document with a Schema when you associate a new one.
The association with an XML Schema is added as an attribute of the root element. The
Associate schema action adds one of the following:
xsi:schemaLocationattribute, if the root element of the document sets a default namespace with anxmlnsattribute.xsi:noNamespaceSchemaLocationattribute, if the root element does not set a default namespace.
The association with a DTD is added as a DOCTYPE declaration. The
association with a Relax NG , Schematron or NVDL schema is added as xml-model processing instruction.