XML Schema


XML Schema:

  1. Advantages of XML Schema
    1. Support for data-types
    2. Uses XML syntax
    3. Support for content model ( mixed content, exact number of occurences of elements, named group of elements)
    4. Extensible
    5. Self documenting
  2. Schema components is a generic term for the blocks that make up the abstract data model of the schema
  3. 3 groups of components : Primary, Secondary, Helper
  4. Primary components:
    1. Element declaration
    2. Simple type definition:
      Built-in types: Primitive, Derived
      3 varieties of data-types: Atomic, List, Union
      User derived types
    3. Complex type definition
    4. Attribute Declaration
  5. Default value of minOccurs and maxOccurs is 1
  6. Element declaration can be local or global. Global – child of the “schema” element. Local – nested inside schema structure and not direct child of schema element
  7. MinOccurs and maxOccurs cant be used with global element declaration
  8. Any globally defined element can be used as the root element of a document
  9. Attribute values are always simple types
  10. Attributes are unordered.
  11. Attributes can be global or local
  12. “use” attribute cannot be used in globally declared attributes
  13. It does not matter whether complex type is defined before or after the element declaration as long as it is present in the schema document
  14. Simple type can not have any child elements or carry attributes.
  15. Simple types are the atoms of information considered distinct to XML Schema and they cannot be split up.
  16. Primitive data types are data types in their own right and they are not defined in terms of other types
  17. Derived typed are built from the definitions of other data-types
  18. User derived types are derived by the author of the schema and are particular to that schema.
  19. Atomic data type is one that has a value that cannot be divided atleast not in the context of XML Schema. Atomic data type is not analogous to primitive type. Atomic type can be primitive or derived.
  20. Built-in list types are: IDREFS, ENTITIES, NMTOKENS
  21. Named complex type is created when the content model is to be reused, otherwise anonymous types can be created.
  22. “schema” is the root element of the Schema document.
  23. Attributes are to be defined as part of the complex type because simple types can only hold atomic values and not carry attributes or have child elements.
  24. Content models – ANY, EMPTY, Element only, Mixed
  25. ANY is the default content model
  26. EMPTY- for this, define a complex type and restrict it from anyType so that it can only carry attributes.
  27. Secondary components:
    1. Model group definition
    2. Attribute groups
    3. Notation declaration
    4. Identity constraints
      Unique Values
      Key and KeyRef
      Default or Fixed element content
      Specifying null values
  28. Notation declaration – associates a name with an identifier for an application used to view that sort of a notation.
  29. Key and KeyRef – primary and foreign key respectively.
  30. XML Schema data types are composed of three parts: Value space, Lexical space, Set of facets.
  31. Value spaces have certain facets: order, bound, cardinality, equality, numeric or non-numeric dichotomy.
  32. Default data-type for any element is “string”
  33. “all”, “sequence” and “choice” are three compositors
  34. all – all the elements can occur in any order. Elements can occur only once or not at all
  35. choice – any one of the elements can occur, but only one
  36. sequence – elements occur in the specified order
  37. minOccurs and maxOccurs can’t be set to more than 1 in “all” compositor
  38. sequence and choice compositors can be combined whereas “all” cannot be combined with any other compositor


Like it? Please Spread the word!

Post Your Thoughts