sunday, june 28, 2015 abdelali zahi : fall 2003 : xml schemas xml schemas presented by : abdelali...

41
Friday, March 25, 2022 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Post on 21-Dec-2015

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

XML Schemas

Presented By : Abdelali ZAHIInstructor : Dr H.Haddouti

Page 2: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Terms and Concepts

Schema:• In database : refers to the organization or structure for a

database

• In XML community : refers to the structure (or model of a class of

documents). This model describes the hierarchy of elementsand allowable content in a valid XML document

the schema defines constraints for an XML vocabulary. XML Schema is

a formal definition for defining a schema for a class of XMLdocuments.

Page 3: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Purpose

Provide a document for validation Extend the functionality of DTDs Define datatypes Define elements and their content Define attributes and their values Define reusable components and their contents Introduce notations

Page 4: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Design Principles

More expressive than XML DTDs Expressed in XML Self-describing Usable in a wide variety of applications that employ XML Straightforwardly usable on the Internet Optimized for interoperability Simple enough to implement with modest design and

runtime resources

Page 5: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Datatype Requirements

• Provide for primitive datatyping, including byte, date, integer, sequence, and SQL datatypes.

• Allow creation of user-derived datatypes, such as datatypes that are derived from an existing datatype and that may constrain some of its properties.

Page 6: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Well-formedness vs validity

A document is considered to be well formed if it meets all the well-following constraints:

• The document contains one or more elements.• The document consists of exactly one root element (also known as the

document element).• The name of an element’s end tag matches the name defined in the start tag.• No attribute may appear more than once within an element.• Attribute values cannot contain a left-angle bracket (<).• Elements delimited with start and end tags must nest properly within each

other.

an XML document is valid if it adheres to a defined model for a class

of XML documents

Page 7: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Terms and concepts

data primitives: basic types to associate with values (integer, real

number, character, string…etc)

schema components: building blocks that make up the abstract data

model of the schema (Element and attribute declarations, complex

types, simple types, notations…)

Page 8: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

XML SCHEMA STRUCTURES

Page 9: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Definitions vs. Declarations

A definition describes a complex or simple type that either contains element or attribute declarations or references element or attribute declarations defined elsewhere in the document.

Here’s a definition:<xsd:complexType name=”bookType”><xsd:sequence><xsd:element name=”title” type=”xsd:string”/><xsd:element name=”author” type=”xsd:string”/><xsd:element name=”description” type=”xsd:string”/></xsd:sequence></xsd:complexType>

A declaration defines an element or attribute, specifying the name and datatype for the component.

Here’s a declaration:<xsd:element name=”book”><xsd:complexType><xsd:sequence><xsd:element name=”title” type=”xsd:string”/><xsd:element name=”author” type=”xsd:string”/><xsd:element name=”description” type=”xsd:string”/></xsd:sequence></xsd:complexType></xsd:element>

Page 10: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Simple Type vs. Complex Type

A simple type definition constrains the text that is allowed to appear as content for an attributevalue or text-only element without attributes. Here’s a simple type definition:<xsd:simpleType name=”isbnType”> <xsd:restriction base=”xsd:string”> <xsd:pattern value=”[0-9]{10}”/> </xsd:restriction></xsd:simpleType>

A complex type definition constrains the allowablecontent of elements. Both types govern possible attribute and child elements.

Here’s a complex type definition:<xsd:complexType name=”bookType”><xsd:sequence><xsd:element name=”title” type=”xsd:string”/><xsd:element name=”author” type=”xsd:string”/><xsd:element name=”description” type=”xsd:string”/></xsd:sequence></xsd:complexType>

Page 11: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Global vs. Local

Declarations and definitions can be declared globally or locally. A

globally defined component is defined as a child of the schema

element.

A locally defined component (also known as inline) is defined as a child of another schema component.

Page 12: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Global Component

<xsd:schemaxmlns:xsd=http://www.w3.org/2001/XMLSchema

elementFormDefault=”qualified”targetNamespace=http://www.lanw.com/namespaces/pub xmlns=” http://www.lanw.com/namespaces/pub ”>

<xsd:element name=”publications”> <xsd:complexType> <xsd:sequence> <xsd:element ref=”book”/> </xsd:sequence> </xsd:complexType></xsd:element>

Page 13: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Global component (cont’d)

<xsd:element name=”book” maxOccurs=”unbounded”> <xsd:complexType> <xsd:sequence> <xsd:element ref=”title”/> <xsd:element ref=”author”/> <xsd:element ref=”description”/> </xsd:sequence> </xsd:complexType></xsd:element>

<xsd:element name=”title” type=”xsd:string”/><xsd:element name=”author” type=”xsd:string”/><xsd:element name=”description” type=”xsd:string”/>

</xsd:schema>

Page 14: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Local Component

<xsd:schemaxmlns:xsd=”http://www.w3.org/2001/XMLSchema”elementFormDefault=”qualified”targetNamespace=”http://www.lanw.com/namespaces/pub”xmlns=”http://www.lanw.com/namespaces/pub”><xsd:element name=”publications”> <xsd:complexType> <xsd:sequence> <xsd:element name=”book” maxOccurs=”unbounded”>

<xsd:complexType> <xsd:sequence>

<xsd:element name=”title” type=”xsd:string”/><xsd:element name=”author” type=”xsd:string”/><xsd:element name=”description” type=”xsd:string”/>

</xsd:sequence> </xsd:complexType></xsd:element>

</xsd:sequence> </xsd:complexType></xsd:element></xsd:schema>

Page 15: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Schema Components:Type definitionDeclarationAttribute groupIndicators

Page 16: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Type Definitions

The are two classes of types : simple types and complex types.

There are two types of classes : Named types: defined at the root level and referenced later Anonymous types : defined nested within other schema

components

Page 17: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Simple types

Examples:<xs:element name="xxx" type="yyy"/>

<xs:element name="lastname" type="xs:string"/> <xs:element name="age" type="xs:integer"/> <xs:element name="dateborn" type="xs:date"/>

<lastname>Refsnes</lastname> <age>34</age> <dateborn>1968-03-27</dateborn>

Simple types are used to define all attributes and elements thatcontain only text and do not have attributes associated with them.

Page 18: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Default and Fixed Values

Simple elements can have a default value OR a fixed value set.

A default value is automatically assigned to the element when no other value is specified. In the following example the default value is "red":

 <xs:element name="color" type="xs:string" default="red"/>

A fixed value is also automatically assigned to the element. You cannot specify another value. In the following example the fixed value is "red": <xs:element name="color" type="xs:string" fixed="red"/>

Page 19: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Complex types

An element is considered to be a complex type if it contains attribute or child elements. Complex types are used to define complex contentmodels

<employee> <firstname>John</firstname> <lastname>Smith</lastname>

</employee>

<xs:element name="employee"><xs:complexType> <xs:sequence> <xs:element

name="firstname"type="xs:string"/><xs:element name="lastname"

type="xs:string"/></xs:sequence></xs:complexType></xs:element>

Page 20: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Declarations

You can :

define elements and attributes as you need them, nesting thedeclarations within other element declarations (“Inline

Declarations”).

define declarations at the top level and reference them from within

element declarations (“Referencing Declarations”).

define named type definitions that are then referenced withinelement or attribute declarations (“Named Types”).

Page 21: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Inline Declarations

<xsd:schema …> <xsd:element name=”publications”> <xsd:complexType> <xsd:sequence> <xsd:element name=”book” maxOccurs=”unbounded”>

<xsd:complexType> <xsd:sequence>

<xsd:element name=”title” type=”xsd:string”/><xsd:element name=”author” type=”xsd:string”/><xsd:element name=”description” type=”xsd:string”/>

</xsd:sequence> <xsd:attribute name=”isbn” type=”xsd:string”/>

</xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element></xsd:schema>

Page 22: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Referencing declarations

<xsd:schema …>

<xsd:element name=”publications”> <xsd:complexType> <xsd:sequence> <xsd:element ref=”book”/> </xsd:sequence> </xsd:complexType></xsd:element>

<xsd:element name=”book” maxOccurs=”unbounded”><xsd:complexType>

<xsd:sequence><xsd:element ref=”title”/><xsd:element ref=”author”/><xsd:element ref=”description”/>

</xsd:sequence><xsd:attribute name=”isbn” type=”xsd:string”/>

</xsd:complexType></xsd:element><xsd:element name=”title” type=”xsd:string”/><xsd:element name=”author” type=”xsd:string”/><xsd:element name=”description” type=”xsd:string”/></xsd:schema>

Page 23: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Named Types

<xsd:simpleType name=”isbnType”><xsd:restriction base=”xsd:string”>

<xsd:pattern value=”[0-9]{10}”/></xsd:restriction>

</xsd:simpleType>

<xsd:complexType name=”pubType”> <xsd:sequence> <xsd:element ref=”book”/> </xsd:sequence></xsd:complexType>

<xsd:complexType name=”bookType”><xsd:sequence>

<xsd:element ref=”title”/><xsd:element ref=”author”/><xsd:element ref=”description”/>

</xsd:sequence></xsd:complexType><xsd:element name=”publications” type=”pubType”/><xsd:element name=”book” type=”bookType” maxOccurs=”unbounded”/><xsd:element name=”title” type=”xsd:string”/><xsd:element name=”author” type=”xsd:string”/><xsd:element name=”description” type=”xsd:string”/>

Page 24: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

How to Define an Attribute

The syntax for defining an attribute is:  <xs:attribute name="xxx" type="yyy"/> where xxx is the name of the attribute and yyy is the data type of theattribute.  Here are an XML element with an attribute: <xs:attribute name="lang" type="xs:string"/> 

Page 25: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Optional and Required Attributes

All attributes are optional by default. To explicitly specify that theattribute is optional, use the "use" attribute: <xs:attribute name="lang" type="xs:string" use="optional"/>

 To make an attribute required: <xs:attribute name="lang" type="xs:string" use="required"/>

Page 26: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Default and Fixed Values for Attributes

Attributes can have a default value OR a fixed value specified. A default value is automatically assigned to the attribute when noother value is specified. In the following example the default value is"EN": <xs:attribute name="lang" type="xs:string" default="EN"/> A fixed value is also automatically assigned to the attribute. Youcannot specify another value. In the following example the fixed valueis "EN": <xs:attribute name="lang" type="xs:string" fixed="EN"/>

Page 27: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Attributes and Grouping

An attribute group definition is an association between a name and a

set of attribute declarations, enabling reuse of the same set inseveral complex type definitions

<xsd:attributeGroup name=”commonAttributes”><xsd:attribute name=”title” type=”xsd:string”/><xsd:attribute name=”id” type=”xsd:ID”/><xsd:attribute name=”style” type=”xsd:string”/>

</xsd:attributeGroup>

Page 28: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Indicators

We have seven types of indicators: Order indicators:  All Choice Sequence  Occurrence indicators:  maxOccurs minOccurs  Group indicators:  Group name attributeGroup name

Page 29: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

All Indicator

<xs:element name="person"> <xs:complexType> <xs:all> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:all> </xs:complexType></xs:element>

The <xs:all> indicator specifies by default that the child elements can appear in any order and that each child element must occur once and only once:

Page 30: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Choice Indicator

The <xs:choice> indicator specifies that either one child elements or the other can occur: <xs:element name="person"> <xs:complexType> <xs:choice> <xs:element name="employee" type="employee"/> <xs:element name="member" type="member"/> </xs:choice> </xs:complexType></xs:element>

Page 31: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Sequence Indicator

The <xs:sequence> indicator specifies that the child elements must appear in a specific order: <xs:element name="person"> <xs:complexType> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:sequence> </xs:complexType></xs:element>

Page 32: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Occurrence Indicators

<xs:element name="person"> <xs:complexType> <xs:sequence> <xs:element name="full_name" type="xs:string"/> <xs:element name="child_name" type="xs:string" maxOccurs="10" minOccurs="0"/> </xs:sequence> </xs:complexType>

Page 33: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Datatype properties

Every datatype is defined to consist of an ordered set of three properties: value space, lexical space, and facets. Each of these helpsconstrain the possible content.

Value SpaceThe value space defines the allowable set of values for a given

datatype.Lexical SpaceThe lexical space defines the set of valid literals for a given datatypeFacetsFacets provide a set of defining aspects of a given datatype. If you

want to define a minimum or maximum constraint, or if you need to restrict thelength of a string datatype, you’ll have to use a facet

Page 34: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Built-in and User-Derived

Built-InBuilt-in datatypes are already defined for you by the

Datatypesspecification

Primitive datatypes are those not defined in terms of otherdatatypes. Primitive datatypes are the basis for all other datatypes.

A derived datatype is one that is derived from a base type. The derived typeinherits its value space from its base type and may also constrain the derived value space to be an explicit subset of the base type’s value space

Page 35: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Built-in and User-Derived (cont’d)

Derived Datatypes

Restriction Uses facets to restrict the allowable content.

List Derived datatype is a list of white-space-separated values of the

base datatype.

Union There are two or more base datatypes, and the value space–

derived datatype is formed from the union of the value spaces of the

base types.

Page 36: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Namespaces

Page 37: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

What are they?

Definition: XML namespaces are symbolic references in the form of

URLs used to resolve naming conflicts in documents

Example:<html><head><title>Book List</title></head><body><publications><book><title>Mastering XHTML</title><author>Ed Tittel</author></book><book><title>Java Developer’s Guide to E-

Commercewith XML and JSP</title><author>William Brogden</author></book></publications></body></html>

<html xmlns=”http://www.w3.org/1999/xhtml”><head><title>Book List</title></head><body><publications xmlns=”http://www.lanw.com/namespaces/pub”>The Role of Namespaces144<book><title>Mastering XHTML</title><author>Ed Tittel</author></book><book><title>Java Developer’s Guide to E-Commercewith XML and JSP</title><author>William Brogden</author></book></publications></body></html>

Page 38: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Derivation and Substitution

Derivation allows you to derive new types by restricting or extendingthe type definition. Extension is only allowed for complex types.

Restriction<xsd:complexType name=”newBookType”><xsd:complexContent><xsd:restriction base=”bookType”><xsd:sequence><xsd:element name=”title” type=”xsd:string”/><xsd:element name=”author” type=”xsd:string”/></xsd:sequence></xsd:restriction></xsd:complexContent></xsd:complexType>

Extension<xsd:complexType name=”newBookType”><xsd:complexContent><xsd:extension base=”bookType”><xsd:sequence><xsd:element name=”description” type=”xsd:string”/><xsd:element name=”isbn” type=”xsd:string”/></xsd:sequence></xsd:extension></xsd:complexContent></xsd:complexType>

Page 39: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

Substitution

XML Schema supports substitution mechanisms that allow one group

of elements to be replaced by another group of elements. This is

especially helpful when you’re working with a predefined XMLSchema document

Page 40: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

References

• W3C XML Schema Recommendationhttp://www.w3.org/TR/xmlschema-0/

• Tools and resources on XML Schemahttp://www.w3.org/XML/Schema

• http://www.w3schools.com

Page 41: Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti

Tuesday, April 18, 2023 Abdelali ZAHI : FALL 2003 : XML Schemas

<xsd:Conclibusion> is an essential tag in XML schemas that means

Conclusion and is used when I finish my presentation.

YOUR QUESTIONS ARE WELCOME