XML Schema - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

XML Schema

Description:

book condition='mint' title The Soul of a New Machine /title author Tracy Kidder /author ... enumeration value='mint' / enumeration value='very good' ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 21
Provided by: nealar1
Category:
Tags: xml | mint | schema

less

Transcript and Presenter's Notes

Title: XML Schema


1
XML Schema
  • Neal Arthorne
  • 12/12/2001

2
Extensible Markup Language (XML)
  • Format for holding structured data
  • Specification was recommended by the World Wide
    Web Consortium (W3C) on
  • 6 October 2000
  • Widely accepted as a universal data format
  • Can be manipulated and transformed into other
    languages

3
XML Document
ltbook conditionmintgt lttitlegtThe Soul of a
New Machinelt/titlegt ltauthorgtTracy
Kidderlt/authorgt ltdategt1981lt/dategt
ltpublishergtAtlantic-Little, Brownlt/publishergt
ltisbngt0-316-49170-5lt/isbngt lt/bookgt
4
XML Structure
  • What elements go where?
  • XML Validation
  • Shared understanding of XML structure facilitates
    exchange of XML data

5
XML Data Types
  • What values are allowed for attributes?
  • What is the type of data in an element or
    attribute?
  • In XML, data is written as text, but what if we
    want it to be interpreted as integers, strings or
    floating point numbers?

6
Solution XML Schema
  • XML Schema is a markup language used to describe
    the structure and data types of an XML document
  • W3C Recommendation 2 May 2001
  • Many advantages over older DTDs re-usable
    definitions, written in XML, data types,
    documentation support

7
XML Schema
  • Elements and Attributes are defined using Simple
    and Complex Types
  • SimpleType
  • No nested child elements or attributes
  • Fixed set of acceptable values
  • Derived from built-in SimpleTypes or user-defined
    SimpleTypes

8
Built-In SimpleTypes
  • String
  • Decimal
  • Float
  • Integer
  • Time
  • Date
  • Token

9
XML Schema ComplexTypes
  • Nested elements and attributes
  • Derived by extending Simple or Complex Types
  • Highest level of sophistication
  • Uses sequence or choice

10
XML Schema
  • ltschemagt
  • ltelement namebook/gt
  • ltcomplexTypegt
  • ltsequencegt
  • ltelement nametitle typestring/gt
  • ltelement nameauthor typestring/gt
  • lt/sequencegt
  • ltattribute namecondition
    typeConditionType/gt
  • lt/complexTypegt
  • lt/elementgt
  • lt/schemagt

11
SimpleType
  • ltattribute namecondition typeConditionType/gt
  • Need to define a fixed set of values for the
    condition of a book
  • conditionmint
  • conditionvery good
  • conditiongood
  • conditionfair
  • conditionpoor
  • Enumeration

12
SimpleType
  • Derive from the built-in string type
  • ltsimpleType name"ConditionType"gt
  • ltrestriction base"string"gt
  • ltenumeration value"mint" /gt
  • ltenumeration value"very good" /gt
  • ltenumeration value"good" /gt
  • ltenumeration value"fair" /gt
  • ltenumeration value"poor" /gt
  • lt/restrictiongt
  • lt/simpleTypegt

13
SimpleType
  • Derived from a base type built-in or already
    defined
  • Defines all the values an attribute or element
    can have (data type)
  • Can be derived by three methods
  • Union Combine all values from other SimpleTypes
  • List A list of items where each item is of the
    same SimpleType
  • Atomic Restrict the values of a SimpleType using
    constraints

14
SimpleType Union
  • ltsimpleType nameDateAndInt"gt
  • ltunion memberTypes"date integer" /gt
  • lt/simpleTypegt
  • Valid values 2001-12-12, -34, 23, 1900-01-20
  • Combines all values in date type with all
    values in integer type

15
SimpleType List
  • ltsimpleType name"MyIntegerList"gt
  •   ltlist itemType"integer" /gt
  • lt/simpleTypegt
  • Valid Values -10 30 23 -100, 0 1 2 3 4 5
  • List items are separated by whitespace
  • Every item in this list is of type integer
  • Length of the list is unlimited

16
SimpleType Atomic
  • Imposes a restriction on an existing type
  • The base type determines what constraints can be
    used
  • String maxLength, minLength, length,
    enumeration, pattern
  • Integer minInclusive, maxInclusive, totalDigits,
    fractionDigits, enumeration

17
My Project SchemaTool
  • Web-based XML Schema editor
  • Designed for the novice user
  • Limited subset of XML Schema
  • Allows creation of simpleTypes
  • Use single level schema structure to describe a
    Resource

18
SchemaTool Context
  • Designed to integrate into U-P2P
  • Used by a user to describe a Resource
  • Resource book
  • Property A title
  • Property B author
  • Property C publisher

19
SchemaTool Usage
  • XML Schema used to describe a single level
    hierarchy
  • ltbook conditionmintgt
  • lttitlegtlt/titlegt
  • ltauthorgtlt/authorgt
  • lt/bookgt
  • No nested elements (inside of title, author) and
    no attributes

20
SchemaTool
  • Requires no knowledge of XML or XML Schema
  • Provides a wizard interface for creating new
    simpleTypes
  • Download the schema when completed to an XML file
  • Not a complete XML Schema implementation
Write a Comment
User Comments (0)
About PowerShow.com