Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This is explained with an example. Screenshot of the sample Sample schema used is shown as provided below.:

Image Removed
Figure 1: Schema with derived types

Code Block
titleSample Schema with derived types
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.books.org" targetNamespace="http://www.books.org" elementFormDefault="qualified">
   <xsd:complexType name="Publication">
      <xsd:sequence>
         <xsd:element name="Title" type="xsd:string" />
         <xsd:element name="Author" type="xsd:string" />
         <xsd:element name="date" type="xsd:gYear" />
      </xsd:sequence>
   </xsd:complexType>
   <xsd:element name="SamplePublication" type="Publication" />
   <xsd:complexType name="BookPublication">
      <xsd:complexContent>
         <xsd:extension base="Publication">
            <xsd:sequence>
               <xsd:element name="ISBN" type="xsd:string" />
               <xsd:element name="Publisher" type="xsd:string" />
            </xsd:sequence>
         </xsd:extension>
      </xsd:complexContent>
   </xsd:complexType>
   <xsd:complexType name="PaperPublication">
      <xsd:complexContent>
         <xsd:restriction base="Publication">
            <xsd:sequence>
               <xsd:element name="Date" type="xsd:gYear" />
               <xsd:element name="Location" type="xsd:string" />
            </xsd:sequence>
         </xsd:restriction>
      </xsd:complexContent>
   </xsd:complexType>
</xsd:schema>

The schema provided above contains an element SamplePublication of type Publication. The type Publication has two derived types: BookPublication (extension) and PaperPublication (restriction). When the schema is loaded in Mapper, the element SamplePublication is shown in Mapper.

Image RemovedImage Added
Figure 21: Sample Publication with default type

Since the type Publication has derived types, user can change the type of the element SamplePublication. All the derived types will be shown when right-clicked on the SamplePublication element and the user can select the required derived type as shown in the figure below.

Image RemovedImage Added
Figure 32: Available derived types

When a different type is selected, the structure will be refreshed to show the selected type.

Image RemovedImage Added
Figure 43: SamplePublication element when BookPublication type is chosen

...

Adaptavist ThemeBuilder EngineAtlassian Confluence