XML Schema Design – How to make good use of it

What is an XML Schema? An XML schema is definitely an approach to describe an XML document containing data and other elements by specifications which might be beyond to XML itself. A normal XML schema contains rules the weather should stick to, the data type, its attributes, constraints and even more. Various languages like Document Definition Type, Relax NG, XML Schema, Name Space Routing Language, Document Schema Definition Language, Schematron, SGML give rise to the design of XML schema while on an XML editor.

XML design is founded on two main processes namely XML coding that requires the task of syntactic aptness as well as validation that is done by the parser specific on the language the design uses. The valid document that complies for the defined schema is said to be a valid instance of the schema. The style of a schema if approached conventionally is often a time consuming process, hence several recommendations are widely used in this aspect which can be explained below.

1) The default namespace inside a schema can be either “XMLschema” or “targetNamespace” based on the designer’s personal preference. In the event of absence of default namespace, the above namespaces are used to explicitly qualify references and components.

2) By creating two identical copies of schemas which differ from each other inside value of elementFormDefault with one set to “qualified” along with the other set to “unqualified”, the designer can hide/localize or expose the namespaces depending on the functionality, during exports and imports of schemas. Avoiding global commitment of elements and attributes is preferred so as to make elementFormDefault behave as a switch.

3) “Russian Doll design” is used where there is a need to minimize size and component coupling, Salami Slice design to match document author’s element substitution and Venetial Blind design for quick namespace switching and reuse of the components.

4) The schema component should be easier to identify by its id specification, i.e, the id value must be long enough to feature types, elements and attributes.

5) Decision to binding the schema components on the namespace or binding a type reference to an implementation needs to be postponed.

6)Creating extensible schemas gives much needed flexibility to modify to older schemas during implementation.

7)Understanding limitations on data types is vital while designing the schema.

8)XML editor with XSLT or Schmeatron is a superb way to express business rules not handled by XML Schemas and some other languages.\

Comments are closed.