Document Type Definitions and Schemata We have seen several ways of using XML to markup a poem, but we could invent a host of other possible approaches.

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

CSCI N241: Fundamentals of Web Design Copyright ©2004 Department of Computer & Information Science Introducing XHTML: Module B: HTML to XHTML.
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 and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.
1 DTD (Document Type Definition) Imposing Structure on XML Documents (W3Schools on DTDs)W3Schools on DTDs.
XML eXtensible Markup Language. HTML is not extensible One defect of HTML is that it is not extensible In HTML we cannot, for example, define notions.
XML eXtensible Markup Language. HTML is not extensible One defect of HTML is that it is not extensible In HTML we cannot, for example, define notions.
CS 898N – Advanced World Wide Web Technologies Lecture 21: XML Chin-Chih Chang
XHTML. XHTML is one of the many XML-based languages that have been defined XHTML is, essentially, a “cleaned-up” version of HTML 4, reformulated using.
Sistemi basati su conoscenza XML Prof. M.T. PAZIENZA a.a
Valid XML documents (contd.) For example, if we wanted to turn the example well- formed XML document we have just seen into a valid document, we would.
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.
Sistemi basati su conoscenza XML Prof. M.T. PAZIENZA a.a
XML Primer. 2 History: SGML vs. HTML vs. XML SGML (1960) XML(1996) HTML(1990) XHTML(2000)
Introducing XHTML: Module B: HTML to XHTML. Goals Understand how XHTML evolved as a language for Web delivery Understand the importance of DTDs Understand.
HTML Elements. HTML documents are defined by HTML elements.
Introduction to XML This material is based heavily on the tutorial by the same name at
Introducing HTML & XHTML:. Goals  Understand hyperlinking  Understand how tags are formed and used.  Understand HTML as a markup language  Understand.
Copyright © 2003 Pearson Education, Inc. Slide 2-1 Created by Cheryl M. Hughes, Harvard University Extension School — Cambridge, MA The Web Wizard’s Guide.
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.
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.
Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.
CREATED BY ChanoknanChinnanon PanissaraUsanachote
 XHTML is aimed to replace HTML  XHTML is almost identical to HTML 4.01  XHTML is a stricter and cleaner version of HTML  XHTML is HTML defined as.
XML: Overview MIS 181.9: Service Oriented Architecture 2 nd Semester,
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.
1 © Netskills Quality Internet Training, University of Newcastle Introducing XML © Netskills, Quality Internet Training University.
August Chapter 2 - Markup and Core Concepts Learning XML by Erik T. Ray Slides were developed by Jack Davis College of Information Science and Technology.
1 XHTML محمد احمدی نیا 2 Of 19 HTML vs XHTML  XHTML is a stricter and cleaner version of HTML.  by combining the strengths of HTML.
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.
FIGIS’ML Hands-on training - © FAO/FIGIS An introduction to XML Objectives : –what is XML? –XML and HTML –XML documents structure well-formedness.
 XML is designed to describe data and to focus on what data is. HTML is designed to display data and to focus on how data looks.  XML is created to structure,
Session IV Chapter 9 – XML Schemas
Avoid using attributes? Some of the problems using attributes: Attributes cannot contain multiple values (child elements can) Attributes are not easily.
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 2nd EDITION Tutorial 1 Creating An Xml Document.
CIS 451: XML DTDs Dr. Ralph D. Westfall February, 2009.
Waqas Anwar Next SlidePrevious Slide. Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language.
XML Documents Chao-Hsien Chu, Ph.D. School of Information Sciences and Technology The Pennsylvania State University Elements Attributes Comments PI Document.
XML Instructor: Charles Moen CSCI/CINF XML  Extensible Markup Language  A set of rules that allow you to create your own markup language  Designed.
XP 1 Creating an XML Document Developing an XML Document for the Jazz Warehouse XML Tutorial.
17 Apr 2002 XML Syntax: Documents Andy Clark. Basic Document Structure Element tags – Elements have associated attributes Text content Miscellaneous –
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.
1 Credits Prepared by: Rajendra P. Srivastava Ernst & Young Professor University of Kansas Sponsored by: Ernst & Young, LLP (August 2005) XBRL Module Part.
XML Introduction. What is XML? XML stands for eXtensible Markup Language XML stands for eXtensible Markup Language XML is a markup language much like.
What it is and how it works
XML for Text Markup An introduction to XML markup.
XML Design Goals 1.XML must be easily usable over the Internet 2.XML must support a wide variety of applications 3.XML must be compatible with SGML 4.It.
XML Introduction. Markup Language A markup language must specify What markup is allowed What markup is required How markup is to be distinguished from.
XML – A Quick Introduction Kerry Raymond (stolen from others)
1 Tutorial 11 Creating an XML Document Developing a Document for a Cooking Web Site.
Introduction to XML February 07, From HTML to XML As mentioned in previous classes, if you know HTML, then you already know XML… really! In this.
CS 157B: Database Management Systems II February 11 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2.
What is XML? eXtensible Markup Language eXtensible Markup Language A subset of SGML (Standard Generalized Markup Language) A subset of SGML (Standard Generalized.
Introduction to DTDs. Introduction We learned how to structure information using XML Learned XML grammar Learned the rules for XML encoding We learned.
XML. HTML Before you continue you should have a basic understanding of the following: HTML HTML was designed to display data and to focus on how data.
CIS 228 The Internet 9/20/11 XHTML 1.0. “Quirks” Mode Today, all browsers support standards Compliant pages are displayed similarly There are multiple.
Introduction to XML Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
XML Introduction to XML Extensible Markup Language.
XML Notes taken from w3schools. What is XML? XML stands for EXtensible Markup Language. XML was designed to store and transport data. XML was designed.
Extensible Markup Language (XML) Pat Morin COMP 2405.
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.
Web Programming Maymester 2004
Lonely as a Cloud  A LONELY PPT.
XML Data DTDs, IDs & IDREFs.
Presentation transcript:

Document Type Definitions and Schemata We have seen several ways of using XML to markup a poem, but we could invent a host of other possible approaches The important point is that, once we have invented a new set of tags and attributes, –XML provides us with a way of documenting the relationship between these tags/attributes so that other people can adopt/understand our approach In fact, XML provides two different ways: –the original way is to write a Document Type Definition (DTD) –a newer way it to write an XML Schema (by the way, and a lot of CS textbook writers don’t seem to know this, the plural of schema is schemata, although schemas is acceptable) If we publish our DTD or our schema, we are, in fact, publishing a new XML-based language that others can use

Tags in XML XML elements are tagged like HTML elements However, there are some differences XML tags are case sensitive:  the tag is different from the tags and Every start tag must have a corresponding closing tag –a tag like must have a corresponding tag This implies that XML tags must be nested properly Besides starting tags and closing tags, XML allows empty tags (an empty tag is a start tag which does not have a corresponding closing tag) –Empty tags must be written in a special way, with a teminal slash character, as in

Content of XML elements The content of an element is what lies between its start and closing tags Elements can have different types of content The following element has “empty content” The following and elements have “character content” Fred 25

Content of XML elements (contd.) The following element has “element content” 25 Fred The following element has “mixed content” Fred 25

Attributes in XML As in HTML, start tags in XML can have attributes Unlike in HTML, the value of every attribute in XML must be quoted, as we saw in cloud Every attribute must be quoted, even if it a number, as in Fred

Comments in XML Comments in XML are the same as in HTML Thus

XML version declarations The first line of an XML document may declare the version of XML that the document is based on This line uses a special tag and is of the following form where the 1.0 will change when a newer version of XML is used Although an XML version declaration is optional, it will become critical when newer versions of XML are defined, since it will enable programs processing a document to know which syntactic rules to apply

Syntactic acceptability of an XML document XML documents can have different levels of syntactic acceptability –at the lowest level of acceptability, a document is not a proper XML document at all -- it is ill-formed syntactically –at the next level of acceptability, a document obeys the basic rules of XML syntax -- it is well-formed syntactically –at the highest level of acceptability, a document obeys the syntax rules of a special language based on XML -- it is said to be syntactically valid according to the rules for this special XML- based language

Well-formed XML documents To be well-formed an XML document must satisfy the following basic rules of XML syntax: –the document contains exactly one root element –all other elements are descendents of the root element –start and closing tags for an element have the same spelling –the start tag for an empty element has a final / –attribute names are used only once within the same start tag –elements are properly nested

Example well-formed XML document The Daffodils William Wordsworth I wandered lonely as a cloud That floats on high o’er vales and hills When all at once I saw a crowd A host of golden daffodils Something something something Something something something else...

Another well-formed XML document Ray Burke 1 Margaret Thatcher 75

Valid XML documents To be valid, an XML document –must be well-formed according to the general XML syntax rules –and, in addition, it must satisfy the syntax rules for an application- specific language based on XML Well-formed XML documents are useful but, to be really useful, a document must be valid For example, if two companies wish to exchange information using XML, –the companies must design a special XML-based language which will be capable of expressing the data they wish to exchange and – all documents that are exchanged must be valid according to the syntax rules for this special language

Valid XML documents (contd.) A valid XML document must declare the special XML- based language according to whose rules the XML document is claimed to be valid This done using a document type declaration, which must appear before the start tag of the root element in a valid XML document It has the following general format where someDTDspec would specify the rules for a valid element whose name is nameOfRootElement someDTDspec would either –directly contain an internal document type definition (a DTD) –consist of a reference to an external DTD