XML Schema - PowerPoint PPT Presentation

About This Presentation
Title:

XML Schema

Description:

Title: XML Schema Author: Matthias Hauswirth Last modified by: Kenneth M. Anderson Created Date: 9/21/2000 12:40:18 AM Document presentation format – PowerPoint PPT presentation

Number of Views:64
Avg rating:3.0/5.0
Slides: 23
Provided by: Matthi203
Category:

less

Transcript and Presenter's Notes

Title: XML Schema


1
XML Schema
  • Matthias Hauswirth

2
Agenda
  • W3C Process
  • XML Schema Requirements
  • The Specifications
  • Schema Tools

3
The W3C Process
Proposals
Proposals
Others
Working Draft
Candidate Recommendation
Technical Reports (TR)
Working Group
Proposed Recommendation
Recommendation
Note
4
XML Schema Status
DCD
XML-Data
SOX
DDML
Others
Working Drafts (Part 0, 1, 2)
Candidate Recommendation
Technical Reports (TR)
Schema Working Group
Proposed Recommendation
Recommendation
Requirements
5
XML Schema Requirements
  • Structural
  • namespaces
  • primitive types structural schema integration
  • inheritance
  • Data type
  • integers, dates, (like in languages)
  • user-defined (constrain some properties)
  • Conformance
  • processors, validity

6
Design Principles
  • More expressive than DTDs
  • Expressed in XML
  • Self-describing
  • Usable by various XML applications
  • Simple enough

7
The Specifications
  • Part 0 Primer
  • non-normative introduction
  • Part 1 Structures
  • define structure
  • constraining contents
  • Part 2 Datatypes
  • specify datatypes on elements and attributes

8
An Example Document (1/2)
  • lt?xml version1.0?gt
  • ltpurchaseOrder orderDate1999-10-20gt
  • ltshipTo countryUSgt
  • ltnamegtMatthias Hauswirthlt/namegt
  • ltstreetgt4500 Brookfield Dr.lt/streetgt
  • ltcitygtBoulderlt/citygt
  • ltstategtCOlt/stategt
  • ltzipgt80303lt/zipgt
  • lt/shipTogt
  • ltbillTo countryUSgt
  • ltnamegtBrian Templelt/namegt
  • ltstreetgt1234 Strasselt/streetgt
  • ltcitygtBoulderlt/citygt
  • ltstategtCOlt/stategt
  • ltzipgt80302lt/zipgt
  • lt/billTogt
  • ...

9
An Example Document (2/2)
  • ltcommentgtBrian payslt/commentgt
  • ltitemsgt
  • ltitem partNum123-ABgt
  • ltproductNamegtPorschelt/productNamegt
  • ltquantitygt1lt/quantitygt
  • ltpricegt129400.00lt/pricegt
  • ltcommentgtNeed a new onelt/commentgt
  • lt/itemgt
  • ltitemgt
  • ltproductNamegtFerrarilt/productNamegt
  • ltquantitygt2lt/quantitygt
  • ltpricegt189000.25lt/pricegt
  • ltshipDategt1999-05-21lt/shipDategt
  • lt/itemgt
  • lt/itemsgt
  • lt/purchaseOrdergt

10
An Example Schema (1/3)
  • ltxsdschema xmlnsxsdhttp//www.w3.org/1999/XMLS
    chemagt
  • ltxsdelement namepurchaseOrder
    typepurchaseOrderType/gt
  • ltxsdelement namecomment typexsdstring/gt
  • ltxsdcomplexType namePurchaseOrderTypegt
  • ltxsdelement nameshipTo typeAddressType/gt
  • ltxsdelement namebillTo typeAddressType/gt
  • ltxsdelement refcomment minOccurs0/gt
  • ltxsdelement nameitems typeItemsType/gt
  • ltxsdattribute nameorderDate
    typexsddate/gt
  • lt/xsdcomplexTypegt
  • ...

11
An Example Schema (2/3)
  • ltxsdcomplexType nameAddressTypegt
  • ltxsdelement namename typexsdstring/gt
  • ltxsdelement namestreet typexsdstring/gt
  • ltxsdelement namecity typexsdstring/gt
  • ltxsdelement namestate typexsdstring/gt
  • ltxsdelement namezip typexsddecimal/gt
  • ltxsdattribute namecountry
    typexsdNMTOKEN
  • usefixed valueUS/gt
  • lt/xsdcomplexTypegt
  • ltxsdsimpleType nameSkuType
    basexsdstringgt
  • ltxsdpattern value\d3-A-Z2/gt
  • lt/xsdsimpleTypegt
  • ...

12
An Example Schema (3/3)
  • ltxsdcomplexType nameItemsTypegt
  • ltxsdelement nameitem minOccurs0
    maxOccursunboundedgt
  • ltxsdcomplexTypegt
  • ltxsdelement nameproductName
    typexsdstring/gt
  • ltxsdelement namequantitygt
  • ltxsdsimpleType basexsdpositiveIntegergt
  • ltxsdmaxExclusive Value100/gt
  • lt/xsdsimpleTypegt
  • lt/xsdelementgt
  • ltxsdelement nameprice typexsddecimal/gt
  • ltxsdelement refcomment minOccurs0/gt
  • ltxsdelement nameshipDate typexsddate
    minOccurs0/gt
  • ltxsdattribute namepartNum
    typeSkuType/gt
  • lt/xsdcomplexTypegt
  • lt/xsdelementgt
  • lt/xsdcomplexTypegt
  • lt/xsdschemagt

13
Part 1 Structures
  • Type Definitions ltsimpleTypegt ltcomplexTypegtlteleme
    ntgt ltgroupgt ltallgt ltchoicegt ltsequencegtltattributegt
    ltattributeGroupgt
  • Attribute Declarations ltattributegtltsimpleTypegt
  • Element Declarations ltelementgtltsimpleTypegt
    ltcomplexTypegt
  • Attribute Group Definitions ltattributeGroupgtltattr
    ibutegt ltattributeGroupgt
  • Model Group Definitions ltgroupgtltelementgt ltgroupgt
    ltallgt ltchoicegt ltsequencegt
  • Notation Declarations ltnotationgt
  • Annotations ltannotationgtltappinfogt ltdocumentationgt

14
DTD vs. Schema Structure
  • DTD
  • lt!ELEMENT e1 ((e2,e3?)e4)gt
  • Schema
  • ltelement namee1gt
  • ltcomplexTypegt
  • ltchoicegt
  • ltsequence maxOccursunboundedgt
  • ltelement refe2/gt
  • ltelement refe3 minOccurs0/gt
  • lt/sequencegt
  • ltelement refe4gt
  • lt/choicegt
  • lt/complexTypegt
  • lt/elementgt

15
Referential/Uniqueness Integrity
  • Define Constraints using XPath expressions
  • ltuniquegt
  • ltkeygt
  • ltkeyrefgt
  • ltselectorgt
  • ltfieldgt

16
Part 2 Datatypes ltsimpleTypegt
  • Value Space
  • defined axiomatically (primitive types)
  • enumerated outright
  • defined by restricting value space of other type
  • combination of values of other type (list)
  • has certain properties (e.g. cardinality,
    equality, ordered)
  • Lexical Space
  • set of literals for a type (e.g. 100 and 1.0E2
    denote same value)
  • Facets
  • fundamental facets (define the type)
  • constraining facets (allow to constrain the value
    space)

17
Fundamental Facets
  • Fundamental facets cant be changed
  • Equal
  • all types provide an equality relation
  • Order
  • some types provide an ordering relation
  • Bounds
  • upper bound and lower bound
  • Cardinality
  • finite, infinite
  • Numeric
  • yes or no

18
Constraining Facets
  • length
  • minLength
  • maxLength
  • pattern
  • enumeration
  • maxInclusive / maxExclusive
  • minInclusive / minExclusive
  • precision
  • scale
  • encoding
  • duration
  • period

19
Primitive vs. Derived Types
  • Primitive Types
  • string
  • boolean
  • float
  • double
  • decimal
  • timeDuration
  • recurringDuration
  • binary
  • uriReference
  • ID
  • IDREF
  • ENTITY
  • NOTATION
  • QName
  • exist ab initio
  • Derived Type
  • by restriction
  • use constraining facets
  • ltsimpleType namesku basexsdstringgt
  • ltpattern
  • value\d3-A-D4/gt
  • lt/simpleTypegt
  • by list
  • next slide

20
Built-in vs. User-Derived Types
  • Built-in types
  • primitive
  • derived
  • language
  • IDREFS
  • long
  • int
  • short
  • positiveInteger
  • time
  • month
  • recurringDay
  • ...
  • User-derived types
  • derived-only

21
Atomic vs. List Types
  • Atomic
  • values indivisible
  • ltsimpleType nameShoeSize basexsddecimal/gt
  • ltelement nameshoe typeShoeSize/gt
  • ltshoegt10.5lt/shoegt
  • List
  • sequence of values of atomic type
  • ltsimpleType nameShoeSizes baseshoeSize
    derivedBylist/gt
  • ltelement nameshoes typeShoeSizes/gt
  • ltshoesgt8 10 10.5lt/shoesgt

22
Tools
  • XML Schema-aware Parser
  • Xerces-J
  • Oracle XML Schema Processor
  • XML Schema Validator (XSV, online)
  • DTD to Schema Conversion Tools
  • XML Schema Editor
  • Extensibilitys XML Authority
  • XML Schema-aware Instance Editor
  • Extensibilitys XMLInstance
  • ChannelPoints Merlot (maybe in future)
Write a Comment
User Comments (0)
About PowerShow.com