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. You can conveniently classify the four most common patterns according to two criteria, namely:
Choosing the appropriate pattern is a critical step in the design phase of schemas. Once you have made a choice, switching the pattern to another one without GUI tools is tedious and error-prone. By using the intuitive XML tools in NetBeans Enterprise 5.5 (henceforth, NetBeans Enterprise Pack), however, you can seamlessly transform one design pattern to another with only a few GUI steps. This article defines the four most common pattern types and their characteristics for reuse. It also explains how NetBeans Enterprise Pack displays, detects, and maintains those patterns, which greatly simplifies the design phase of the schema development cycle. Near the end of the article is a link to a Flash demo that illustrates the procedures described in this article. Contents
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. Management of Design Patterns With NetBeans Enterprise Pack
As mentioned earlier, the XML tools in NetBeans Enterprise Pack smooth the way for switching from one design pattern to another and for maintaining design patterns. This section explains the details. Figure 1 shows the XML tools in NetBeans Enterprise Pack.
The UI works as follows:
Code Generation
The Design view of the XML tools follows the Russian Doll design pattern. Figure 2 is an example, in which a modified
Now look at the Source view of the generated schema for the Design view of the
The generated code follows the Russian Doll design pattern. That is, an element dragged and dropped into the schema is created as a global element. All its child elements and attributes are local. Note: Adding elements, attributes, and complex types from the Palette to Design view can result in a mixed schema. Such schemas do not follow any of the four design patterns described in this article. Transformation
The XML tools in NetBeans Enterprise Pack can also transform one design pattern to another. Follow these steps:
Summary
Choosing the appropriate pattern for your XML schema is crucial in the design phase. Be sure to take advantage of XML tools, such as those in NetBeans Enterprise Pack, to detect and maintain your patterns so that they are readily usable and reusable. References
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Oracle is reviewing the Sun product roadmap and will provide guidance to customers in accordance with Oracle's standard product communication policies. Any resulting features and timing of release of such features as determined by Oracle's review of roadmaps, are at the sole discretion of Oracle. All product roadmap information, whether communicated by Sun Microsystems or by Oracle, does not represent a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. It is intended for information purposes only, and may not be incorporated into any contract.
|
| ||||||||||||