![]() |
| Previous Top Next |
Schema Sources |
The schema sources are the starting point of the design, and design structure can be influenced by: (i) choices you make during schema selection, and (ii) the root elements you select in the schema.
Schema selection
The selection of the schema is done in the Design Overview sidebar using the Add New Schema command, which pops up a a menu listing the methods you can use to add different types of schemas (screenshot below).

The schema source can be selected from a file, from a DB, or be user-defined. An important point to consider is whether you will be using global templates, and whether elements you wish to create as global templates are defined as global elements in the schema. When adding a DTD from file, remember that all elements defined in the DTD are global elements. When adding an XML Schema from file, it is worth checking what elements are defined as global elements and, should you wish to make any change to the schema, whether this is permitted in your XML environment. When a DB is selected, during the import process, you can select what tables from the DB to import. This selection determines the structure of the XML Schema that will be generated from the DB.
| Note: | You can select multiple schemas, of which one schema is designated the main schema (right-click the schema in the Design Overview sidebar and select Set As Main Schema). The document node of the main schema is the entry point of the main template. The selection and presence of subsidiary schemas in the schema sources enable nodes from these schemas to be included in the design. |
If a schema source has multiple global elements, then multiple root elements (document elements) can be selected for use in the design. This enables the SPS design to have templates that match multiple document elements. The advantage of this is that if an SPS, say UniversalSPS.sps, based on UniversalSchema.xsd has one template each for its two root elements, Element-A and Element-B, then this one SPS can be used with an XML instance document which has Element-A as its document element as well as with another XML instance document which has Element-B as its document element. For each XML instance, the relevant template is used, while the other is not used. This is because for the document element of each XML instance document, there is only one template in the SPS which matches that document element. For example, the document element /Element-A will be matched by the template which selects /Element-A but not by that which selects /Element-B. In this connection, it is important to remember that if multiple global elements are defined in the schema, an XML document with any one of these global elements as its document element is valid (assuming of course that its substructure is valid according to the schema).
To set up the SPS to use multiple root elements (document elements), click the
button to the right of the /Root elements entry of the schema. The following dialog pops up.

The dialog lists all the global elements in the schema. Select the global elements that should be available as root elements (document elements), and click OK. The schema tree would then look something like this:

For the SPS represented in the screenshot above, two templates, to match both the document elements, can now be created in the design. The SPS can then be used with different XML instances that are valid according to NanonullOrg.xsd, some with Department as document element, others with OrgChart as document element. The appropriate template will be used in the case of each instance document.
See also:
Schema Tree sidebar, for a description of the Schema Tree sidebar and how to use it.
|