Enabling Grids for E-sciencE www.eu-egee.org Schemas Richard Hopkins National e-Science Centre, Edinburgh February 23 / 24 2005.

Slides:



Advertisements
Similar presentations
Managing XML and Semistructured Data Lecture 12: XML Schema Prof. Dan Suciu Spring 2001.
Advertisements

1 Web Data Management XML Schema. 2 In this lecture XML Schemas Elements v. Types Regular expressions Expressive power Resources W3C Draft:
XML 6.5 XML Schema (XSD) 6. What is XML Schema? The origin of schema  XML Schema documents are used to define and validate the content and structure.
An Introduction to XML Based on the W3C XML Recommendations.
Introduction to XLink Transparency No. 1 XML Information Set W3C Recommendation 24 October 2001 (1stEdition) 4 February 2004 (2ndEdition) Cheng-Chia Chen.
XML Schema Definition Language
XML Schemas Lecture 10, 07/10/02. Acknowledgements A great portion of this presentation has been borrowed from Roger Costello’s excellent presentation.
Lecture 14 XML Validation. a simple element containing text attribute; attributes provide additional information about an element and consist of a name.
1 Substitution Groups in XML Schemas Tomer Shiran Winter 2003/4 Semester.
XML Simple Types CSPP51038 shortcourse. Simple Types Recall that simple types are composed of text-only values. All attributes are of simple type Elements.
1 XML Schemas Marco Mesiti This Presentation has been extracted from Roger L. Costello (XML Technologies Course)
XML Schemas and Namespaces Lecture 11, 07/10/02. BookStore.dtd.
1 Week5 – Schema Why Schema? Schemas vs. DTDs Introduction – W3C vs. Microsoft XDR Schema, How To? Element Types – Simple vs. Complex Attributes Restrictions/Facets.
XML Schemas. “Schemas” is a general term--DTDs are a form of XML schemas –According to the dictionary, a schema is “a structured framework or plan” When.
Enabling Grids for E-sciencE ISSGC’05 XML Schemas (XSD) Richard Hopkins, National e-Science Centre, Edinburgh June 2005.
Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti.
XML Schema Basics SD2520 Databases using XML and Jquery Chapter 12
Introduction to XML This material is based heavily on the tutorial by the same name at
Manohar – Why XML is Required Problem: We want to save the data and retrieve it further or to transfer over the network. This.
Processing of structured documents Spring 2003, Part 3 Helena Ahonen-Myka.
17 Apr 2002 XML Schema Andy Clark. What is it? A grammar definition language – Like DTDs but better Uses XML syntax – Defined by W3C Primary features.
XP New Perspectives on XML Tutorial 4 1 XML Schema Tutorial – Carey ISBN Working with Namespaces and Schemas.
XP New Perspectives on XML Tutorial 3 1 DTD Tutorial – Carey ISBN
Lecture 15 XML Validation. a simple element containing text attribute; attributes provide additional information about an element and consist of a name.
Why XML ? Problems with HTML HTML design - HTML is intended for presentation of information as Web pages. - HTML contains a fixed set of markup tags. This.
IS432 Semi-Structured Data Lecture 3: XSchema Dr. Gamal Al-Shorbagy.
XML Schema Vinod Kumar Kayartaya. What is XML Schema?  XML Schema is an XML based alternative to DTD  An XML schema describes the structure of an XML.
1 XML Schemas. 2 Useful Links Schema tutorial links:
Dr. Azeddine Chikh IS446: Internet Software Development.
Copyright © [2001]. Roger L. Costello. All Rights Reserved. 1 XML Schemas (Primer)
Neminath Simmachandran
XML and friends Part 2 - XML Schema ELAG 2001 workshop 8 Jan Erik Kofoed © BIBSYS Library Automation.
Li Tak Sing COMPS311F. XML Schemas XML Schema is a more powerful alternative to DTD to describe XML document structures. The XML Schema language is also.
Creating Data Schemas Presentation by Chad Borer 2/6/2006.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
Session IV Chapter 9 – XML Schemas
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation XML Schema 2 Lecturer.
Enabling Grids for E-sciencE PPARC Summer School, May 2005 Schemas (and XML) Richard Hopkins, National e-Science Centre, Edinburgh.
Beginning XML 4th Edition. Chapter 5: XML Schemas.
New Perspectives on XML, 2nd Edition
XML Schema. Why Schema? To define a class of XML documents Serve same purpose as DTD “Instance document" used for XML document conforming to schema.
Schemas 1www.tech.findforinfo.com. What is a Schema a schematic or preliminary plan Description of a structure, details... 2www.tech.findforinfo.com.
XML – Part III. The Element … This type of element either has the element content or the mixed content (child element and data) The attributes of the.
An Introduction to XML Sandeep Bhattaram
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 5 XML Schema (Based on Møller and Schwartzbach,
Sheet 1XML Technology in E-Commerce 2001Lecture 2 XML Technology in E-Commerce Lecture 2 Logical and Physical Structure, Validity, DTD, XML Schema.
XML 2nd EDITION Tutorial 4 Working With Schemas. XP Schemas A schema is an XML document that defines the content and structure of one or more XML documents.
1 Tutorial 14 Validating Documents with Schemas Exploring the XML Schema Vocabulary.
Tutorial 13 Validating Documents with Schemas
Management of XML and Semistructured Data Lecture 11: Schemas Wednesday, May 2nd, 2001.
Processing of structured documents Spring 2003, Part 3 Helena Ahonen-Myka.
Working with XML Schemas ©NIITeXtensible Markup Language/Lesson 3/Slide 1 of 36 Objectives In this lesson, you will learn to: * Declare attributes in an.
XML Validation II Schemas Robin Burke ECT 360. Outline Namespaces Documents  Data types XML Schemas Elements Attributes Derived data types RELAX NG.
Primer on XML Schema CSE 544 April, XML Schemas Generalizes DTDs Uses XML syntax Two parts: structure and datatypes Very complex –criticized –alternative.
QUALITY CONTROL WITH SCHEMAS CSC1310 Fall BASIS CONCEPTS SchemaSchema is a pass-or-fail test for document Schema is a minimum set of requirements.
Introduction to XML Schema John Arnett, MSc Standards Modeller Information and Statistics Division NHSScotland Tel: (x2073)
CSE 6331 © Leonidas Fegaras XML Schema 1 XML Schema Leonidas Fegaras.
XSD: XML Schema Language Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
XML Schema Definition (XSD). Definition of a Schema It is a model for describing the structure and content of data The XML Schema was developed as a content.
Lecture 0 W3C XML Schema. Topics Status Motivation Simple type vs. complex type.
XML Validation. a simple element containing text attribute; attributes provide additional information about an element and consist of a name value pair;
XML Schema – Simple Type Web site:
CITA 330 Section 4 XML Schema. XML Schema (XSD) An alternative industry standard for defining XML dialects More expressive than DTD Using XML syntax Promoting.
4 Copyright © 2004, Oracle. All rights reserved. Validating XML by Using XML Schema.
XML Schemas Dr. Awad Khalil Computer Science Department AUC.
Schemas Richard Hopkins National e-Science Centre, Edinburgh
Data Modeling II XML Schema & JAXB Marc Dumontier May 4, 2004
ISSGC’05 XML Schemas (XSD)
THE DATATYPES OF XML SCHEMA A Practical Introduction
New Perspectives on XML
Presentation transcript:

Enabling Grids for E-sciencE Schemas Richard Hopkins National e-Science Centre, Edinburgh February 23 /

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 2 OUTLINE Goals –To be able to construct and read an XML Schema –To be able to use the XMLspy tool for that Outline –General Structure –Simple Types –Miscellany –Extensibility –Concluding Remarks –Practical

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 3 XML(SPY) A Schema defines the syntax for an XML language –An XML document can have an associated Schema –It is valid if it meets the syntax rules of that schema –This can import syntax for (parts of) other languages Much like programming language type declarations –But some peculiarities XMLSPY (free edition) –Provides a graphical representation of a Schema –Provides for checking a XML document for validity with respect to a specified Schema –I Will use graphical notation of XMLSPY –Example files (download from  POexample.xsd – a Schema  POexample.xml – an instance of POexample.xsd Schema

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 4 Example Schema Structure Top level of XMLspy - –☺(expandable) name ann: annotation –Global items - can be directly referenced, here or externally attribute – declares a type of attribute for use in elements annotation – supplementatry info for human / m/c processing simpleType – declares an element type without components complexType – declares an element type with components –Each component is an anonymous simple type or complex type element – declares an element with components – like a template annotationHere is a Schema attributeunitsann: Metric or Imperial simpleTypedateT ann: DD/MM/YYYY or MM/DD/YYYY simpleTypeaccNoT ann: Account Number format simpleTypeprodCodeT ann: Product Code format ☺complexTypeentryT ann: A PO entry for one ordered item ☺elementnote ann: An annotation on the document ☺elementaddr ann: A UK address ☺elementPO ann: A Purchase Order

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 5 Example Schema Structure An element is a “element type” that –could be the root element of the XML document – PO –Can be referenced from elsewhere as a way of giving the type of a component – addr and note –  an alternative to defining types addrT and noteT annotationHere is a Schema attributeunitsann: Metric or Imperial simpleTypedateT ann: DD/MM/YYYY or MM/DD/YYYY simpleTypeaccNoT ann: Account Number format simpleTypeprodCodeT ann: Product Code format ☺complexTypeentryT ann: A PO entry for one ordered item ☺elementnote ann: An annotation on the document ☺elementaddr ann: A UK address ☺elementPO ann: A Purchase Order

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 6 Element Structuring PO date USdate dateT UKdate dateT account accNo accNoT deliver addr specialInstr xs:string ; bill addr terms xs:string ; {“7-day”, “28-day”, “end-of-month”} entry entryT; 1..* note 0..3 … …. … … 7-day … …. … ….

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 7 Element Structuring entryT prodCode prodCodeT quant Xs:decimal Note (0..1) collect – Optional xs:boolean; default=“false” units - required ABC-12345<> any old text mixed

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 8 Element Structuring dateT xs:string \d{2}/\d{2}/\d{4} accNoT xs:string [A-Z]?\d{3}-[A-Z]{3} prodCodeT xs:string [A-Z]{2,4}-\d{4,8} addr street xs:string ; city xs:string ; postCode xs:string ; 6..8 note xs:string ; 1..* units xs:string ; {“metric”, “imperial”} Attribute declarations entryT prodCode prodCodeT quant Xs:decimal Note (0..1) collect – Optional xs:boolean; default=“false” units - required ABC-12345<> any old text mixed

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 9 Complex Content - Features Complex Content – Mixed –if so text can be intermixed with element components ABC any old text Nillable (element property) –validated element can have attribute xsi:nil = “true” (and no content) Model –Sequence – All of the A, B, …components occur in that order –Choice – One of the A, B, … components occurs  For these a “component” might be empty/repeated –All – All of the A, B, … component occurs, in any order  For this, a component might be empty, but can’t be repeated entryT collect – optional Mixed, nillable date A B account A B A B

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 10 Complex Content - Features Multiplicities –Each child element may itself represent optional and/or repeating elements –The constructor sequence/choice/all may itself be optional/repeating Nesting –The constructor may have constructor as immediate descendant  Except ALL can’t combine with another constructor  Restriction is to improve parasability Regular expression of child elements ( ( (A? | B*)* | (C D)* )? ((E F)*|(G | H)* If exclude ALL and only 1..1, 0..1 and 0..* Test 0..* A B C D E F G H 1..* * 0..1

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 11 Actual XML Test 0..* A 0..1 xs:anySimpleType

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 12 Empty Content <xs:attribute name="quantity" type="xs:decimal"/ No components All information is in existence of the item and its attributes (if any)

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 13 SIMPLE TYPES Goals –To be able to construct and read an XML Schema –To be able to use the XMLspy tool for that Outline –General Structure –Simple Types –Miscellany –Extensibility –Concluding Remarks –Practical

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 14 Simple Types/Elements General features –minOcc, maxOcc – repetition –Default/Fixed –  Default - the value given if absent  Fixed – as default, but if specified, must be this value –Nillable – can have attribute xsi:nil=“true” –Derivation -  Restriction – some restriction on a base simple type String matching [A-Z]?\d{3}-[A-Z]{3} ; integer x, 4<x<23 ; …  List – space-separated list of instances of a base simple type A a564  Union – any one of a number of different simple types UKdate or USdate Instance needs 12/31/2004

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 15 Derivation Types Derivation –Base type – e.g. string, integer, defined simple type –Facets  Lengths - length, maxLength,minLength  whiteSpace preserve replace – tab, newline, linefeed all replaced by space character collapse – do replace and then collapse multiple spaces to one  Limits – minInclusive, maxInclusive, minExclusive, maxExclusive  Digits – totalDigits, fractionalDigits – (value range and accurracy)  pattern – regular expression [A-Z] [^a-z] [(A-Z)-[MN]] {3,6} {,7} {3} \d. | ? * +  enumeration – list of allowed values

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 16 Primitive Types and their facets ListLengths,pattern, enumeration Unionpattern, enumeration Atomic - string Lengths, pattern, enumeration, whiteSpace Boolean pattern, whiteSpace“1”, “0”, “true”, “false” Float pattern, enumeration, whiteSpace, Limits“17.54E3”, “INF”, “NAN” Double pattern, enumeration, whiteSpace, Limits Decimal Digits, pattern, whiteSpace, enumeration, Limits “+12.34”, “17” hexBinary Lengths, pattern, enumeration, whiteSpace "0FB7" base64Binary Lengths, pattern, enumeration, whiteSpace“aAb9” anyURI Lengths, pattern, enumeration, whiteSpace QName Lengths, pattern, enumeration, whiteSpace“xsd:element” NOTATIONLengths, pattern, enumeration

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 17 Primitive Types duration pattern, enumeration, whiteSpace, Limits“P1Y2M3DT10H30M” dateTime pattern, enumeration, whiteSpace, Limits “ T12:00:00” time pattern, enumeration, whiteSpace, Limits“13:20:00-05:00” date pattern, enumeration, whiteSpace, Limits “ ” gYearMonthpattern, enumeration, whiteSpace, Limits“ ” gYearpattern, enumeration, whiteSpace, Limits gMonthDay pattern, enumeration, whiteSpace, Limits gDay pattern, enumeration, whiteSpace, Limits gMonth pattern, enumeration, whiteSpace, Limits

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 18 Built in (derived Types) anyTypeUnion of them all –Complex types –anySimpleType  Primitives – decimal, string, anyURI, QName, boolean, float, Times/Durations, Binaries  Derived by restriction decimal – oInteger o nonPositiveInteger o …. string onormalisedString each whitespace character become a space otoken

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 19 Tokens token –A string with no leading or training spaces and only single spaces elsewhere  “This is a Token” “ This is not “  A tokenized string Derivations of token –Corresponding to various XML constructs (to ease definition and parsing of XML documents) – name language

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 20 MISCELLANY Goals –To be able to construct and read an XML Schema –To be able to use the XMLspy tool for that Outline –General Structure –Simple Types –Miscellany –Extensibility –Concluding Remarks –Practical

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 21 Attributes Declarations Attribute has properties – –Some simple type –Default/fixed –Use – optional (default), prohibited, required

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 22 Annotations To annotate a schema for the benefit of –human readers – a documentation element –Applications – an appinfo element A Purchase Order How to do it …. annotationHere is a Schema attributeunitsann: Metric or Imperial simpleTypedateT ann: DD/MM/YYYY or MM/DD/YYYY …. PO date A Purchase Order

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 23 Namespaces –Target Namespace The name of the language for which this schema defines the syntax This schema will only validate an instance if its namespace matches - <xs:schema elementFormDefault=“unqualified“ attributeFormDefault="unqualified" xmlns:xs= targetNameSpace= “ xmlns=“ …. …. …. … … If schema has no targetNameSpace – it can only validate un-qualified names

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 24 Qualification Form The root element name has to be qualified This requires other names to be unqualified <xs:schema elementFormDefault=“unqualified“ attributeFormDefault=“unqualified" …. …. …. … … … This Requires other names also to be qualified Can override the defaults by defining form for an element <xs:schema elementFormDefault=“qualified“ attributeFormDefault=“qualified" …. …. …. … … …

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 25 Qualification Form Normal is –Schema requires qualified names, unqualified attributes –Instance uses default qualifier (only applies to element names) <xs:schema elementFormDefault=“qualified“ attributeFormDefault=“unqualified" …. …. …. … … … … … Equivalent to

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 26 Include All must be same target namespace Forms one logical schema as the combination of physically distinct schemas I.e. refernceing main as the schema allows document to be an PO or an SE (stock enquiry) Allows individual document definitions to share type definitions <schema targetNameSpace= “…www. …/forms/ns”> <include schemaLocation= “…www…/Forms/Types.xsd"/> …. …www… /Forms/PO.xsd <schema targetNameSpace= “…www. …/forms/ns”> <simpleType name= “AccNoT“> …. ….other types …. …www… /Forms/Types.xsd <schema targetNameSpace= “…www. …/forms/ns”> <include schemaLocation= “…www…/Forms/Types.xsd"/> …. …www… /Forms/SE.xsd <schema targetNameSpace= “…www. …/forms/ns”> <include schemaLocation= “…www…/Forms/PO.xsd"/> <include schemaLocation= “…www…/Forms/SE.xsd"/> …www… /Forms/main.xsd

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 27 Importation Include is to distribute the definition of this namespace (language) over multiple Schema definitions Import is to allow use of other namespaces (languages) in the definition for this language. <schema targetNameSpace= “…www. …/Standards/ns” > <simpleType name= “USdateT“> …. ….other types …. …www… /Standards.xsd <schema targetNameSpace= “…www. …/forms/ns” xmlns:st =“…www…/Standards/ns” > <import namespace= “…www…/Standards/ns” schemaLocation= “…www… /Standards.xsd” > …. … …www… /Forms/PO.xsd Must have namespace definition for import’s namespace

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 28 EXTENSIBILITY Goals –To be able to construct and read an XML Schema –To be able to use the XMLspy tool for that Outline –General Structure –Simple Types –Miscellany –Extensibility –Concluding Remarks –Practical

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 29 Don’t Care Content Allow the originator to include their own information –MyRef’s do not need to be understood by this appication –Just copied back in the invoice/statement as YourRef This style, using “any” type –Completely unconstrained –Requires a containing element, called MyRef PO date account entry note MyRef Type=“xsi:any” xlmns:me = “….” Xlmns:you=”…” … … ….

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 30 Don’t Care too much Content Use a new kind of component, – instead of … –This is an Extension point – a place where this languages can be extended with an element from some other language This style, using “any” element –Constrained – what can be provided should be defined in the specified namespace PO date account entry note any xlmns:st = “… standards/ns”” Xlmns:you=”…” … … …. namespace= “…www…/Standards/ns” MyRef

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 31 Any Elements Namespace options, “X” = –“##any” –“##local” this namespace –“##other” anything but this namespace –“ wwx.NS1 …” whitespace-separated list of namespace names, Can include “##targetnamespace Processing options, “Y” = –“skip” – no validation –“strict” – must obtain the namespace schema and validate the conten –“lax” – validate what you can PO any namespace=“X” processContents=“Y” MyRef … <xs:any namespace=“X” processContents=“Y” minOccurs=“0” maxOcurrs =“ubounded”/> … date Schema

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 32 Evolution The loose-coupling principles of web services means that a schema should allow for change which is –Forward compatible – newer versions of documents can be used by old S/W: new producer, old consumer –Backward Compatible – older versions of documents can be used by newer S/W : old producer, new consumer Evolving may be by –New Versions – the original authors enhancing the language –New Extensions – others enhancing the language An Any element (wildcard) is an explicit extension point that allow compatability as the language evolves Typically, for every complex element –Make the last component an Any which occurs 0..* times –For versioning, make it ##local –For extensions, make it ##other

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 33 Obtaining Compatibility lax – gives forward compatiblity –V1 consumer (coded using V1 schema) –can process document produced by V2 producer Optionality on new item gives backward compatibility –V2 consumer –can process document produced by V1 producer If compatibility is not the reality – –use a new namespace name for the new version entryT prodCode quant Note PO date account entry note any entryT prodCode quant Note any urgency Version V1Version V2 lax matches

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 34 Determinism Requirement When “parsing” the instance, The note in instance could correspond to –The note in schema –The any in schema The Schema standard prohibits this non-determinism –Can’t have an Any within Choice or All –Can’t have an Any before or after a variable occurrence component. If disjoint namespaces then not a problem – – –The namespace will indicate whether something matches the Any entryT prodCode quant note any urgency V2 schema lax …... … matches V2 ninstance

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 35 Design for Deterministic Extensibilty I Put variable occurrence structure within a mandatory single-occurrence container PO date account entry note any PO date account entry note any entries entryT prodCode quant note any urgency lax note urgency entryT prodCode quant any lax V2options violation fix violation fix

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 36 Design for Deterministic Extensibilty II Problem with B its any for second extension Solutions (?) –Make at least V2el2 mandatory, losing backward compatibility –  V1 document fails against V2 processor –Remove the extension point, losing forward compatibility  New shema has to be new namespace – V1 processor can’t deal with V2 document Solution -V2# - Nest Extensions – yes, but cumbersome entryT prodCode quant any lax V2options prodCode quant any lax V2options V3el1 V3el2 entryT prodCode quant V2options V3ext entryT V3el1 V3el2 V3options any lax V1 V2 V2# violation

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 37 Any Attributes Same concept as Any elements –procesContents – lax / strict / skip –namespace allowed – ##other etc. Can’t constrain how many Don’t have determinism issues –Because no order or repitition … ”

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 38 Further Aspects Uniqueness and key Constraints Complex Type Derivation Final and Abstract Groups –Attribute –Element

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 39 PRACTICAL Goals –To be able to construct and read an XML Schema –To be able to use the XMLspy tool for that Outline –General Structure –Simple Types –Miscellany –Extensibility –Concluding Remarks –Practical

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 40 Practical Use XMLSPY to construct a schema for an invoice/statement document Similar to a PO document,  Entry has Unit price Cost Optional VAT rate and amount PO number  Additionally a list of POs covered by the Invoice, each having the following information taken from the PO PO date PO notes A PO number (allocated by us)  Includes Extension points – do on text representation  Construct an XML document with that as its schema

Enabling Grids for E-sciencE Richard Hopkins Web Services and WSRF, 24/25 Feb 2005, NeSc -- Schemas 41 The End THE END