Presentation Transcript
MULTIMEDIA DOCUMENTS XML Schema (Part 1) : MULTIMEDIA DOCUMENTS XML Schema (Part 1) Christine Vanoirbeek
EPFL – IC – CGC
Bâtiment BC (Station 14)
1015 LAUSANNE
christine.vanoirbeek@epfl.ch
About DTDs : About DTDs
DTDs aim at defining document classes; they specify
The type of authorized elements in a document instance, as well as potential attributes associated to those elements
The organization rules of elements
2 constructors (sequence and choice)
3 occurrence indicators (optional element, optional element potentially repeated, mandatory element potentially repeated)
DTDs : DTDs An example
DTDs : DTDs Some comments
Global structure of the recipe
2 structures are proposed for « item »; they take into consideration 2 frequent types of recipes [1] [2]
Attributes (role, type, optional or mandatory, assignment of the value)
Empty elements
Links
Why XML schema? : Why XML schema? From publishing to document processing!
Typed elements and attributes
number
date
boolean
…
Hierarchy of types (similarly to programming languages)
Why XML schema? : Why XML schema? The DTDs only offer very basic possibilities for reusing definition of elements
Such as,by example: address, references, etc.
An object oriented approach supporting the specialization and extension of elements definition
Why XML schema? : Why XML schema? Using DTDs, 3 occurrence indicators are available
?
*
+
Using XML schema, it is possible to mention explicitely the minimum and maximum number of occurrences
Example: specification of a limited number of keywords in a paper
Why XML schema? : Why XML schema? DTDs make use of a specific syntax, it implies two major drawbacks
Existing XML-based tools (validation, transformation, etc.) may not be used
Namespaces are not supported
The XML schema language is based on the XML syntax
Objective: to propose a unified paradigm
Namespaces : Namespaces A simple XML schema
Namespaces : Namespaces How to deal with several languages inside an XML document? element complexType schema sequence http://www.w3.org/2001/XMLSchema string integer boolean Recipe Title Comment http://www.recipes.org The XML schema vocabulary allows a document class designer to specify its own vocabulary Item
Main components of an XML Schema : Main components of an XML Schema Prologue
Schema root
Definition of elements
Complex elements (subdivided into sub-elements)
Simple elements (potentially typed)
Mixed elements (text + tagged elements)
Empty elements
Element of « any » type
Definition of structured elements : Definition of structured elements The name of an element is specified via the “name” attribute associated to the XML schema “element”
The composition rule is specified via the child element “complexType”; it may include 3 constructors
sequence
choice
all
The number of occurrences are specified by the attributes “minOccurs” et “maxOccurs”
Sequence : Sequence
Choice : Choice
All : All
Definition of the content models : Definition of the content models Local definition
Definition of the content models : Definition of the content models Global definition
…
Definition of the content models : Definition of the content models Use of an explicit type declaration
…
Definition of the content models (summary) : Definition of the content models (summary) Local definitions
Global definitions
Benefit: definitions are factorized
Use of an explicit type declaration
Object-oriented mechanisms may be used
Important remark: the use of one or another way to define the elements is not reflected in the document instance.
Definition of simple types : Definition of simple types Preliminary remark
Lexical space
Exemple: float (2.57 , +2.57 , .257E1)
Value space
Hierarchy of predefined types : Hierarchy of predefined types Text
Numbers
Time related types
Type derivation : Type derivation Restriction
Limits the value range of the base type; the semantic is not affected
List
Specify the content type of a simple element as a list of values of one type
Union
The value may be specified using alternate type candidates
Restriction : Restriction Use of facets
List : List
1 -25000 1000
Union : Union
Definition of attributes : Definition of attributes Example 1
Definition of attributes : Definition of attributes Example 2
...
Definition of attributes : Definition of attributes Occurrences and default value
...
Group of attributes : Group of attributes xs:attributeGroup name="pictureFeatures">
Example of recipe (1) : Example of recipe (1)
Example of recipe (2) : Example of recipe (2)
Catch the
buzz on authorSTREAM
Copyright © 2002-2008 authorSTREAM. All rights reserved.