Java Reference
In-Depth Information
Using this pattern, you declare all elements as global, but declare all types locally. You set all
elements into the global namespace, making the schema available for reuse by other schemas.
Each element acts as a single definition “slice,” which can be combined with others.
With Salami Slice, you have many components, all defined individually, which are then
brought together under global elements. Russian Doll is absolutely rigid and inflexible in its
design, giving you the closed definition of the single element it defines. Salami Slice is en-
tirely open, allowing a wide variety of possible combinations. The physical structure of an
actual Russian doll allows only one way to put the doll together; slices of salami offer no guid-
ance for how they might be arranged on a sandwich.
Salami Slice has the following characteristics:
▪ All elements are global.
▪ All elements are defined within the global namespace.
▪ All types are local.
▪ Element declarations are never nested.
▪ Element declarations are reusable. Salami Slice offers the best possibility for reuse of all
the schema design patterns.
▪ It is difficult to determine the intended root element, as there are many potential choices.
Example 2-2 shows your book schema redesigned with Salami Slice.
Example2-2.Book.xsd using the Salami Slice schema design pattern
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://ns.soacookbook.com/salami"
xmlns:tns="http://ns.soacookbook.com/salami"
elementFormDefault="qualified">
<xsd:annotation>
<xsd:documentation>
Book schema as Salami Slice design.
</xsd:documentation>
</xsd:annotation>
<xsd:element name="book">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="tns:title" />
<xsd:element ref="tns:author" />
<xsd:element ref="tns:category" />
<xsd:element ref="tns:price" />
</xsd:sequence>
</xsd:complexType>
Search WWH ::




Custom Search