DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of.

Slides:



Advertisements
Similar presentations
XML Schema Heewon Lee. Contents 1. Introduction 2. Concepts 3. Example 4. Conclusion.
Advertisements

1 Web Data Management XML Schema. 2 In this lecture XML Schemas Elements v. Types Regular expressions Expressive power Resources W3C Draft:
 Fundamentals of Web Design.  Describe the history and theory of XHTML  Understand the rules for creating valid XHTML documents  Apply a DTD to an.
1 XML DTD & XML Schema Monica Farrow G30
Tutorial 9 Working with XHTML
1 XML Schema – Part 2 More on Schema Types & Derivation Abstact types & type substitution Uniqueness & Keys Additional schema mechanisms - include & import.
An Introduction to XML Schema CSCI 7818 by Ming Rutar.
1 CA201 Word Application XML Week # 10 By Tariq Ibn Aziz Dammam Community college.
XML e X tensible M arkup L anguage 1/23.
XML Schemas Lecture 10, 07/10/02. Acknowledgements A great portion of this presentation has been borrowed from Roger Costello’s excellent presentation.
Grid Computing, B. Wilkinson, 20043a.1 WEB SERVICES Introduction.
Tutorial 9 Working with XHTML. XP Objectives Describe the history and theory of XHTML Understand the rules for creating valid XHTML documents Apply a.
XML Schemas and Namespaces Lecture 11, 07/10/02. BookStore.dtd.
Creating a Well-Formed Valid Document. 2 Objectives Introducing XHTML Creating a Well-Formed Document Creating a Valid Document Creating an XHTML Document.
ΑΝΑΠΑΡΑΣΤΑΣΗ ΓΝΩΣΗΣ ΣΤΟΝ ΠΑΓΚΟΣΜΙΟ ΙΣΤΟ XML Schema
SLIDE 1IS 202 – FALL 2003 Prof. Ray Larson & Prof. Marc Davis UC Berkeley SIMS Tuesday and Thursday 10:30 am - 12:00 pm Fall 2003
DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 5 – XML Basic School of Architecture, Design Science and Planning Faculty of.
Copyright (c) [2001]. Roger L. Costello. All Rights Reserved. 1 … more on XML Schemas Roger L. Costello XML Technologies Course.
XML Schema Basics SD2520 Databases using XML and Jquery Chapter 12
Unit 4 – XML Schema XML - Level I Basic.
Introduction to XML This material is based heavily on the tutorial by the same name at
Introduction to XML: Part I By Sandeep Jangity CS 157B, Section 2 Dr. Lee.
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.
Working with XHTML Creating a Well-Formed Valid Document.
XP Tutorial 9New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with XHTML Creating a Well-Formed Valid Document Tutorial 9.
XP The University of Akron Summit College Business Technology Department Computer Information Systems 2440: 140 Internet Tools Instructor: Enoch E. Damson.
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 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:

Copyright © [2001]. Roger L. Costello. All Rights Reserved. 1 XML Schemas (Primer)
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Schemas Ellen Pearlman Eileen Mullin Programming the Web Using XML.
ITR3 lecture 3: Namespaces, XML Schema & XSL Thomas Krichel
Schemas1 XML Schema More Powerful. Schemas 2 DTD – Schema - Relax An XML schema is a description of a type of XML document, typically expressed in terms.
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.
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.
Ceng 520 XML Schemas IntroductionXML Schemas 2 Part 0: Introduction Why XML Schema?
Session IV Chapter 9 – XML Schemas
Default Namespace - targetNamespace or XMLSchema? XML Schemas: Best Practices A set of guidelines for designing XML Schemas Created by discussions on xml-dev.
XP Tutorial 9 1 Working with XHTML. XP SGML 2 Standard Generalized Markup Language (SGML) A standard for specifying markup languages. Large, complex standard.
XML – An Introduction Structured Data Mark-up James McCartney CSCE 590, Cluster and Grid Computing.
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 –
XML Schema Chao-Hsien Chu, Ph.D. School of Information Sciences and Technology The Pennsylvania State University ElementType AttributeType XML Declar.
New Perspectives on XML, 2nd Edition
An OO schema language for XML SOX W3C Note 30 July 1999.
XML : a brief introduction Managing networks : understanding new technologies, Birmingham, 13 September 2001 Pete Johnston UKOLN, University of Bath Bath,
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.
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
1 Tutorial 12 Working with Namespaces Combining XML Vocabularies in a Compound Document.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2.
CIS 375—Web App Dev II XSD. 2 XSD IntroductionIntroduction XSD stands for XML __________ Definition, which is the XML-based alternative to ______. An.
XML Schema (W3C) Thanks to Jussi Pohjolainen TAMK University of Applied Sciences.
Web Technologies Lecture 4 XML and XHTML. XML Extensible Markup Language Set of rules for encoding a document in a format readable – By humans, and –
XP Tutorial 9New Perspectives on HTML and XHTML, Comprehensive 1 Working with XHTML Creating a Well-Formed Valid Document Tutorial 9.
Tutorial 2: XML Working with Namespaces. 2 Name Collision This figure shows two documents each with a Name element.
XML Validation II Advanced DTDs + Schemas Robin Burke ECT 360.
Tutorial 9 Working with XHTML. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Describe the history and theory of XHTML.
C Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Introduction to XML Standards.
Web Services. XML Namespaces, Schemas XML processing. Week 2.
Tutorial 9 Working with XHTML. XP Objectives Describe the history and theory of XHTML Understand the rules for creating valid XHTML documents Apply a.
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.
XML SCHEMA 1 CH 20. Objective 2 What’s wrong with DTDs? What is a schema? The W3C XML Schema Language Hello schemas Complex types Simple types Deriving.
4 Copyright © 2004, Oracle. All rights reserved. Validating XML by Using XML Schema.
XML Schemas Dr. Awad Khalil Computer Science Department AUC.
XML QUESTIONS AND ANSWERS
Eugenia Fernandez IUPUI
Quiz Points 2 Rules Raise your hand if you know the question
Presentation transcript:

DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of Architecture Wei Peng  What is XML Schema ?  XML Schema is an XML based description of your data’s business rules – alternative to DTD;  An XML schema expresses the structure of an XML document as DTD does;  The XML Schema language is also referred to as XML Schema Definition (XSD);  What XML Schema can while DTD can’t – complex datatype of elements or attributes – think about how to describe an attribute which is an integer ranges from 1 to 100?

DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of Architecture Wei Peng  Validate your XML documents I:

DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of Architecture Wei Peng  Validate your XML documents II:  Online Validate (This version is for schema documents with the namespace URI at  Topologi at  DTD to Schema Converter at:  LuMriX dtd2xs  Syntext Dtd2Xs  GUI Oriented:  XML Spy –  Turbo XML–

DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of Architecture Wei Peng  Why DTD is out?  You have to learn different syntax – a syntax different and inconsistent with XML files you are working on;  Limited datatype capability – DTDs support a very limited capability for specifying datatypes. For example, you can not express "I want the element to hold an integer with a range of 1 to 100“;  DTD supports 10 datatypes;  XML Schema supports 44+ datatypes.

DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of Architecture Wei Peng  Why Schema I?  XML Schema has Support for Data Types – it is easier to describe permissible document content and validate the correctness of data, etc.  XML Schemas use XML Syntax – You don't have to learn another language – you can use your XML editor and parser;  XML Schemas Secure Data Communication – with XML Schemas, the sender can describe the data in a way that the receiver will understand – a “Key”;  XML Schemas are Extensible – just like XML, because they are written in XML – reuse your Schema in other Schemas, create your own data types, etc.

DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of Architecture Wei Peng  Why Schema II?  Well-Formed is not Enough – a well-formed XML document is a document that conforms to the XML syntax rules;  Even if documents are Well-Formed can have serious consequences because the XML file may violate business rules;  Such as: you order 5 gross of laser printers, and you make a mistake in your XML file – 5 laser printers. With XML Schemas, most of these errors can be caught by your validating software.

DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of Architecture Wei Peng  Why Schema III – Namespace:  The main reason for using a schema instead of a DTD is the ability to mix namespaces;  An XML namespace is a collection of names, identified by a URI reference [RFC2396], which are used in XML documents as element types and attribute names;  XML document may contain elements and attributes that are defined for and used by multiple software modules – However, such XML files contain multiple markup vocabularies which can pose problems of recognition and collision;  These require components have universal names – XML namespace is the mechanism to solve this problem.

DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of Architecture Wei Peng  Compare Schema with the Related XML <shiporder orderid="889923" xmlns:xsi=" xsi:noNamespaceSchemaLocation="example.xsd"> John Smith Ola Nordmann Langgt Stavanger Norway Empire Burlesque Special Edition

DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of Architecture Wei Peng  Compare DTD with the Related Schema

DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of Architecture Wei Peng  DTD:

DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of Architecture Wei Peng  Schema:

DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of Architecture Wei Peng  Schema Tips: For Tag <xsd:schema xmlns:xsd=" targetNamespace=" xmlns=" elementFormDefault="qualified">  All Schema has “schema” as root element. And xmlns:xsd = " indicates that all XML-Schema elements are to be prefixed with an xsd: tag;  Target nameplace can act as an identification in the data streams when more than one schemas are involved in – it is optional;  The elements and datatypes that are used to construct schemas – schema, element, complexType, sequence, string, etc. are come from the namespace;  The default namespace is which is the targetNamespace;  elementFormDefault="qualified“ – This is a directive to any instance documents which conform to this schema: Any elements used by the instance document which were declared in this schema must be namespaced – for example Boeing 747.

DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of Architecture Wei Peng  Referencing Schema in XML instance document I: <BookStore xmlns =" xmlns:xsi=" xsi:schemaLocation=" BookStore.xsd"> My Life and Times Paul McCartney July, McMillin Publishing...  The line xmlns:xsi = " indicates that we want to use elements defined in the definition;

DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of Architecture Wei Peng  Referencing Schema in XML instance document II:  First, using a default namespace declaration, tell the schema-validator that all of the elements used in this instance document come from the namespace.  Second, with schemaLocation tell the schema-validator that the namespace is defined by BookStore.xsd, Note: The xsi:schemaLocation and xsi:noNamespaceSchemaLocation attributes can be used in a document to provide hints as to the physical location of schema documents which may be used for assessment.  Third, tell the schema-validator that the schemaLocation attribute we are using is the one in the XMLSchema-instance namespace.

DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of Architecture Wei Peng  No targetNamespace (noNamespaceSchemaLocation  Sometimes you may wish to create a schema but without associating the elements with a namespace;  The targetNamespace attribute is actually an optional attribute of. Thus, if you don’t want to specify a namespace for your schema then simply don’t use the targetNamespace attribute;  Note that there is no default namespace declaration. So, none of the elements are associated with a namespace;  Note that we do not use xsi:schemaLocation (since it requires a pair of values - a namespace and a URL to the schema for that namespace). Instead, use xsi:noNamespaceSchemaLocation  For Example, in XML instance file: <shiporder orderid="889923" xmlns:xsi=" xsi:noNamespaceSchemaLocation="example.xsd">

DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of Architecture Wei Peng  Assembling an Instance Document from More than one schema An instance document may be composed of elements from multiple schemas. <Library xmlns:xsi=" xsi:schemaLocation= " Book.xsd Employee.xsd"> My Life and Times Paul McCartney Macmillan Publishing John Doe

DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of Architecture Wei Peng  Include method: <xsd:schema xmlns:xsd=" targetNamespace=" xmlns=" elementFormDefault="qualified">

DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of Architecture Wei Peng  Building a Schema from Multiple Schema Documents with Different Namespaces – use import method <xsd:schema xmlns:xsd=" targetNamespace=" xmlns:nikon=" xmlns:olympus=" xmlns:pentax=" elementFormDefault="qualified"> <xsd:import namespace=" schemaLocation="Nikon.xsd"/> <xsd:import namespace=" schemaLocation="Olympus.xsd"/> <xsd:import namespace=" schemaLocation="Pentax.xsd"/>

DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 6 – XML Schema School of Architecture, Design Science and Planning Faculty of Architecture Wei Peng  References:      Roger L. Costello, XML Technologies Course at