Defining XML Schema using Russian Doll Approach
Hi,
As I talked about the ‘Salami Slice’ pattern in my previous post. Now ‘Russian Doll‘ is the another design pattern which gets frequently used while Defining XML Schema.
Russian Doll
This Pattern follows a nested structure by defining only one global element, such as “Product” based on the below example. All child element are defined inside the root element in local scope manner. The root element must define within the global namespace.
Sample XSD in a Russian Doll pattern.
<xs:element name=”Product”><xs:complexType>
<xs:sequence>
<xs:element name=”ProductDtls”>
<xs:complexType mixed=”false”>
<xs:sequence>
<xs:element name=”name” type=”xs:string” minOccurs=”0″ />
<xs:element name=”category” type=”xs:string” minOccurs=”0″ />
</xs:sequence>
</xs:complexType>
</xs:element><xs:element name=”PriceRange”>
<xs:complexType mixed=”false”>
<xs:sequence>
<xs:element name=”minPrice” type=”xs:string” minOccurs=”0″/>
<xs:element name=”maxPrice” type=”xs:string” minOccurs=”0″ />
</xs:sequence>
</xs:complexType>
</xs:element></xs:sequence>
</xs:complexType>
</xs:element>
The Russian Doll pattern provides the least extensible schema structure. In the example listed above, all the components except the root element are localized and not reusable. This schema fits into a document-style WSDL but is not well suited for RPC style since there is no global level type defined.
In all this pattern provides very less reuse for the defined Schema elements. Because it bundle everything together into a tidy, single unit and with single namespace. Russian Doll is the simplest and easiest pattern to use by instance developers.
Hope this helps.
–
Thanks,
R Vashi
Recent Comments