Schema - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Schema

Description:

Because the syntax is different from the XML syntax, it can be difficult to read ... content='textOnly' dt:type='string'/ ElementType name='book' model='closed' ... – PowerPoint PPT presentation

Number of Views:17
Avg rating:3.0/5.0
Slides: 13
Provided by: sherr98
Category:
Tags: schema | textonly

less

Transcript and Presenter's Notes

Title: Schema


1
Schema
  • Formal language describing the structure of the
    XML document.
  • Problems with DTDs
  • Because the syntax is different from the XML
    syntax, it can be difficult to read and write
    DTDs.
  • All data contents are character data. DTD does
    not provide support for data types.
  • All elements are global.
  • Difficult to write and understand.

2
A better schema language?
  • XML Schemas became a W3C recommendation in May
    2001.
  • There were working schema implementations before
    the proposed recommendation
  • XML Data XML Data Reduced (xdr)
  • Document Content Description (DCD)
  • Schema for OO XML (SOX)

3
XML Data schema
  • Like DTD, XML-Data schema can be used to specify
    the schema, or structure, of a particular class
    of documents.
  • Benefits of using XML-Data language to describe
    the document structure.
  • XML-Data uses XML syntax.
  • XML-Data provides support for data types. You can
    specify the type of data contained in an element.
  • XML-data supports global and local element
    specifications.

4
XML-Data schema example
  • ltSchema xmlns"urnschemas-microsoft-comxml-data"
    xmlnsdt"urnschemas-microsoft-comdatatypes
    "gt
  • ltElementType name"author" model"closed"
  • content"textOnly" dttype"string"/gt
  • ltElementType name"book" model"closed"
  • content"eltOnly" order"seq"gt
  • ltAttributeType name"category" dttypestring"
    required"yes"/gt
  • ltattribute type"category"/gt
  • ltelement type"author" minOccurs"1"
    maxOccurs"1"/gt
  • ltelement type"title" minOccurs"1"
    maxOccurs"1"/gt
  • ltelement type"price" minOccurs"1"
    maxOccurs"1"/gt
  • lt/ElementTypegt
  • ...
  • lt/Schemagt

5
Document schema
Book
Category
author
title
price
ltbook category"Programming"gt ltauthorgtDon
Boxlt/authorgt lttitlegtEssential
XMLlt/titlegt ltpricegt25.95lt/pricegt lt/bookgt
6
XML-Data Reduced (XDR)
  • XML-Data Reduced (XDR) language is a subset of
    ideas described in the XML-Data specification.
    The schema implementation in Microsoft XML
    Parser (MSXML) is based on the XML-Data Reduced
    language specification.
  • The XML Schema implementation in MSXML is based
    primarily on the XML Data Note posted by the W3C
    in January 1998, and the Document Content
    Description for XML.
  • The XML Schema implementation provided in MSXML
    focuses on syntactic schemas, without support for
    inheritance or other object-oriented design
    features.

7
From DTDs to XDRs
  • lt!ELEMENT Foo (PCDATA tag1)gt
  • ltElementType nameFoo contentmixed
  • ordermanygt
  • ltelement typetag1/gt
  • lt/ElementTypegt

8
From DTDs to XDRs
  • lt!ELEMENT Foo (PCDATA tag1)gt
  • lt!ELEMENT tag1 gt
  • ltElementType nameFoo contentmixed
  • ordermanygt
  • ltelement typetag1/gt
  • lt/ElementTypegt
  • ltElementType nametag1 gt
  • lt/ElementTypegt

9
From DTDs to XDRs
  • lt!ELEMENT Person (First, M, Last)gt
  • ltElementType namePerson
  • contenteltOnly
  • orderseqgt
  • ltelement typeFirst/gt
  • ltelement typeM/gt
  • ltelement typeLast/gt
  • lt/ElementTypegt

10
From DTDs to XDRs
  • lt!ELEMENT Foo ((X Y) (A, B?, C))gt
  • ltElementType nameFoo
  • contenteltOnly
  • orderonegt
  • ltgroup orderonegt
  • ltelement typeX/gt
  • ltelement typeY/gt
  • lt/groupgt
  • ltgroup orderseqgt
  • ltelement typeA/gt
  • ltelement typeB minOccurs0/gt
  • ltelement typeC/gt
  • lt/groupgt
  • lt/ElementTypegt

11
From DTDs to XDRs
  • lt!ELEMENT Person (First, M, Last)gt
  • lt!ATTLIST Person age CDATA REQUIREDgt
  • ltAttributeType nameage
  • dttypeint" requiredyes/gt
  • ltElementType namePerson
  • contenteltOnly
  • orderseqgt
  • ltattribute typeagegt
  • ltelement typeFirst/gt
  • ltelement typeM/gt
  • ltelement typeLast/gt
  • lt/ElementTypegt

12
From DTDs to XDRs
  • lt!ELEMENT Person (First, M, Last)gt
  • lt!ATTLIST Person age CDATA REQUIREDgt
  • ltElementType namePerson
  • contenteltOnly
  • orderseqgt
  • ltAttributeType nameage
  • dttypeint" requiredyes/gt
  • ltattribute typeagegt
  • ltelement typeFirst/gt
  • ltelement typeM/gt
  • ltelement typeLast/gt
  • lt/ElementTypegt
Write a Comment
User Comments (0)
About PowerShow.com