Welcome to MSDN Blogs Sign in | Join | Help

Schema Design Patterns: Venetian Blind

This is the third of five entries talking about schema design patterns.  In previous entries the Russian Doll approach and the Salami Slice approach were discussed.

The Venetian Blind approach is similar to the Russian Doll approach in that they both use a single global element.  The Venetian Blind approach describes a modular approach by naming and defining all type definitions globally (as opposed to the Salami Slice approach which declares elements globally and types locally).  Each globally defined type describes an individual "slat" and can be reused by other components.  In addition, all the locally declared elements can be namespace qualified or namespace unqualified (the slats can be "opened" or "closed") depending on the elementFormDefault attribute setting at the top of the schema.  If the namespace is unqualified then the local elements in the instance document must not be qualified with the prefix of the namespace.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="TargetNamespace" xmlns:TN="TargetNamespace" xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:element name="BookInformation" type="TN:BookInformation" maxOccurs="unbounded"/>
    <xs:complexType name="BookInformation">
        <xs:sequence>
            <xs:element name="Title"/>
            <xs:element name="ISBN"/>
            <xs:element name="PeopleInvolved" type="TN:PeopleInvolvedType" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="PeopleInvolvedType">
        <xs:sequence>
            <xs:element name="Author"/>
            <xs:element name="Publisher"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>

 

The advantages are that since all complex and simple types are defined globally they are available for reuse.  In addition, the option exists to hide the namespace prefix for all locally defined elements in the instance document.

The disadvantages are that the schema is verbose, it is not self contained and it may be coupled with other schemas.

This type of approach is good when flexibility, reuse and namespace exposure are important.  This approach uses a combination of local and global types unlike the Russian Doll approach which all components are locally declared and the Salami Slice where all components are globally declared.  This is important as it provides the flexibility to create a schema for most needs since the types can be assigned to elements and extended or restricted as needed.  This would be an appropriate design when data is transferred between diverse organizations or business units since it provides each group the flexibility for modifications for each specific requirement.

Published Friday, April 29, 2005 12:27 PM by skaufman
Filed under:

Comments

# Schema Design Patterns: Garden of Eden

Tuesday, May 10, 2005 10:54 PM by Stephen Kaufman's WebLog
This is the fourth of five entries talking about schema design patterns.&amp;nbsp; In previous entries the...

# DataSets and Web Services

Wednesday, May 11, 2005 1:55 AM by Erno de Weerd

# DataSets and Web Services

Wednesday, May 11, 2005 2:15 AM by Erno de Weerd

# DataSets and Web Services

Wednesday, June 08, 2005 2:20 AM by Erno de Weerd

# DataSets and Web Services

Tuesday, July 19, 2005 8:09 AM by Erno de Weerd

# DataSets and Web Services

Tuesday, August 02, 2005 2:21 AM by Erno de Weerd

# Stephen Kaufman s WebLog Schema Design Patterns Venetian Blind | garden decor

Anonymous comments are disabled
 
Page view tracker