"> ">

Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Global versus Local XML Schemas: Best Practices A set of guidelines for designing XML Schemas Created by discussions on xml-dev.

Similar presentations


Presentation on theme: "1 Global versus Local XML Schemas: Best Practices A set of guidelines for designing XML Schemas Created by discussions on xml-dev."— Presentation transcript:

1 1 Global versus Local XML Schemas: Best Practices A set of guidelines for designing XML Schemas Created by discussions on xml-dev

2 2 Issue When should an element or type be declared global versus when should it be declared local? Recall: a global element is an element declaration that is an immediate child of. A local element is an element declaration that is nested within another component. Ditto for complexTypes and simpleTypes.

3 3 Global type definition Global element declaration Local element declarations Local type definition <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.publishing.org" xmlns="http://www.publishing.org" elementFormDefault="qualified">

4 4 Three Design Approaches Russian Doll Design –Components are nested (inlined) within other components - i.e., self-contained components Salami Slice Design –Components are declared as separate element declarations, then assembled them together Venetian Blind Design –Components are defined as type definitions, then elements are constructed using the types

5 5 Russian Doll Design Components with components (boxes within boxes) - just like a Russian Doll

6 6 Salami Slice Design Slice up the components into individual element declarations, then assemble them together (using “ref”) - just like a salami sandwich

7 7 Venetian Blind Design Lay out the components as individual type definitions, use elementFormDefault to hide/expose component namespaces - just like slats on a Venetian blind hide expose elementFormDefault

8 8 Characteristics of Russian Doll Design Opaque Content: nested, invisible components –Impact: few reusable components Localized Scope: nested components have scope limited to the component they are nested within –Impact: can hide (localize) namespaces Compact: components are bundled into a single, tidy unit Decoupled: no dependencies on other components Cohesive: all related components are grouped together

9 9 Characteristics of Salami Slice Design Transparent Content: the components are globally declared –Impact: components are reusable Global scope: all components are global –Impact: namespaces are always exposed; no namespace hiding is possible Coupled: components are interconnected –Impact: changes to components have a ripple effect Cohesive: related components are grouped together

10 10 Characteristics of Venetian Blind Design Maximum reuse - the components are globally defined as reusable types Maximum namespace control - can hide or expose the elements since they are nested within type definitions Easy exposure switching - elementFormDefault switches namespace exposure on or off Coupled - components are interconnected Cohesive - all related components are grouped together

11 11 Guidelines Use the Russian Doll design when –minimal schema size is required –decoupled components is required Use the Salami Slice design when –instance document authors require the ability to use synonyms/aliases for tag names Use the Venetian blind design when –you require flexibility in hiding/exposing namespaces in instance documents –component reuse is important Do Labs 1,2,3


Download ppt "1 Global versus Local XML Schemas: Best Practices A set of guidelines for designing XML Schemas Created by discussions on xml-dev."

Similar presentations


Ads by Google