Download presentation
Presentation is loading. Please wait.
Published byJoy Newman Modified over 9 years ago
1
XSDL & Relax : 2 new schema languages for XML Rajasekar Krishnamurthy
2
Outline DTDs and their drawbacks XML Schema Requirements XSDL RELAX Other Schema specifications
3
Sample XML document Intro to XML 72.50 Albert Einstein aeinstein@cs.wisc.edu 608-236-4112
4
Equivalent DTD (!element book (title,price,author*)) (!element title #PCDATA) (!element price #PCDATA) (!element author (name,email,phone)) (!element name #PCDATA) (!element email #PCDATA) (!element phone #PCDATA)
5
Drawbacks of DTD Intro to XML 72.50 Dr. Albert Einstein aeinstein@cs.wisc.edu 608-236-4112
6
Outline DTDs and their drawbacks XML Schema Requirements XSDL RELAX Other Schema specifications
7
What is a schema ? Model for describing a class of documents Common vocabulary for applications exchanging documents Formally express syntactic, structural and value constraints applicable to instance documents
8
XML Schema requirements Mechanisms for constraining document structure inheritance embedded documentation application specific constraints primitive data typing allow creation of user-defined datatypes addressing the evolution of schema
9
Application Scenarios Electronic Commerce transaction processing Traditional document authoring/editing Query formulation and optimization Open and uniform transfer of data between applications, including databases Metadata interchange
10
Outline DTDs and their drawbacks XML Schema Requirements XSDL RELAX Other Schema specifications
11
XML Schema Definition Language Enhanced datatypes written in XML separates element tags from types –local namespaces Inheritance : derive new type definitions Identity constraints support for namespaces
12
Sample XML schema
13
Sample schema (contd.)
14
Schema in graphical form book titleprice author* name emailphoneaddress?
15
Schema Components Building blocks that comprise the abstract data model of the schema Primary Components –simple type definitions –complex type definitions –attribute declarations –element declarations
16
Schema Components Secondary components –attribute group definitions –identity constraint definitions –model group definitions –notation declarations Helper components –annotations –model groups –particles –wildcards
17
Type Definitions Separates tag name from type of elements types can be –simpletypes represent leaf nodes in the graph replace PCDATA in DTDs –complextypes can have elements and attributes in its content
18
Sample complexType declaration
19
Simpletype : Pattern Other facets: Enumerate, Range Other simpletypes: Lists, Union
20
Elements Global elements –can occur as the root of the document –can be included/imported/referenced Local elements –can occur only in the specific context –sibling elements need to have same content model (!element book (author*, title, author*))
21
Sample schema
22
Element Content Complextypes from simple types 23 Mixed content amount in US-dollars is 23 only Empty content
23
Building content models (!element author ((name | (title,firstname,lastname)),email,phone)) Einstein Dr. Albert aeinstein@cs.wisc.edu 608-236-4112 Albert Einstein aeinstein@cs.wisc.edu 608-23-4112
24
Building content models...
25
Content models Can represent any content model expressible with XML 1.0 DTD and more !! Does not allow non-determinism –( (email,name) | (email,expandedname)) is illegal –should be (email, (name | expandedname)) Does not allow ambiguity –( author*, contactauthor*, author* ) not allowed author* can be derived in multiple ways
26
Deriving new types Two ways of deriving new types from existing types By extension –similar to inheritance in programming languages By restriction –declarations more limited than base type
27
Deriving by Extension
28
Declare Base Type
29
Derive By Extension
30
Using Derived Types 1210, W.Dayton Street Madison WI 53706 1210, W.Dayton Street Madison
31
Deriving By Restriction
32
Identity Constraints Can specify integrity constraints –uniqueness, key, keyref constraints can be locally scoped can be applied on attributes, elements or their contents –XML ID is an attribute can create keys/keyrefs from a combination of element and attribute content
33
Sample constraint
34
Other features Importing schema components –Type libraries Redefining Types & Groups Namespaces –Targetnamespaces allow undeclared value : support for namespace unaware documents
35
Other features Any element –allows well-formed XML to appear –can be restricted to a set of namespaces Any attribute anyType –base type for all complexTypes –does not constrain content in any way –default type when none is specified
36
Main drawback of XSDL An element declaration (call it D) together with a blocking constraint (a subset of {substitution, extension,restriction}, the value of a {disallowed substitutions}) is validly substitutable for another element declaration (call it C) if 1.1 the blocking constraint does not contain substitution; 1.2 There is a chain of {substitution group affiliation}s from D to C, that is, either D's {substitution group affiliation} is C, or D's {substitution group affiliation}'s {substitution group affiliation} is C, or...; 1.3 The set of all {derivation method}s involved in the derivation of D's {type definition} from C's {type definition} does not intersect with the union of the blocking constraint, C's {prohibited substitutions} and the {prohibited substitutions} of any intermediate {type definition}s in the derivation of D's {type definition} from C's {type definition}.
37
Main drawback of XSDL for a sequence, maximum is unbounded if the {max occurs} of any wildcard or element declaration particle in the group's {particles} or the maximum part of the effective total range of any of the group particles in the group's {particles} is unbounded, or if any of those is non-zero and the {max occurs} of the particle itself is unbounded, otherwise the product of the particle's {max occurs} and the sum of the {max occurs} of every wildcard or element declaration particle in the group's {particles} and the maximum part of the effective total range of each of the group particles in the group's {particles} (or 0 if there are no {particles})
38
Outline DTDs and their drawbacks XML Schema Requirements XSDL RELAX Other Schema specifications
39
RELAX Developed by Makoto Murata & others in Japan based on the hedge automaton theory borrows rich datatypes from XML Schema Part2 Submitted to ISO fast-track ease of translation from/to DTDs
40
Main features of RELAX Separates element tagname and type –context sensitive content models allows content models similar to XML schema allows definition of element and attribute groups annotations include mechanism for large schemas
41
Features absent in RELAX Support for namespaces –coming shortly?? Identity constraints Inheritance New datatypes
42
XSDL vs. RELAX Allows sibling elements to have different types –allow the content model (author, title, author) where the two author elements can have different content models –introduces ambiguity For content model (title, author*, author*) ”XYZ” is ambiguous
43
XSDL vs. RELAX A single type can have multiple definitions –actual definition which matches instance element found by exhaustive search –atleast one match needs to be found nametype can be defined as name or expandedname –it is a choice of the two definitions
44
Extending existing types XSDL uses inheritance –can change (title, author*) to (title, author*, contactauthor) In RELAX, add the new type definition completely –can change (title, author*) to (title, contactauthor, author*) also
45
Using attribute values 10 ten content model of price element switched based on attribute value of type attribute
46
XSDL vs. RELAX RELAX –membership checking in linear time in SAX model XSDL –type assignment in linear time in SAX/DOM models ignoring integrity constraints
47
Other Schema proposals XDR (XML-Data Reduced) –Microsoft’s Biztalk framework SOX (Schema for Object-oriented XML) –Commerce One DSD –AT&T and BRICS Schematron
48
References www.oasis-open.org/cover/schemas.html www.w3.org/xml/schema.html www.xml.gr.jp/relax/ Comparative Analysis of SIX XML Schema Languages, Sigmod Record, Sept. 2000 Reasoning about XML Schema Languages using Formal Language Theory, WWW submission
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.