1 / 107

XML Schema 1.1 for Managers

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.

luana
Download Presentation

XML Schema 1.1 for Managers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML Schema 1.1 for Managers Roger L. Costello http://www.xfront.com 3 December, 2012

  2. 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. 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.1 XML Schema 1.1 is a superset of XML Schema 1.0 XML Schema 1.0

  4. 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!

  5. 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. Technology Stack XML Schema 1.1 XML Schema 1.0 Each technology assumes you know the technologies beneath it. XPath Namespaces XML

  7. Review: Purpose ofXML Schemas

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

  9. app XML XML app ship the XML "shred" app XML as a temporary transport vehicle 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. XML app XML app Rob Jill Anthony Sally Pete app XML as permanent storage Often occurring in the form of a workflow:

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

  12. I envision systems working like this: 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.

  13. 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. Rules are Important All enterprise work as it grows toward perfection becomes rule-based Roger Costello and Bob Wilson

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

  17. 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> Validate the XML document against the XML Schema XML Schema 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.

  18. Desirable Rules Transportation mode Rule: if mode = air then transportation must be either airplane or hot-air balloon. Similar rules for water and ground. airplane, hot-air balloon air boat, hovercraft water car, bicycle ground

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

  20. 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. New Feature:Express Business Policies and Rulesusing Assertions

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

  23. This doesn't conform to company policy <purchase-request> <item>Widget</item> <cost>15000</cost> <signatureAuthority>Level 1</signatureAuthority> </purchase-request>

  24. Validate XML Schema Level 1 managers may sign off on purchase requests that do not exceed $10K. XML Schema Validator invalid! <purchase-request> <item>Widget</item> <cost>15000</cost> <signatureAuthority> Level 1 </signatureAuthority> </purchase-request>

  25. 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. Disadvantage #1 of Buried Policies and Rules I don't understand Java. I can't change the policy. Argh! Java program Policy, expressed in Java code Business Person

  27. Disadvantage #1 of Buried Policies and Rules Difficult to change policies and rules.

  28. Disadvantage #2 of Buried Policies and Rules How much can I sign off on? Java program Manager Policy, expressed in Java code

  29. 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. 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. 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. top-secret is higher than secret is higher than confidential is higher than unclassified

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

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

  35. XML Schema 1.0 Grammar checks XML Schema 1.1 Business rule checks

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

  37. New Feature assertion

  38. 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. 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. New Feature:Creating Department-SpecificData using Conditional Type Alternatives

  41. Example of Conditional Content Human Resources (HR) Department: For each employee store this data: name, date of hire, employee number, and emergency contact telephone number. Level 1 managers may sign off on purchase requests that do not exceed $10K. Information Technology (IT) 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.

  42. Content varies, depending on dept. <Employee dept="HR"> </Employee> <Employee dept="IT"> </Employee> <Name>John Doe</Name> <Hire-Date>2000-01-01</Hire-Date> <Employee-Num>123</Employee-Num> <Emergency-Contact>617-123-4567</Emergency-Contact> <Name>John Doe</Name> <Expertise>XML, XML Schema</Expertise> <Project>upgrade xyz interface</Project>

  43. If it's HR then the content must be an HR type. If it's IT then the content must be an IT type. <Employee dept="_________"> </Employee>

  44. Conditional Content The content of Employee is conditional to the value of dept.

  45. Example #2 <Publication kind="book"> </Publication> <Publication kind="magazine"> </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> <Genre>Scientific</Genre> <Circulation>733,000</Circulation> <Founded>1845-08-28</Founded> The content of Publication depends on the kind of publication.

  46. If it's magazine then the content must be a Magazine type. If it's book then the content must be a Book type. <Publication kind="_________"> </Publication>

  47. Conditional Content The content of Publication is conditional to the value of kind.

  48. New Feature alternative

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

More Related