Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Copyright © [2010]. Roger L. Costello. All Rights Reserved. XML Schema 1.1 for Managers Roger L. Costello 3 December, 2012.

Similar presentations


Presentation on theme: "1 Copyright © [2010]. Roger L. Costello. All Rights Reserved. XML Schema 1.1 for Managers Roger L. Costello 3 December, 2012."— Presentation transcript:

1 1 Copyright © [2010]. Roger L. Costello. All Rights Reserved. XML Schema 1.1 for Managers Roger L. Costello 3 December, 2012

2 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.

3 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

4 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: Apache XERCES supports XML Schema 1.1: You can create XML Schema 1.1 schemas today!

5 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)

6 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.

7 7 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Review: Purpose of XML Schemas

8 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 XML "shred" app ship the XML

9 9 Copyright © [2010]. Roger L. Costello. All Rights Reserved. XML as a temporary transport vehicle XML "shred" app ship 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."

10 10 Copyright © [2010]. Roger L. Costello. All Rights Reserved. XML as permanent storage XML app XML Rob SallyPete JillAnthony Often occurring in the form of a workflow:

11 11 Copyright © [2010]. Roger L. Costello. All Rights Reserved. XML as permanent storage (cont.) XML app1 app2app3app4 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.

12 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 youre 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:

13 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.

14 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

15 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

16 16 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Example: My Vacation airplane boat car

17 17 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Validate airplane boat car 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 XML document against the XML Schema

18 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 then transportation must be either airplane or hot-air balloon. Similar rules for water and ground.

19 19 Copyright © [2010]. Roger L. Costello. All Rights Reserved. XML Schema 1.0 cannot detect this error boat These are inconsistent. Error! Why cant the error be detected using XML Schema 1.0? Answer: Because the rule on the preceding slide cannot be expressed.

20 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 …

21 21 Copyright © [2010]. Roger L. Costello. All Rights Reserved. New Feature: Express Business Policies and Rules using Assertions

22 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.

23 23 Copyright © [2010]. Roger L. Costello. All Rights Reserved. This doesn't conform to company policy Widget Level 1

24 24 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Validate XML Schema Validator invalid! Widget Level 1 Level 1 managers may sign off on purchase requests that do not exceed $10K.

25 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. Java program Level 1 managers may sign off on purchase requests that do not exceed $10K.

26 26 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Disadvantage #1 of Buried Policies and Rules Java program Policy, expressed in Java code Business Person I don't understand Java. I can't change the policy. Argh!

27 27 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Disadvantage #1 of Buried Policies and Rules Difficult to change policies and rules.

28 28 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Disadvantage #2 of Buried Policies and Rules Java program Policy, expressed in Java code Manager How much can I sign off on?

29 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.

30 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

31 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.

32 32 Copyright © [2010]. Roger L. Costello. All Rights Reserved. top-secret is higher than secret is higher than confidential is higher than unclassified

33 33 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Example Document Ensure that no element has a classification higher than the element's classification

34 34 Copyright © [2010]. Roger L. Costello. All Rights Reserved. XML Schema 1.0 versus XML 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.

35 35 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Grammar checks Business rule checks XML Schema 1.0 XML Schema 1.1

36 36 Copyright © [2010]. Roger L. Costello. All Rights Reserved. XML Schema 1.0 versus XML 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.

37 37 Copyright © [2010]. Roger L. Costello. All Rights Reserved. New Feature assertion

38 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.

39 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.

40 40 Copyright © [2010]. Roger L. Costello. All Rights Reserved. New Feature: Creating Department-Specific Data using Conditional Type Alternatives

41 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:

42 42 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Content varies, depending on dept. John Doe John Doe XML, XML Schema upgrade xyz interface

43 43 Copyright © [2010]. Roger L. Costello. All Rights Reserved. If it's HR then the content must be an HR type. If it's IT then the content must be an IT type.

44 44 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Conditional Content The content of Employee is conditional to the value of dept.

45 45 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Example #2 Origin of Wealth Eric D. Beinhocker X Harvard Business School Press Scientific 733, The content of Publication depends on the kind of publication.

46 46 Copyright © [2010]. Roger L. Costello. All Rights Reserved. If it's magazine then the content must be a Magazine type. If it's book then the content must be a Book type.

47 47 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Conditional Content The content of Publication is conditional to the value of kind.

48 48 Copyright © [2010]. Roger L. Costello. All Rights Reserved. New Feature alternative

49 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.

50 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

51 51 Copyright © [2010]. Roger L. Costello. All Rights Reserved. New Feature: Expressing Business-wide Attributes using Schema-wide Attributes

52 52 Copyright © [2010]. Roger L. Costello. All Rights Reserved. A nice feature of HTML These attributes can be used with any HTML element

53 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.

54 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.

55 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).

56 56 Copyright © [2010]. Roger L. Costello. All Rights Reserved. New Feature defaultAttributes

57 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.

58 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

59 59 Copyright © [2010]. Roger L. Costello. All Rights Reserved. New Feature: Enable Business Change using Open Content

60 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:

61 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.

62 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.

63 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.

64 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.

65 65 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Example (cont.) The Origin of Wealth Eric D. Beinhocker X Harvard Business School Press Hardcover Book Schema with Open Content create XML instance 527 Hardcover add new info deliver to clients

66 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.

67 67 Copyright © [2010]. Roger L. Costello. All Rights Reserved. New Feature openContent

68 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.

69 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

70 70 Copyright © [2010]. Roger L. Costello. All Rights Reserved. New Feature: Enabling Departments to Customize Corporate Data using override and error

71 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.

72 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

73 73 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Override meeting - start time - end time - room number override meeting with 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.

74 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

75 75 Copyright © [2010]. Roger L. Costello. All Rights Reserved. If it's HR then the content must be an HR type. If it's IT then the content must be an IT type. Corporate schema specifies this Recall this earlier example

76 76 Copyright © [2010]. Roger L. Costello. All Rights Reserved. HR Department The HR department wants to reuse the corporate schema, but prohibit IT content: Corporate Schema HR Schema reuse If dept="IT" then error Generate an error if dept is accidentally assigned IT.

77 77 Copyright © [2010]. Roger L. Costello. All Rights Reserved. New Feature override

78 78 Copyright © [2010]. Roger L. Costello. All Rights Reserved. New Feature error

79 79 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Enable Customization using override 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.

80 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

81 81 Copyright © [2010]. Roger L. Costello. All Rights Reserved. New Feature: Enabling Dissemination of New Announcements using inherited attributes

82 82 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Want this discount information to be visible (disseminated) throughout the document … …

83 83 Copyright © [2010]. Roger L. Costello. All Rights Reserved. i.e., want this discount attribute to be "inherited" … … …

84 84 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Want this language information to be visible (disseminated) throughout the document … … …

85 85 Copyright © [2010]. Roger L. Costello. All Rights Reserved. i.e., want this language attribute to be "inherited" … … …

86 86 Copyright © [2010]. Roger L. Costello. All Rights Reserved. New Feature inheritable

87 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.

88 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

89 89 Copyright © [2010]. Roger L. Costello. All Rights Reserved. New Feature: Enabling User-Friendly Arrangement of Information using "all"

90 90 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Camera Lens The camera comes with a mm zoom lens that has an f-stop of The camera comes with a lens that has an f-stop of and is a mm zoom

91 91 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Does Order Really Matter? mm zoom mm zoom versus --

92 92 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Does Order Really Matter? Probably not. To be user-friendly, allow both orders.

93 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.

94 94 Copyright © [2010]. Roger L. Costello. All Rights Reserved. New Feature all Note: "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.

95 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.

96 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

97 97 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Other New Features

98 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"

99 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 L

100 100 Copyright © [2010]. Roger L. Costello. All Rights Reserved. Multiple Identifiers My SSN is … My employee # is… My driver's license # is …

101 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="…"

102 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)

103 103 Copyright © [2010]. Roger L. Costello. All Rights Reserved. What's the symbol for the decimal point in XML Schema 1.1? 15.7

104 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

105 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.

106 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

107 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.


Download ppt "1 Copyright © [2010]. Roger L. Costello. All Rights Reserved. XML Schema 1.1 for Managers Roger L. Costello 3 December, 2012."

Similar presentations


Ads by Google