XML DTDs and Schemas How we define our markup language.

Slides:



Advertisements
Similar presentations
CSCI N241: Fundamentals of Web Design Copyright ©2004 Department of Computer & Information Science Introducing XHTML: Module B: HTML to XHTML.
Advertisements

DOCUMENT TYPES. Digital Documents Converting documents to an electronic format will preserve those documents, but how would such a process be organized?
XHTML Week Two Web Design. 2 What is XHTML? XHTML is the current standard for HTML Newest generation of HTML (post-HTML 4) but has many new features which.
The eXtensible Markup Language (XML) An Applied Tutorial Kevin Thomas.
XML/EDI Overview West Chester Electronic Commerce Resource Center (ECRC)
HTML/XML XHTML Authoring. Creating Tables  Table: An arrangement of horizontal rows and vertical columns. The intersection of a row and a column is called.
1 XML DTD & XML Schema Monica Farrow G30
XHTML 16-Apr-17.
CS 898N – Advanced World Wide Web Technologies Lecture 21: XML Chin-Chih Chang
XHTML1 Building Document Structure. XHTML2 Objectives In this chapter, you will: Learn how to create Extensible Hypertext Markup Language (XHTML) documents.
17-Jun-15 XHTML 2 What is XHTML? XHTML stands for Extensible Hypertext Markup Language XHTML is aimed to replace HTML.
Lecture 14 XML Validation. a simple element containing text attribute; attributes provide additional information about an element and consist of a name.
WML/HTML and XML Multiplatform Applications. Agenda XML – History and purpose What have HTML, WML and XML got to do with each other Why useful for multiplatform.
Advanced Technical Writing 2006 Session #3. Today in Class… ► Teams pitch poster concepts:  Meet with your editorial team, show us how your material.
DT228/3 Web Development Introduction to XML.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic XML.
XML Introduction What is XML –XML is the eXtensible Markup Language –Became a W3C Recommendation in 1998 –Tag-based syntax, like HTML –You get to make.
DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 5 – XML Basic School of Architecture, Design Science and Planning Faculty of.
Upgrading to XHTML DECO 3001 Tutorial 1 – Part 1 Presented by Ji Soo Yoon 19 February 2004 Slides adopted from
1 HTML’s Transition to XHTML. 2 XHTML is the next evolution of HTML Extensible HTML eXtensible based on XML (extensible markup language) XML like HTML.
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
Tutorial 1: Getting Started with HTML5
Pemrograman Berbasis WEB XML part 2 -Aurelio Rahmadian- Sumber: w3cschools.com.
Creating a Basic Web Page
Lecture 15 XML Validation. a simple element containing text attribute; attributes provide additional information about an element and consist of a name.
XHTML The Basics A brief history of HTML SGML (Standard Generalized Markup Language) Then came HTML Followed by the browser…and the great browser wars.
CS134 Web Design & Development Creating a Basic Web Page Mehmud Abliz.
XHTML1 Building Document Structure Chapter 2. XHTML2 Objectives In this chapter, you will: Learn how to create Extensible Hypertext Markup Language (XHTML)
Introduction. Document Structure Overview  XML declaration (prolog)  Document type declaration  Root element (namespace)  Document header  Document.
XHTML. Introduction to XHTML What Is XHTML? – XHTML stands for EXtensible HyperText Markup Language – XHTML is almost identical to HTML 4.01 – XHTML is.
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.
1 XML - Extensible Markup Language. 2 HTML - Hypertext Markup Language n HTML has a fixed tag set. n Use these tags to describe how information is to.
XML A web enabled data description language 4/22/2001 By Mark Lawson & Edward Ryan L’Herault.
XP Tutorial 9 1 Working with XHTML. XP SGML 2 Standard Generalized Markup Language (SGML) A standard for specifying markup languages. Large, complex standard.
New Perspectives on XML, 2nd Edition
 XML DTD and XML Schema Discussion Sessions 1A and 1B Session 2.
Waqas Anwar Next SlidePrevious Slide. Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language.
XML Instructor: Charles Moen CSCI/CINF XML  Extensible Markup Language  A set of rules that allow you to create your own markup language  Designed.
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.
Advanced Technical Writing 2006 Session #4. Today in Class… ► Meet with your editorial team, refine/post deliverables ► Send URL for deliverables to Bill.
EGEE is a project funded by the European Union under contract IST XML Schema 3 – 4 June
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2.
1 herbert van de sompel CS 502 Computing Methods for Digital Libraries Cornell University – Computer Science Herbert Van de Sompel
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 –
Representing data with XML SE-2030 Dr. Mark L. Hornick 1.
XSD: XML Schema Language Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
XP Tutorial 9New Perspectives on HTML and XHTML, Comprehensive 1 Working with XHTML Creating a Well-Formed Valid Document Tutorial 9.
XML Validation II Advanced DTDs + Schemas Robin Burke ECT 360.
XML Validation. a simple element containing text attribute; attributes provide additional information about an element and consist of a name value pair;
 XML derives its strength from a variety of supporting technologies.  Structure and data types: When using XML to exchange data among clients, partners,
Advanced Technical Writing 2006 Session #3. Today in Class… ► Show-n-tell your CSS Objects from exercise 1 ► Meet with your editorial team, refine/post.
Extensible Markup Language (XML) Pat Morin COMP 2405.
XML Schemas Dr. Awad Khalil Computer Science Department AUC.
XML intro. 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.
XML BASICS and more…. What is XML? In common:  XML is a standard, simple, self-describing way of encoding both text and data so that content can be processed.
CIS 228 The Internet 9/20/11 XHTML 1.0.
Yaşar Tonta & Orçun Madran [yasartonta, Hacettepe University
W3C Web standards and Recommendations
XML QUESTIONS AND ANSWERS
Eugenia Fernandez IUPUI
XHTML
Web Programming Maymester 2004
Creating a Basic Web Page
XHTML 7-May-19.
CSE591: Data Mining by H. Liu
XHTML 29-May-19.
Web Design & Development
XML: The new standard -Eric Taylor.
Presentation transcript:

XML DTDs and Schemas How we define our markup language

November 2012Web Programming2 Remember XML? ● XHTML is a DTD of XML – A Document Type Declaration (or Definition) of XML ● This means that XHTML is XML – Similarly, HTML is SGML, which is related ● What is valid XHTML is defined using the DTD ● But the DTD is in effect a language of its own...

November 2012Web Programming3 The DTD defines... ● What elements appear in a document ● What attributes elements can/must have ● What elements can/must appear inside others ● The sequence of elements

November 2012Web Programming4 The DTD is declared ● At the top of any XHTML file, e.g. (etc)

November 2012Web Programming5 Example XML DTD

November 2012Web Programming6 The problem with DTDs ● Not easily manipulated or transformed ● Do not specify or control the type of data Lecture ● Perfectly valid! And there's nothing that can be done in the DTD to prevent it ● There is a solution

November 2012Web Programming7 XML Schemas ● We took a little look in CS15020 ● ● There's a great tutorial at – ● The main advantage of the schema is that you can define data types for elements and attributes ● And a schema is itself XML – No other language to worry about

November 2012Web Programming8 Will schemas replace the DTD? ● W3Schools think so... – XML Schemas are extensible to future additions – XML Schemas are richer and more powerful than DTDs – XML Schemas are written in XML – XML Schemas support data types – XML Schemas support namespaces

November 2012Web Programming9 The Namespace ● If you want to use more than one schema in any one document, you could have a conflict – e.g. in one schema is defined as a paragraph; in another it's defined as a person ● Answer: declare the namespace you're using –

November 2012Web Programming10 The date problem ● Imagine ● To us, that's 4 th December – But in some countries it's 12 th April ● XML schemas has a data type date that forces the format YYYY-MM-DD – e.g (the ISO standard)the ISO standard ● By declaring what data should look like, we help to ensure everyone understands

November 2012Web Programming11 Example XML Schema <xs:element name="problem" type="xs:string" minOccurs="1" maxOccurs="unbounded"/> Other possibilities are: xs:all (any order, 1 occ.) xs:choice (1 only) Other possibilities include: xs:integer xs:decimal xs:date

November 2012Web Programming12 Using the schema ● If it were a DTD, we might have: <!DOCTYPE list SYSTEM " ● The equivalent for a schema would be: <list xmlns=" xmlns:xsi=" instance" xsi:schemaLocation=" list.xsd">

November 2012Web Programming13 Breaking it down <list xmlns=" The string here technically didn't have to be a URI (it's actually referred to as an IRI – an Internationalized Resource Identifier) It merely serves as a string to identify the namespace we're working with; all the elements used in this XML document are declared in the " namespace

November 2012Web Programming14 Breaking it down (2) xmlns:xsi=" instance" Where the schema that defines the XML for defining a schema is (!) - we need this so we can go on to define the location of the schema that we're using: xsi:schemaLocation=" list.xsd" So three arguments. 1.the name we gave it (a string to identify it); 2.where schemas are defined; 3.where to find the schema we're using.

November 2012Web Programming15 Are schemas complicated? ● Defining a document's structure with a schema would appear more complicated than writing a DTD ● But it offers a lot more ● And it is XML (and we know that...?) – So should be tidy and logical ● But are they necessary? – Well, what of the future?

November 2012Web Programming16 The future? ● Will Schemas replace DTDs? – A lot of people think so ● The advantages mean they probably will ● If you need to learn schema thoroughly, visit

November 2012Web Programming17 What of HTML5 ● Ian Hickson has this to say: Ian Hickson – There's no official formal schema for HTML5 because we have found that providing an official formal schema leads to people using that schema even if it is buggy, never considering writing their own. By not having an official formal schema, we have found that implementors are more likely to write their own code, competing on quality. – ref. ref.

November 2012Web Programming18 So it has a DTD still? ● Actually, no. – See ref on previous slide ● It seems that HTML5 is defined quite separately, and browsers are expected to understand it ● The DOCTYPE and associated headers for HTML5 are unlike those of its XHTML and HTML predecessors.

November 2012Web Programming19 So why use a schema? ● To formally describe an XML document – To your specification – Possibly for display on the web – Possibly in conjunction with other technologies we are about to look at...

November 2012Web Programming20 Why might that be useful on the web? ● Consider a games shop catalogue: The Sims a strategic life- simulation computer game Electronic Arts £19.99

November 2012Web Programming21 Need to display it on the web ● It's much more logical to store it using a different schema to XHTML ● But we therefore need to transform it somehow to XHTML ● And this can be done, easily, using what we will learn in the next couple of lectures.