xml schema 1.1 for managers

107
1 © [2010]. Roger L. Costello. All Rights Reserved. XML Schema 1.1 for Managers Roger L. Costello http://www.xfront.com 3 December, 2012

Upload: luana

Post on 08-Feb-2016

40 views

Category:

Documents


0 download

DESCRIPTION

XML Schema 1.1 for Managers. Roger L. Costello http://www.xfront.com 3 December, 2012. Purpose. The purpose of this tutorial is to give an overview of the new features of XML Schema 1.1 without getting into its syntax. It is targeted to managers. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: XML Schema 1.1  for Managers

1

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

XML Schema 1.1 for Managers

Roger L. Costellohttp://www.xfront.com

3 December, 2012

Page 2: XML Schema 1.1  for Managers

2

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Purpose

• The purpose of this tutorial is to give an overview of the new features of XML Schema 1.1 without getting into its syntax.

• It is targeted to managers.• I show how these new technical features can

benefit your business.

Page 3: XML Schema 1.1  for Managers

3

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Your 1.0 Schemas will still work

An XML document conforming to a 1.0 schema can be validated using a 1.1 validator, but an XML document conforming to a 1.1 schema might not validate using a 1.0 validator.

XML Schema 1.0

XML Schema 1.1

XML Schema 1.1 is a superset of XML Schema 1.0

Page 4: XML Schema 1.1  for Managers

4

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

XML Schema 1.1 Validators

• The schema-aware version of SAXON (version 9.3 or later) supports the full XML Schema 1.1 specification: http://www.saxonica.com/

• Apache XERCES supports XML Schema 1.1: http://xerces.apache.org/xerces2-j/

• You can create XML Schema 1.1 schemas today!

Page 5: XML Schema 1.1  for Managers

5

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Status

• XML Schema 1.1 became a standard on April 5, 2012 (the W3C calls it a “recommendation” not a standard, but they are the same)

Page 6: XML Schema 1.1  for Managers

6

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Technology Stack

XML

Namespaces

XPath

XML Schema 1.0

XML Schema 1.1

Each technology assumes you know the technologies beneath it.

Page 7: XML Schema 1.1  for Managers

7

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Review:Purpose of

XML Schemas

Page 8: XML Schema 1.1  for Managers

8

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Two uses of XML

XML as a temporary transport vehicle:– As soon a the XML gets to its

destination the data is extracted and put into a permanent storage mechanism (such as a database).

– Applications operate on the data in the permanent storage.

XML as permanent storage:– Applications operate

directly on the XML.

XML

app

app

appXML XML

"shred"

app

app

appship the XML

Page 9: XML Schema 1.1  for Managers

9

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

XML as a temporary transport vehicle

XML XML

"shred"

app

app

appship the XML

An XML Schema can be used as a contract between the sender and the receiver: "Here's the information we agree to exchange, and the format of the information."

Page 10: XML Schema 1.1  for Managers

10

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

XML as permanent storage

XML

app

app

app

XML

Rob Sally Pete Jill Anthony

Often occurring in the form of a workflow:

Page 11: XML Schema 1.1  for Managers

11

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

XML as permanent storage(cont.)

XML

app1 app2 app3 app4

Each application does a "unit of work." It is desirable, after each unit of work, to assess the system. XML Schemas can be used to check each application's output.

Page 12: XML Schema 1.1  for Managers

12

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Check the information–validate that no rules are being broken.

Do some work.

Then validate that no rules have been broken (as a result of the work), i.e., check that you’re still on track.

Then do another unit of work.

Then validate again.

Then do another unit of work.

Then validate again.

And so forth.

I envision systems working like this:

Page 13: XML Schema 1.1  for Managers

13

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Rules

• We live in a world of rules:– Driving: we follow the rules of the road– Queues: we form lines at banks and in the checkout

lanes at the supermarket– Taxes: accountants spend lots of time each year

learning the new tax rules– Laws: our legal system enforces societies' laws

• Rules guide our actions.• Rules let us know if we are on or off track.

Page 14: XML Schema 1.1  for Managers

14

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Rules are Important

All enterprise work as it grows toward perfection becomes rule-based

Roger Costello and Bob Wilson

Page 15: XML Schema 1.1  for Managers

15

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

XML Schema = Rules

• XML Schemas is all about expressing rules:– rules about what data is allowed– rules about how the data must be organized– rules about the relationships between data

Page 16: XML Schema 1.1  for Managers

16

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Example: My Vacation

<Vacation> <Trip segment="1" mode="air"> <Transportation>airplane</Transportation> </Trip> <Trip segment="2" mode="water"> <Transportation>boat</Transportation> </Trip> <Trip segment="3" mode="ground"> <Transportation>car</Transportation> </Trip></Vacation>

Page 17: XML Schema 1.1  for Managers

17

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Validate<Vacation> <Segment id="1" mode="air"> <Transportation>airplane</Transportation> </Segment> <Segment id="2" mode="water"> <Transportation>boat</Transportation> </Segment> <Segment id="3" mode="ground"> <Transportation>car</Transportation> </Segment></Vacation>

Rule 1: A vacation has segments.Rule 2: Each segment is uniquely identified.Rule 3: There are three modes of transportation: air, water, ground.Rule 4: Each segment has a mode of transportation.Rule 5: Each segment must identify the specific mode used.

XML Schema

Validate the XMLdocument againstthe XML Schema

Page 18: XML Schema 1.1  for Managers

18

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Desirable Rules

mode Transportation

air airplane,hot-air balloon

water boat,hovercraft

ground car,bicycle

Rule: if mode = air thentransportation must be either airplane or hot-airballoon.Similar rules for water and ground.

Page 19: XML Schema 1.1  for Managers

19

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

XML Schema 1.0 cannot detect this error

<Segment id="1" mode="air"> <Transportation>boat</Transportation></Segment>

These are inconsistent.Error!

Why can’t the error be detected using XML Schema 1.0?Answer: Because the rule on the preceding slide cannot be expressed.

Page 20: XML Schema 1.1  for Managers

20

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

XML Schema 1.1

• Much more powerful than 1.0• Can express many more rules (The rule on the

preceding slide can be expressed!)• Let's see the new features that 1.1 provides …

Page 21: XML Schema 1.1  for Managers

21

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

New Feature:Express Business Policies

and Rulesusing Assertions

Page 22: XML Schema 1.1  for Managers

22

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Example Policy

Level 1 managers may sign off on purchase requests that do not exceed $10K. Level 1 managers may sign off on purchase requests that do not exceed $10K.

Page 23: XML Schema 1.1  for Managers

23

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

This doesn't conform to company policy

<purchase-request> <item>Widget</item> <cost>15000</cost> <signatureAuthority>Level 1</signatureAuthority></purchase-request>

Page 24: XML Schema 1.1  for Managers

24

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Validate

XML Schema

XML SchemaValidator

invalid!

<purchase-request> <item>Widget</item> <cost>15000</cost> <signatureAuthority> Level 1 </signatureAuthority></purchase-request>

Level 1 managers may sign off on purchase requests that do not exceed $10K.

Page 25: XML Schema 1.1  for Managers

25

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

XML Schema 1.0

• With XML Schema 1.0 business policies and rules could not be expressed. – The policy rule on the previous slides could not be

expressed.• Consequence: developers buried policies and

rules in procedural code.

Javaprogram

Level 1 managers may sign off on purchase requests that do not exceed $10K.

Page 26: XML Schema 1.1  for Managers

26

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Disadvantage #1 of Buried Policies and Rules

Javaprogram

Policy, expressed in Java code Business

Person

I don't understand Java. I can't

change the policy. Argh!

Page 27: XML Schema 1.1  for Managers

27

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Disadvantage #1 of Buried Policies and Rules

Difficult to change policies and rules.

Page 28: XML Schema 1.1  for Managers

28

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Disadvantage #2 of Buried Policies and Rules

Javaprogram

Policy, expressed in Java code

Manager

How much can I sign

off on?

Page 29: XML Schema 1.1  for Managers

29

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Disadvantage #2 of Buried Policies and Rules

The policies and rules are expressed in code instructions and are less visible – perhaps only the programmer knows the rules.

Page 30: XML Schema 1.1  for Managers

30

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

XML Schema 1.1

• In XML Schema 1.1 policies and rules can be expressed.

• Policies and rules are declaratively expressed.• Consequence:

- Policies and rules can be easily changed- Policies and rules are transparent

Page 31: XML Schema 1.1  for Managers

31

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Example Business Rule

Level 1 managers may sign off on purchase requests that do not exceed $10K.

No paragraph may have a security classification higher than the document's classification.

Page 32: XML Schema 1.1  for Managers

32

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

top-secret is higher than secret is higher than confidential is higher than unclassified

Page 33: XML Schema 1.1  for Managers

33

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Example Document

<Document classification="secret"> <Para classification="unclassified"> ... </Para> <Para classification="secret"> ... </Para> <Para classification="unclassified"> ... </Para> <Para classification="secret"> ... </Para></Document>

Ensure that no <Para> element has a classification higher than the <Document> element's classification

Page 34: XML Schema 1.1  for Managers

34

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

XML Schema 1.0 versusXML Schema 1.1

• In XML Schema 1.0 you cannot express the rule on the previous slide.

• In XML Schema 1.1 you can express it.

Page 35: XML Schema 1.1  for Managers

35

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Grammar checks

Business rule checks

XML Schema 1.0

XML Schema 1.1

Page 36: XML Schema 1.1  for Managers

36

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

XML Schema 1.0 versusXML Schema 1.1

• With XML Schema 1.0 you can express grammar (syntax) constraints, e.g., this markup should occur in this order, that data should be a date, and so forth.

• With XML Schema 1.1 you can still express grammar constraints but you can also express data relationships (business rules), e.g., the classification value here must be less than the classification value there.

Page 37: XML Schema 1.1  for Managers

37

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

New Feature

assertion

Page 38: XML Schema 1.1  for Managers

38

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Express Policies and Rules using Assertions

Policies and rules are expressed in XML Schema 1.1 using assertions, e.g.,

Assertion: Level 1 managers may sign off on purchase requests that do not exceed $10K.

Assertion: No paragraph may have a security classification higher than the document's classification.

Page 39: XML Schema 1.1  for Managers

39

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Review

• We've examined the first new feature in XML Schema 1.1, the ability to express policies and rules using assertions.

• This feature is a big benefit to businesses: now businesses can declaratively express their policies and rules in XML Schemas rather than burying them in procedural code.

Page 40: XML Schema 1.1  for Managers

40

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

New Feature:Creating Department-Specific

Data using Conditional Type Alternatives

Page 41: XML Schema 1.1  for Managers

41

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Example of Conditional Content

Level 1 managers may sign off on purchase requests that do not exceed $10K.

For each employee store this data: name, date of hire, employee number, and emergency contact telephone number.

Human Resources (HR) Department:

Level 1 managers may sign off on purchase requests that do not exceed $10K. For each employee store this data: name, areas of expertise, and current project.

Information Technology (IT) Department:

Page 42: XML Schema 1.1  for Managers

42

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Content varies, depending on dept.

<Employee dept="HR">

</Employee>

<Name>John Doe</Name><Hire-Date>2000-01-01</Hire-Date> <Employee-Num>123</Employee-Num> <Emergency-Contact>617-123-4567</Emergency-Contact>

<Employee dept="IT">

</Employee>

<Name>John Doe</Name><Expertise>XML, XML Schema</Expertise><Project>upgrade xyz interface</Project>

Page 43: XML Schema 1.1  for Managers

43

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

<Employee dept="_________">

</Employee>

If it's HR then the content mustbe an HR type. If it's IT then the content must be an IT type.

Page 44: XML Schema 1.1  for Managers

44

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Conditional Content

The content of Employee is conditional to the value of dept.

Page 45: XML Schema 1.1  for Managers

45

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Example #2

<Publication kind="book">

</Publication>

<Title>Origin of Wealth</Title><Author>Eric D. Beinhocker</Author> <Date>2006</Date> <ISBN>1-57851-777-X</ISBN> <Publisher>Harvard Business School Press</Publisher>

<Publication kind="magazine">

</Publication>

<Genre>Scientific</Genre><Circulation>733,000</Circulation><Founded>1845-08-28</Founded>

The content of Publication depends on the kind of publication.

Page 46: XML Schema 1.1  for Managers

46

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

<Publication kind="_________">

</Publication>

If it's magazine then the content mustbe a Magazine type. If it's book then the content must be a Book type.

Page 47: XML Schema 1.1  for Managers

47

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Conditional Content

The content of Publication is conditional to the value of kind.

Page 48: XML Schema 1.1  for Managers

48

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

New Feature

alternative

Page 49: XML Schema 1.1  for Managers

49

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Express Conditional Content using Alternative

Conditional content is expressed in XML Schema 1.1 using alternatives, e.g.,

Alternative: if kind="magazine" then the content is a Magazine type.

Alternative: if kind="book" then the content is a Book type.

Page 50: XML Schema 1.1  for Managers

50

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Review

• We've examined two new features in XML Schema 1.1:– the ability to express policies and rules using

assertions– the ability to express conditional content using

alternatives

Page 51: XML Schema 1.1  for Managers

51

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

New Feature:Expressing Business-wide

Attributes using Schema-wide Attributes

Page 52: XML Schema 1.1  for Managers

52

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

A nice feature of HTML

These attributes can be used with any HTML element

Page 53: XML Schema 1.1  for Managers

53

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

HTML has a set of attributes that can be used throughout the document. That's nice.

Page 54: XML Schema 1.1  for Managers

54

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Schema-wide Attributes

• In XML Schema 1.1 you can create a set of attributes and identify them as schema-wide, which means that they apply to every element in the schema document.

Page 55: XML Schema 1.1  for Managers

55

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

In XML Schema 1.0 if every element is to have, say, a "title" attribute then a title attribute declaration must be repeated on every element. That's not nice (and it's error prone).

Page 56: XML Schema 1.1  for Managers

56

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

New Feature

defaultAttributes

Page 57: XML Schema 1.1  for Managers

57

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Express Schema-wide Attributes using defaultAttributes

Schema-wide attributes are expressed in XML Schema 1.1 using defaultAttributes, e.g.,

defaultAttributes: these attributes apply throughout the schema document: class, id, title.

Page 58: XML Schema 1.1  for Managers

58

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Review

• We've examined three new features in XML Schema 1.1:– the ability to express policies and rules using

assertions– the ability to express conditional content using

alternatives– the ability to define schema-wide attributes

Page 59: XML Schema 1.1  for Managers

59

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

New Feature: Enable Business Change

usingOpen Content

Page 60: XML Schema 1.1  for Managers

60

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

U.S. Constitution

• Within the U.S. Constitution it describes how it can be changed.

• Our forefathers recognized that the world changes, and if the constitution doesn't adapt then it will ossify and be useless.

• So they built into the Constitution mechanisms for how it can be changed.

See section 3.1 of the following paper for a fascinating description of how the U.S. Constitution has mechanisms for changing itself:http://www.microfinance.com/English/Papers/Meta-rules.pdf

Page 61: XML Schema 1.1  for Managers

61

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Open Content

• XML Schemas that can't adapt to a changing world will ossify and be useless.

• Open content is a mechanism for enabling schemas to change.

Page 62: XML Schema 1.1  for Managers

62

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Book Seller Example

• You've coordinated with your clients and agreed to provide them with this information about each book:

Title, Author, Date, ISBN, Publisher

You create an XML Schema to express this.

Page 63: XML Schema 1.1  for Managers

63

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Example (cont.)

• Time passes … some clients request this additional information: - number of pages - binding (hardcover or softcover)And they want this information NOW!

• Your schema working group meets quarterly. Updates to support this new information are months away.

Page 64: XML Schema 1.1  for Managers

64

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Example (cont.)

• By designing your schemas with open content you will be able to add the requested new information to XML instance documents without waiting for the next quarterly schema meeting.

Page 65: XML Schema 1.1  for Managers

65

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Example (cont.)

<Book> <Title>The Origin of Wealth</Title> <Author>Eric D. Beinhocker</Author> <NumPages>527</NumPages> <Date>2006</Date> <ISBN>1-57851-777-X</ISBN> <Publisher>Harvard Business School Press</Publisher> <Binding>Hardcover</Binding></Book>

Book Schemawith

Open Content

create XML instance

527

Hardcoveraddnewinfo

deliver toclients

Page 66: XML Schema 1.1  for Managers

66

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Example (concluded)

• The new data is delivered to the clients in a timely fashion.

• At the next quarterly meeting the XML Schema is updated: the information provided for each book is title, author, date, ISBN, publisher and numPages, binding.

Page 67: XML Schema 1.1  for Managers

67

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

New Feature

openContent

Page 68: XML Schema 1.1  for Managers

68

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Express Schema-wide Attributes using openContent

Change is enabled in XML Schema 1.1 using openContent, e.g.,

openContent: permit new (client-requested) data to be interleaved among the standardized data.

Page 69: XML Schema 1.1  for Managers

69

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Review

• We've examined four new features in XML Schema 1.1:– the ability to express policies and rules using

assertions– the ability to express conditional content using

alternatives– the ability to define schema-wide attributes– the ability to facilitate change using open content

Page 70: XML Schema 1.1  for Managers

70

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

New Feature:Enabling Departments to Customize Corporate Data

using override and error

Page 71: XML Schema 1.1  for Managers

71

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Wish I could customize …

• Oftentimes I've used a tool and thought, "Boy, if only I could open up this tool and make a few tweaks, then it would be perfect for my needs."

• Regrettably the tool is not modifiable and so I'm stuck using something that's not quite what I need.

• That said, using the tool is a lot better than creating a custom tool from scratch.

Page 72: XML Schema 1.1  for Managers

72

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Unchangeable schemas can be customized!

• XML Schema 1.1 provides two mechanisms for customizing another schema without modifying it:– override– error

Page 73: XML Schema 1.1  for Managers

73

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Override

meeting- start time- end time- room number

override meetingwith this content:- track id- speaker- room capacity

reuse

This schema reuses the corporate schema, but customizes "meeting" with the data that is particular to conference meetings.

Office Meeting

Conference Meeting

Corporate schema, can't be changed.

Page 74: XML Schema 1.1  for Managers

74

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

How to change an unchangeable schema

Schema 1(read-only)

Schema 2

reuse

Schema 2 overrides items in Schema 1

Page 75: XML Schema 1.1  for Managers

75

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

<Employee dept="_________">

</Employee>

If it's HR then the content mustbe an HR type. If it's IT then the content must be an IT type.

Corporate schema specifies this

Recall this earlier example

Page 76: XML Schema 1.1  for Managers

76

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

HR Department

The HR department wants to reuse the corporate schema, but prohibit IT content:

CorporateSchema

HRSchema

reuse <Employee dept="_________">

</Employee>

If dept="IT" then error

Generate anerror if deptis accidentallyassigned IT.

Page 77: XML Schema 1.1  for Managers

77

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

New Feature

override

Page 78: XML Schema 1.1  for Managers

78

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

New Feature

error

Page 79: XML Schema 1.1  for Managers

79

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Enable Customization usingoverride and error

Enabling customization is expressed in XML Schema 1.1 using override and error, e.g.,

override: replace items in the corporate schema with your own data (and without changing the corporate schema).

error: disallow the use of certain items in the corporate schema.

Page 80: XML Schema 1.1  for Managers

80

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Review

• We've examined five new features in XML Schema 1.1:– the ability to express policies and rules using

assertions– the ability to express conditional content using

alternatives– the ability to define schema-wide attributes– the ability to facilitate change using open content– the ability to customize schemas that ordinarily are

unchangeable, using override and error

Page 81: XML Schema 1.1  for Managers

81

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

New Feature:Enabling Dissemination of

New Announcementsusing

inherited attributes

Page 82: XML Schema 1.1  for Managers

82

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

<Merchandise discount="10%">

</Merchandise>

Want this discount information to be visible (disseminated) throughout the document

<Coats> …</Coats><Shirts> …</Shirts<Pants> …</Pants

Page 83: XML Schema 1.1  for Managers

83

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

i.e., want this discount attribute to be "inherited"

<Merchandise discount="10%">

</Merchandise>

<Coats> …</Coats><Shirts> …</Shirts><Pants> …</Pants>

Page 84: XML Schema 1.1  for Managers

84

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

<Contract language="FR">

</Contract>

Want this language information to be visible (disseminated) throughout the document

<Foreign-Release> …</Foreign-Release><State-Department> …</State-Department><Legal> …</Legal>

Page 85: XML Schema 1.1  for Managers

85

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

<Contract language="FR">

</Contract>

i.e., want this language attribute to be "inherited"

<Foreign-Release> …</Foreign-Release><State-Department> …</State-Department><Legal> …</Legal>

Page 86: XML Schema 1.1  for Managers

86

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

New Feature

inheritable

Page 87: XML Schema 1.1  for Managers

87

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Enable Information Dissemination using inheritable attributes

Enabling the dissemination of information is expressed in XML Schema 1.1 using inheritable attributes, e.g.,

inheritable: this attribute can be viewed and used from here on in.

Page 88: XML Schema 1.1  for Managers

88

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Review

• We've examined six new features in XML Schema 1.1:– the ability to express policies and rules using assertions– the ability to express conditional content using alternatives– the ability to define schema-wide attributes– the ability to facilitate change using open content– the ability to customize schemas that ordinarily are

unchangeable, using override and error– the ability to disseminate information within a document

using inheritable attributes

Page 89: XML Schema 1.1  for Managers

89

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

New Feature:Enabling User-Friendly

Arrangement of Informationusing "all"

Page 90: XML Schema 1.1  for Managers

90

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Camera Lens

The camera comes with a 37-155mm zoom lens

that has an f-stop of 4.8-11.7

The camera comes with a lens that has an f-stop

of 4.8-11.7 and is a 37-155mm zoom

Page 91: XML Schema 1.1  for Managers

91

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Does Order Really Matter?

<Camera-Lens> <f-stop>4.8-11.7</f-stop> <focal-length>37-155mm zoom</focal-length></Camera-Lens>

<Camera-Lens> <focal-length>37-155mm zoom</focal-length> <f-stop>4.8-11.7</f-stop></Camera-Lens>

-- versus --

Page 92: XML Schema 1.1  for Managers

92

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Does Order Really Matter?

Probably not. To be user-friendly, allow both orders.

Page 93: XML Schema 1.1  for Managers

93

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Any Order

• XML Schema 1.0 was pretty controlling in terms of the order of data.

• XML Schema 1.1 is much less controlling; schemas can be designed to allow the data to be arranged in any order.

Page 94: XML Schema 1.1  for Managers

94

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

New Feature

allNote: "all" is found in XML Schema 1.0, but it did not permit elements with maxOccurs of 2 or more. XML Schema 1.1 does not have this restriction.

Page 95: XML Schema 1.1  for Managers

95

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Enable a user-friendly arrangement of information

using "all"

Enabling information to be expressed in any order is accomplished in XML Schema 1.1 using the "all" element, e.g.,

all: provide the f-stop and the focal-length of the camera lens in an order that is useful to you.

Page 96: XML Schema 1.1  for Managers

96

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Review

• We've examined seven new features in XML Schema 1.1:– the ability to express policies and rules using assertions– the ability to express conditional content using alternatives– the ability to define schema-wide attributes– the ability to facilitate change using open content– the ability to customize schemas that ordinarily are unchangeable,

using override and error– the ability to disseminate information within a document using

inheritable attributes– the ability to present the information in a user-friendly order, using the

"all" element

Page 97: XML Schema 1.1  for Managers

97

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Other New Features

Page 98: XML Schema 1.1  for Managers

98

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

The many names of "subway"

• There are different ways of saying "I took the subway into town"– In Boston we say "I took the T into town"– In D.C. they say "I took the metro into town"– In London they say "I took the tube into town"– In Chicago they say "I took the L into town"

Page 99: XML Schema 1.1  for Managers

99

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Substitution

• XML Schema 1.1 enables you to express "T can be substituted for either metro or tube or L"

T

metro tube

substitutable for substitutable for

L

substitutable for

Page 100: XML Schema 1.1  for Managers

100

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Multiple Identifiers

My SSN is …My employee # is…

My driver's license # is …

Page 101: XML Schema 1.1  for Managers

101

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Multiple ID values

• XML Schema 1.1 enables you to associate multiple ID values to an element.

Stereo model-number="…" serial-number="…"

Page 102: XML Schema 1.1  for Managers

102

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Symbol for the decimal point in U.S.A. versus France

15.7 (USA)

15,7 (France)

Page 103: XML Schema 1.1  for Managers

103

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

What's the symbol for the decimal point in XML Schema 1.1?

15.7

Page 104: XML Schema 1.1  for Managers

104

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

What's the symbol for the decimal point in XML Schema 1.1?

Isn't that unfair to the folks in France?

15.7

Page 105: XML Schema 1.1  for Managers

105

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Vendor-unique Extensions

• XML Schema 1.1 allows vendors to extend the language.

• Thus a vendor may create a new decimal datatype (French:decimal) with "," as the decimal point.

Page 106: XML Schema 1.1  for Managers

106

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Other new datatypes

• anyAtomicType: the anyAtomicType is the union of the values of all the primitive types (string + integer + boolean + …)

• dateTimeStamp: a dateTimeStamp value is a date plus time plus timezone

• yearMonthDuration: a yearMonthDuration value is a duration consisting of years and months

• dayTimeDuration: a dayTimeDuration value is a duration consisting of days and time

Page 107: XML Schema 1.1  for Managers

107

Copyright © [2010]. Roger L. Costello. All Rights Reserved.

Summary

• XML Schema 1.1 has lots of powerful new features.

• I hope this tutorial has convinced you that these new features can benefit your business.

• I recommend switching to XML Schema 1.1 as soon as possible.