petros kavassalis
DESCRIPTION
Enterprise IT [Πληροφοριακές Τεχνολογίες της Επιχείρησης] Lecture 6-9: XSD Overview Univ. of the Aegean Financial and Management Engineering Dpt. Petros KAVASSALIS. What you will learn in this course. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/1.jpg)
1
Enterprise IT[Πληροφοριακές Τεχνολογίες της Επιχείρησης]
Lecture 6-9: XSD Overview
Univ. of the Aegean Financial and Management Engineering Dpt
Petros KAVASSALIS<[email protected]>
![Page 2: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/2.jpg)
What you will learn in this course
A set of fundamental concepts for understanding basic Enterprise Information Technologies Enterprise Software Applications Enterprise Architecture Integration (EAI)
Best practices and techniques for building and migrating to a service-oriented enterprise
Strategies for integrating applications using standard technologies XML Web Services
Familiarization with concepts such as: Interoperability e-business e-government 2.0
![Page 4: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/4.jpg)
Students evaluation
Class Participation (20%)
+ Assignments (20%)
+ Final Exam (650%)
![Page 5: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/5.jpg)
First go to http://www.w3schools.com/Schema/default.asp
![Page 6: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/6.jpg)
XSD in a nutshell
XML: XML Schema Definition Language XML Working Group at W3C (please visit!)
Used for the definition of XML tags and structure … the content and the structure of a class of XML documents
Schemas provide capabilities for expressing XML documents (the “logical structure” of the XML document Support for metadata characteristics
o Relationshipso Cardinalityo Valid Valueso Data Types
XML documents without a referenced schema cannot be “validated” If validated, the XML document has a valid construction… Note: “Simple”, “short” XML documents do not necessarily require the use of an XSD
scheme
![Page 7: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/7.jpg)
XSD: components
Schema components = building blocks Elements declarations Attribute declarations Simple Type definitions Complex Type definitions Notifications etc…
![Page 8: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/8.jpg)
XSD: architecture (1)
<?xml version=“1.0” encoding=“UTF-8”?><xsd:schema>
NAMESPACE
BODY</xsd/schema>
Root element
![Page 10: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/10.jpg)
XSD: Global and Local Elements
Global Elements: Available to be used in the rest of the schema They are declared at the top level of the schema (BODY)
o This declaration determines how the element will look like They are “referenced” each time we want to use somewhere in the
schema Local Elements: Elements “on the spot”
They may not be used elsewhere in the schema Their names are “locally” unique, i.e. unique only in the context in
which they appear
<[email protected]> 10
![Page 11: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/11.jpg)
XSD: Simple Types
Elements with a built-in Type <xsd:element name=“label”
type=“xsd:datatype”/> xml
<label>data</label>
<xsd:element name=“weight” type=“xsd:string”/>
xml <weight>200 kg</weight>
Custom Simple Types <xsd:simpleType
name=“kapaType”><xsd:restriction
base=“xsd:datatype”><xsd:pattern value=“pattern”/></xsd:restriction>
</xsd:simpleType> xml
<kapa>data</kapa>
<[email protected]> 11
![Page 12: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/12.jpg)
XSD: Simple TypesExample
<xsd:element name="car" type="carType"/>
<xsd:simpleType name="carType"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="Audi"/> <xsd:enumeration value="Golf"/> <xsd:enumeration value="BMW"/> </xsd:restriction></xsd:simpleType>
<[email protected]> 12
![Page 13: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/13.jpg)
XSD: built-in DataTypes and limitations for Simple Types
Data and Time Types (built-in) Number Types (built-in) Other built-in Types
Locate them
Acceptable Values foe simple Types Patterns for simple Types Range of Acceptable Values for simple Types Length Limits for simple Types Number’s Digits Length for simple Types
List Types Element’s Content: pre-definition
<[email protected]> 13
![Page 14: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/14.jpg)
XSD: Restrictions/Facets for Datatypes
http://www.w3schools.com/Schema/schema_elements_ref.asp Restrictions/Facets for Datatypes
<[email protected]> 14
![Page 15: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/15.jpg)
XSD: Complex Types
<[email protected]> 15
Complex Types
<xsd:complexType name=“kapaType”><xsd:sequence><xsd:element name=“lamda”
type=”lamdaType”/></xsd:sequence>
</xsd:complexType
Simple Types
<xsd:simpleType name=“kapaType”><xsd:restriction
base=“xsd:datatype”><xsd:pattern value=“pattern”/></xsd:restriction>
</xsd:simpleType> xml
<kapa>data</kapa>
![Page 16: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/16.jpg)
XSD: Complex TypesExplicitly naming the xml element (restricted)
xml<employee>
<firstname>John</firstname> <lastname>Smith</lastname>
</employee> xsd
<xsd:element name="employee"> <xsd:complexType> <xsd:sequence> <xsd:element name="firstname" type="xsd:string"/> <xsd:element name="lastname" type="xsd:string"/> </xsd:sequence> </xsd:complexType>
</xsd:element><[email protected]> 16
![Page 17: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/17.jpg)
XSD: Complex TypesSeveral elements can refer to a complex type
xml<employee>
<firstname>John</firstname> <lastname>Smith</lastname>
</employee> xsd
<xsd:element name="employee" type="personinfo"/><xsd:complexType name="personinfo"> <xs:dsequence> <xsd:element name="firstname" type="xsd:string"/> <xsd:element name="lastname" type="xsd:string"/> </xsd:sequence></xsd:complexType>
<[email protected]> 17
![Page 18: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/18.jpg)
XSD: Complex TypesExtend a complex element
<[email protected]> 18
<xsd:element name="employee" type="fullpersoninfo"/>
<xsd:complexType name="personinfo"> <xsd:sequence> <xsd:element name="firstname" type="xsd:string"/> <xsd:element name="lastname" type="xsd:string"/> </xsd:sequence></xsd:complexType>
<xsd:complexType name="fullpersoninfo"> <xsd:copmlexContent> <xsd:extension base="personinfo"> <xsd:sequence> <xsd:element name="address" type="xsd:string"/> <xsd:element name="city" type="xsd:string"/> <xsd:element name="country" type="xsd:string"/> </xsd:sequence> </xsd:extension> </xsd:complexContent></xsd:complexType>
![Page 19: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/19.jpg)
XSD: Complex TypesXSD Elements
http://www.w3schools.com/Schema/schema_elements_ref.asp XSD Elements
<[email protected]> 19
![Page 20: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/20.jpg)
Set of choices Elements appearing with no order Max-Min Occurs Groups of elements
Referencing a named group How many elements?
XSD Attributes xml
o <lastname lang="EN">Smith</lastname> xsd
o <xsd:attribute name="lang" type="xsd:string"/>
XSD: Complex TypesChoice, Order and Groups
<[email protected]> 20
![Page 21: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/21.jpg)
XSD: Complex TypesEmpty Elements
Empty Elements xml
o <product prodid="1345" /> xsd
o <xsd:element name="product"> <xsd:complexType> <xsd:attribute name="prodid" type="xsd:positiveInteger"/> </xsd:complexType></xsd:element>
xsd (2)o <xsd:element name="product" type="prodtype"/>4
<xsd:complexType name="prodtype"> <xsd:attribute name="prodid" type="xsd:positiveInteger"/></xsd:complexType>
<[email protected]> 21
![Page 22: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/22.jpg)
XSD: Complex TypesElements with Mixed Content
Text-Only Elements (text, attributes)
<xsd:element name="somename"> <xsd:complexType <xsd:simpleContent> <xsd:extension base="basetype"> .... .... </xsd:extension> </xsd:simpleContent> </xsd:complexType></xsd:element>
Mixed Elements xml
<letter> Dear Mr.<name>John Smith</name>. Your order <orderid>1032</orderid> will be shipped on <shipdate>2001-07-13</shipdate>.</letter>
xsd <xsd:element name="letter" type="lettertype"/>
<xsd:complexType name="lettertype" mixed="true"> <xsd:sequence> <xsd:element name="name" type="xsd:string"/> <xsd:element name="orderid" type="xsd:positiveInteger"/> <xsd:element name="shipdate" type="xsd:date"/> </xsd:sequence></xsd:complexType><[email protected]> 22
![Page 24: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/24.jpg)
XSD: Simple & Complex Types
All in One http://www.codeguru.com/java/article.php/c13529 (*) http://www.learn-xml-schema-tutorial.com/
<[email protected]> 24
![Page 25: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/25.jpg)
XSD: Complex TypesExamples
http://www.w3schools.com/Schema/schema_example.asp http://www2.it.lut.fi/kurssit/08-09/CT30A2900/Lectures/Exam
ples/An XML schema example.pdf
<[email protected]> 25
![Page 26: Petros KAVASSALIS](https://reader035.vdocuments.mx/reader035/viewer/2022081511/56816075550346895dcf9f15/html5/thumbnails/26.jpg)
[References]
E. Castro, 2001, XML for the World Wide Web, Peachpit Press Chapters 5, 6, 7, 8, 9
J. Bean, 2003, XML for Data Architects, Morgan Kaufmann Pub. Chapter 4
<[email protected]> 26