ITEC 4020A:Internet Client Server Systems Professor: Marin Litoiu Lecture 9&10 Web Service-XML © Marin Litoiu, York University, Canada.

Slides:



Advertisements
Similar presentations
XML-XSL Introduction SHIJU RAJAN SHIJU RAJAN Outline Brief Overview Brief Overview What is XML? What is XML? Well Formed XML Well Formed XML Tag Name.
Advertisements

What is XML? a meta language that allows you to create and format your own document markups a method for putting structured data into a text file; these.
XML: Extensible Markup Language
1 Web Data Management XML Schema. 2 In this lecture XML Schemas Elements v. Types Regular expressions Expressive power Resources W3C Draft:
An Introduction to XML Based on the W3C XML Recommendations.
1 XML DTD & XML Schema Monica Farrow G30
CS 898N – Advanced World Wide Web Technologies Lecture 21: XML Chin-Chih Chang
XML Simple Types CSPP51038 shortcourse. Simple Types Recall that simple types are composed of text-only values. All attributes are of simple type Elements.
XML Schemas and Namespaces Lecture 11, 07/10/02. BookStore.dtd.
Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti.
XML(EXtensible Markup Language). XML XML stands for EXtensible Markup Language. XML is a markup language much like HTML. XML was designed to describe.
Document Type Definitions. XML and DTDs A DTD (Document Type Definition) describes the structure of one or more XML documents. Specifically, a DTD describes:
Introducing XHTML: Module B: HTML to XHTML. Goals Understand how XHTML evolved as a language for Web delivery Understand the importance of DTDs Understand.
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.
ECA 228 Internet/Intranet Design I Intro to XML. ECA 228 Internet/Intranet Design I HTML markup language very loose standards browsers adjust for non-standard.
XP New Perspectives on XML Tutorial 4 1 XML Schema Tutorial – Carey ISBN Working with Namespaces and Schemas.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation Document Type Definition.
XML Anisha K J Jerrin Thomas. Outline  Introduction  Structure of an XML Page  Well-formed & Valid XML Documents  DTD – Elements, Attributes, Entities.
Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.
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.
XML Open Computing Institute, Inc. 1 eXtensible Markup Language (XML)
1 XML Schemas. 2 Useful Links Schema tutorial links:
Dr. Azeddine Chikh IS446: Internet Software Development.
Neminath Simmachandran
XML CPSC 315 – Programming Studio Fall 2008 Project 3, Lecture 1.
XP 1 CREATING AN XML DOCUMENT. XP 2 INTRODUCING XML XML stands for Extensible Markup Language. A markup language specifies the structure and content of.
Document Type Definitions Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
MIS 315 Bsharah An Introduction to XML 1MIS Bsharah.
XML What is XML? XML v.s. HTML XML Components Well-formed and Valid Document Type Definition (DTD) Extensible Style Language (XSL) SAX and DOM.
1 © Netskills Quality Internet Training, University of Newcastle Introducing XML © Netskills, Quality Internet Training University.
Introduction to XML. What is XML? Extensible Markup Language XML Easier-to-use subset of SGML (Standard Generalized Markup Language) XML is a.
XML 1 Enterprise Applications CE00465-M XML. 2 Enterprise Applications CE00465-M XML Overview Extensible Mark-up Language (XML) is a meta-language that.
XP 1 DECLARING A DTD A DTD can be used to: –Ensure all required elements are present in the document –Prevent undefined elements from being used –Enforce.
What is XML?  XML stands for EXtensible Markup Language  XML is a markup language much like HTML  XML was designed to carry data, not to display data.
Processing of structured documents Spring 2002, Part 2 Helena Ahonen-Myka.
1 Tutorial 13 Validating Documents with DTDs Working with Document Type Definitions.
Avoid using attributes? Some of the problems using attributes: Attributes cannot contain multiple values (child elements can) Attributes are not easily.
XML A web enabled data description language 4/22/2001 By Mark Lawson & Edward Ryan L’Herault.
Of 33 lecture 3: xml and xml schema. of 33 XML, RDF, RDF Schema overview XML – simple introduction and XML Schema RDF – basics, language RDF Schema –
New Perspectives on XML, 2nd Edition
XML Documents Chao-Hsien Chu, Ph.D. School of Information Sciences and Technology The Pennsylvania State University Elements Attributes Comments PI Document.
Introduction to XML This presentation covers introductory features of XML. What XML is and what it is not? What does it do? Put different related technologies.
XML Instructor: Charles Moen CSCI/CINF XML  Extensible Markup Language  A set of rules that allow you to create your own markup language  Designed.
Lecture 16 Introduction to XML Boriana Koleva Room: C54
1 Introduction to XML XML stands for Extensible Markup Language. Because it is extensible, XML has been used to create a wide variety of different markup.
An Introduction to XML Sandeep Bhattaram
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Understanding How XML Works Ellen Pearlman Eileen Mullin Programming the.
XML Introduction. What is XML? XML stands for eXtensible Markup Language XML stands for eXtensible Markup Language XML is a markup language much like.
The eXtensible Markup Language (XML). Presentation Outline Part 1: The basics of creating an XML document Part 2: Developing constraints for a well formed.
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
INFSY 547: WEB-Based Technologies Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
1 herbert van de sompel CS 502 Computing Methods for Digital Libraries Cornell University – Computer Science Herbert Van de Sompel
XSD: XML Schema Language Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
XML CSC1310 Fall HTML (TIM BERNERS-LEE) HyperText Markup Language  HTML (HyperText Markup Language): December  Markup  Markup is a symbol.
Document Type Definition (DTD) Eugenia Fernandez IUPUI.
Lecture 0 W3C XML Schema. Topics Status Motivation Simple type vs. complex type.
C Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Introduction to XML Standards.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
Extensible Markup Language (XML) Pat Morin COMP 2405.
XML: Extensible Markup Language
Unit 4 Representing Web Data: XML
XML QUESTIONS AND ANSWERS
Chapter 7 Representing Web Data: XML
ece 720 intelligent web: ontology and beyond
New Perspectives on XML
Presentation transcript:

ITEC 4020A:Internet Client Server Systems Professor: Marin Litoiu Lecture 9&10 Web Service-XML © Marin Litoiu, York University, Canada

Web Services-Content  Introduction to XML  DTDs and XML Schema  Web Services, SOAP, WSDL, VoiceXML 2

Unit 1. Introduction to XML  Learning Objectives  Understand how XML is different from HTML  Understand the basic things that make up XML 3

What is XML?  XML - EXtensible Markup Language  It is a meta-markup language  Let’s create our own tags  Ex: John  It is a standard for data structuring and interchange  It is surrounded by TLAs: XSL, DTD, SAX, DOM… and FRLAs: XSLT, VXML, SOAP…  Descends from SGML 4

5 XML is a Meta-Language (from w3c site)

6 XML is about Structured Data  Unstructured data-natural language description: ”A company has a personnel and the personnel has one or more persons. Persons have name, address, etc…”  Structured data: a tree personnel person name title givenfamily address street Mr. John Higgins zip M3C1H7 person Wall St. company

7 Why not HTML?  HTML tags are concerned with rendering  XML is concerned with the semantic of information  XML is a meta-language, HTML can be seen as an instance of it (XHTML)  HTML is one of the presentation formats for XML languages

8 Simple HTML document(1 of 2) Helm Brown Moon Light Toronto

9 Simple HTML document (2 of 2)  An HTML browser knows how to render  A human can understand each line, can a computer or application?  How easy is to search for a piece of data?

10 Simple XML (PML?) Mr. Helm Brown Moon Light M3C1H7

11 Tags, Elements, CDATA Mr. Helm Brown Moon Light M3C1H7 Start tag Element End tag CDATA Markup

12 XML Document as a Tree person name titlefamilygiven address street Mr.HelmBrown zip M3C1H7 Moon Light parent children CDATA

13 XML Attributes  Attributes are properties of the element  Pairs of (name, value), within the element  Values are between quotation marks …. Attributes

14 Well Formed Documents  An XML document is well formed if obeys a set of rules 1.Tags cannot be inferred; they must be explicit. All starting tags must have corresponding ending tags. All ending tags must have corresponding starting tags 2.Empty tags need a Slash ( /) before the closing Greater Than (>) character: 3.All attribute values must be enclosed in either single or double quotation marks 4.Tags must nest correctly: 5.Tags are case sensitive and must match each other in every implementation

15 Namespaces in XML  Distinguish between elements and attributes from different XMLs  Qualified name = prefix:local  Prefix is the Namespace  Local identifies the particular element 1.xmlns:cmp= xmlns:lb= 2. Ms … As You Like It Qualified name

16 More in XML Documents  Empty elements: no children  Comments  Processing Instructions  Entities  Further readings 

17 XML for Presentation XML doc Presen- tation Voice XML WML HTML, PDF,PS

18 XML for Communication Appli- cation A Appli- cation A Appli- cation 1 Appli- cation 1 Appli- cation B Appli- cation B Appli- cation 2 Appli- cation 2 Transfor- mation 1 Transfor- mation 1 Transfor- mation 2 Transfor- mation 2 XML 1 XML 2 XML

19 XML for Web Services APP A APIAPI APP B APIAPI XML getAPI() XML RPC (SOAP)

20 Summary  We learned:  XML is a vehicle for representing structured data  XML allows you to create your own language (data format)  An XML document contains start tags, end tags, elements and attributes, CDATA  Elements: parent, children, root element, document element

21 Exercise (10 min.)  Write an XML document for the course you are attending:  title: XML and Related Technologies  description: basics of XML and related technologies  instructor  Name: Marin Litoiu  Affiliation: CAS  Participants  Participant:  name: John Trevis  job: software programmer  Participant  Name: Big Boss  Job: manager  …..…….  View the document with IExplorer

22 Quiz(1)  Which statement(s) is(are) false?: 1.XML makes data interchange easy 2.XML is a standard 3.XML is a meta-language 4.An well-formed XML document has nested tags and is a tree 5.An empty element has no attributes  True or false? 1.XML is a protocol, like HTTP, IIOP and RMI 2.You can have rendering tags in XML documents 3.Attributes for Elements are like parts to whole 4.XML isolates the presentation from content

23 Quiz(2)  XML is not a language and has not recognized tags. Rather, it is a meta- language that allows you to define your own language 1.True 2. False  Which of the following is not a rule for creating well-formed documents in XML? 1.All start tags must have corresponding ending tags 2.Empty tags need a Slash (/) before the closing Greater Than (>) character. 3.All attribute values must be enclosed in brackets 4.Tags must nest correctly 5.Tags are case sensitive and must match each other in every implementation.

24 Unit 2. DTDs  Learning Objectives  What is DTD  Why we need DTD  How to write a DTD

25 Document Type Definition(DTD)  DTD defines the grammar for XML docs  Tag names  How elements can be nested  If the elements may, must appear  How often the elements appear  Attributes of the elements  Default values for the attributes  All valid values for the attributes

26 Valid documents  The XML document contains information about its dtd  Exemple:  A valid XML document follows the syntax defined in its dtd  An XML parser will check the validity of the XML document against its dtd  Any XML editor has an XML parser  Eclipse has an XML Editor

27 XML Documents and DTD author.dtd author1.xmlauthor3.xml author2.xml author.class One editor One parser Many XMLs …….. One DTD

28 Simple person.dtd

29 Element definition ……. Element name Children Element declaration Element Type

30 Attributes in DTD DTD XML El. name Attr. name Attr type Default value

31 Empty Elements  No children, no start or end tag DTD XML

32 Attributes Types  CDATA “Eglinton East”  NMTOKEN (name token):  ID: unique Id within a document  IDREF: a reference to an ID  IDREFS: many IDREF  ENUMERATION: (a|b|c|d)  ENTITY: reference to an external unparsed entity  ENTITIES: many ENTITY

33 ID and IDREF  DTD:  XML:

34 Default values for attributes  #REQUIRED - a value MUST be provided  #IMPLIED – optional value  [#FIXED] “value”, if no value is provided, the “value” should be used

35 Child Element Occurrences  “A man has zero or one wives, zero or more children and speaks one or more languages”   ? zero or one times  * zero or more times  + one or more times , sequence  | or- choice

36 Summary of Unit 2  We learned:  DTD is the grammar for XML documents  DTD defines: elements (parents and children), attributes, default and allowed values  DTDs are agreed upon by a community  Valid XML documents obey the structure of DTD

37 Exercise 1  Write an XML Document for person.dtd from slide 28  Validate the document with Internet Explorer  make sure you specify the SYSTEM dtd  You can use an XML Editor  For example, Eclipse has editors for XML, DTD and XML Schema.

38 Quiz  Which statement(s) is(are) false 1.DTD is a grammar for XML documents 2.IDREF is an attribute type and it means a reference to an attribute called “ID” 3. defines an element x with zero or more children elements y 4. defines an attribute z for the element y. z can have 1 or 2 characteristics, preferably is a valid comment 6. defines an empty element bag

39 Unit 3. XML Schema  Learning Objectives  Why we need XML Schema  How to write an XML Schema  When to use XML Schema

40 XML Schema  DTD has few predefined types  DTD syntax is different from XML syntax  DTD cannot express certain constraints: “c occurs 3 to 5 times”  XML Schema to the rescue  Describes and constrains the content of XML  Defines simple data types and ways to derive new simple or complex types  Link:  Namespace: xmlns:xsd='

XML Schema structure  Schema element: the top level element ( as per XML definition)  Element—defines the elements that will show up in your XML doc  Simple type elements: simple elements derived from predefined elements in XML schema  Complex type elements: complex data types ( sequence, union..) Example ………………….. © Marin Litoiu, York University, Canada

42 XML Schema uses XML Syntax DTD XML Schema XML attributes ??? XML Elements

43 All Built in Types

Simple types(1) Simple TypeExamples (delimited by commas)Notes stringThis is a string normalizedStringThis is a stringNL and CR are converted to spaces tokenThis is a stringTrailing and leading spaces are removed integer...-1, 0, 1,... integer is ·derived· from decimal by fixing the value of ·fractionDigits· to be 0and disallowing the trailing decimal point. ·derived·decimal·fractionDigits· positiveInteger1, 2,... negativeInteger... -2, -1 nonNegativeInteger0, 1, 2,... nonPositiveInteger... -2, -1, 0 long ,... -1, 0, 1, unsignedLong0, 1, int ,... -1, 0, 1, int is ·derived· from long by setting the value of ·maxInclusive· to be and ·minInclusive· to be ·derived·long·maxInclusive· minInclusive· unsignedInt0, 1, short-32768,... -1, 0, 1, unsignedShort0, 1, byte-128,...-1, 0, 1, unsignedByte0, 1,

Simple types(2) decimal-1.23, 0, 123.4, float -INF, -1E4, -0, 0, 12.78E-2, 12, INF, NaN equivalent to single-precision 32-bit floating point, NaN is "not a number", INF-inifinite double -INF, -1E4, -0, 0, 12.78E-2, 12, INF, NaN equivalent to double-precision 64-bit floating point booleantrue, false, 1, 0 durationP1Y2M3DT10H30M12.3S 1 year, 2 months, 3 days, 10 hours, 30 minutes, and 12.3 seconds dateTime T13:20: :00 May 31st 1999 at 1.20pm Eastern Standard Time which is 5 hours behind Co-Ordinated Universal Time date time13:20:00.000, 13:20: :00 gYear , g stands for Gregorian calendar gYearMonth the month of February 1999, regardless of the number of days, gMonth--05May, regardless of year, day gMonthDay every May 31st gDay---31the 31st day

Examples  XML Schema  XML Document John © Marin Litoiu, York University, Canada

Questions  How do I specify this structure of the XML elements? John Smith  See next slide… © Marin Litoiu, York University, Canada

48 Complex Types in XML Schema: Sequence  Create once, use many times as a template  High reusability, easy maintainability 1. Types Elements This how they will look in XML documents John Smith Bill Gates Is like “, “ in dtd

Validating XMLs and XML schemas  Schema, in a file named name.xsd <schema xmlns=" targetNamespace=" xmlns:tns=" elementFormDefault="qualified">  XML file: references the file name.xsd <employeeName xmlns=" xmlns:xsi=" xsi:schemaLocation=" name.xsd "> Bill Gates © Marin Litoiu, York University, Canada

Quiz (10 min) 1. Write a valid xml document for this xml schema <schema xmlns=" targetNamespace=" xmlns:tns=" elementFormDefault="qualified"> 2. Write a simplified version of this XML schema (condense the types) 3. Write an XML document for the new schema © Marin Litoiu, York University, Canada

Complex Types: Choice …..  Only one of those: USAddress or CAAddress will show up in an instance XML document  The address is followed by the items (items type is Items) © Marin Litoiu, York University, Canada

52 Anonymous Types  Anonymous type does not have name, it is a private child of the element it types Anonymous type

53 Attributes  Attributes have name, value, type  They are children of the element ……….

54 Occurrence Constraints  Occurrence Constraints for Children Elements  minOccurs, maxOccurs Ex:  Constraints for Attributes  use, value Ex:

55 Derived Types-Pattern  “Phone number has an optional country code, an area code of tree digits, a hyphen, and 7 digits”  Use pattern

56 Derived Types-Interval  “age is an integer greater that 10, less than 121”

57 Derived Types- Enumeration  Enumerations are simple types

Derived types: Extension

59 DTD or XML Schema  For reach type documents, with many types and constrains, use XML schemas  Use DTD when  Want a compact representation  Not interested in semantic of the grammar, just in structure

60 Summary  We learned:  XML Schema is a replacement for DTD  Has a syntax similar to XML  Allows the user to  Specialize by extension and restriction basic simple types  Define his/her own complex types

Exercise (10 min). 1.For the po.xsd schema from write a sample xml document ( should be different from the one on web site)

62 Quiz  True of false? 1.XML schemas are more compact that DTDs 2.To define complex types, one should use tag 3.Declaration is incorrect because is does not specify the name of the element y belongs to 4.“restriction” is a specialization mechanism in XML schema that constrains a “base” type 5.The user can only create complex types but cannot create simple types 6.“enumeration” is a simple type