Search Posts

Visits: 492

XML schemas contain numerous design patterns, the most common of which are Russian Doll, Salami Slice, Venetian Blind, and Garden of Eden. The patterns vary according to the number of their global elements or types. A global element or type, which is a child of the schema, contains a target namespace.

This post is summary of “Introducing Design Patterns in XML Schemas” By Ayub Khan and Marina Sum, Updated: November 9, 2006

http://www.oracle.com/technetwork/java/design-patterns-142138.htm

Definitions, Rules, and Examples

This section describes the four most common pattern types and shows you how to define them in XML schemas. Most real-world schemas adopt Venetian Blind or Garden of Eden as their pattern of choice because they are the most reusable.

The following table summarizes the four patterns’ characteristics and their advantages and disadvantages.

Russian Doll

The Russian Doll design contains only one single global element. All the other elements are local. You nest element declarations within a single global declaration, which you can use once only. You must define only the root element within the global namespace.

See the following example.

Since it contains only one single global element, Russian Doll is the simplest and easiest pattern to use by instance developers. However, if its elements or types are intended for reuse, Russian Doll is not suitable for schema developers.

Salami Slice

All the elements in the Salami Slice design are global. No nesting of element declarations is required and you can reuse the declarations throughout the schema. You must define all the elements within the global namespace.

See the following example.

The fact that all the elements in Salami Slice are global means a greater degree of reusability than Russian Doll and Venetian Blind. However, this design pattern contains many potential root elements.

Venetian Blind

The Venetian Blind design contains only one global element. All the other elements are local. You nest element declarations within a single global declaration by means of named complex types and element groups. You can reuse those types and groups throughout the schema and must define only the root element within the global namespace.

See the following example.

Venetian Blind is an extension of Russian Doll, in which all the types are defined globally. Because it has only one single root element and all its types are reusable, Venetian Blind is suitable for use by both instance developers and schema developers.

Garden of Eden

The Garden of Eden design is a combination of Venetian Blind and Salami Slice. You define all the elements and types in the global namespace and refer to the elements as required.

See the following example.

Because it exposes all its elements and types globally, Garden of Eden, like Salami Slice, is completely reusable. However, because Garden of Eden exposes multiple elements as global ones, there are many potential root elements.

XBRL GL is designed with Garden of Eden design pattern.