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.

Slides:



Advertisements
Similar presentations
© De Montfort University, XML – a meta language Howell Istance and Peter Norris School of Computing De Montfort University.
Advertisements

XML 6.3 DTD 6. XML and DTDs A DTD (Document Type Definition) describes the structure of one or more XML documents. Specifically, a DTD describes:  Elements.
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.
History Leading to XHTML
XML Document Type Definitions ( DTD ). 1.Introduction to DTD An XML document may have an optional DTD, which defines the document’s grammar. Since the.
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.
3 November 2008CIS 340 # 1 Topics To define XML as a technology To place XML in the context of system architectures.
Tutorial 9 Working with XHTML
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 Study-Session: Part II Validating XML Documents.
CS 898N – Advanced World Wide Web Technologies Lecture 21: XML Chin-Chih Chang
Document Type Definitions
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.
1 XML: Document Type Definitions 2 Road Map  Introduction to DTDs  What’s a DTD?  Why are they important?  What will we cover?  Our First DTD 
A Technical Introduction to XML Transparency No. 1 XML quick References.
Tutorial 9 Working with XHTML. XP Objectives Describe the history and theory of XHTML Understand the rules for creating valid XHTML documents Apply a.
Full declaration When an element is declared to have element content, the children element types must also be declared Example: to which the following.
Document Type Definitions. XML and DTDs A DTD (Document Type Definition) describes the structure of one or more XML documents. Specifically, a DTD describes:
VALIDATING AN XML DOCUMENT
Introduction to XML This material is based heavily on the tutorial by the same name at
Tutorial 3: XML Creating a Valid XML Document. 2 Creating a Valid Document You validate documents to make certain necessary elements are never omitted.
XP New Perspectives on XML Tutorial 3 1 DTD Tutorial – Carey ISBN
XP The University of Akron Summit College Business Technology Department Computer Information Systems 2440: 140 Internet Tools Instructor: Enoch E. Damson.
Copyright © 2003 Pearson Education, Inc. Slide 3-1 Created by Cheryl M. Hughes, Harvard University Extension School — Cambridge, MA The Web Wizard’s Guide.
Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.
XML CPSC 315 – Programming Studio Fall 2008 Project 3, Lecture 1.
Chapter 1 XHTML: Part I The Web Warrior Guide to Web Design Technologies.
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.
XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language.
XHTML. Introduction to XHTML What Is XHTML? – XHTML stands for EXtensible HyperText Markup Language – XHTML is almost identical to HTML 4.01 – XHTML is.
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.
Tutorial 1: XML Creating an XML Document. 2 Introducing XML XML stands for Extensible Markup Language. A markup language specifies the structure and content.
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.
Copyrighted material John Tullis 10/17/2015 page 1 04/15/00 XML Part 3 John Tullis DePaul Instructor
CIS 275—Web App Dev I XML. 2 Introduction to XMLXML XML stands for ________________________. HTML was designed to display data. XML was designed to _________.
XML - DTD Week 4 Anthony Borquez. What can XML do? provides an application independent way of sharing data. independent groups of people can agree to.
CIS 451: XML DTDs Dr. Ralph D. Westfall February, 2009.
IS432 Semi-Structured Data Lecture 2: DTD Dr. Gamal Al-Shorbagy.
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.
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.
INFSY 547: WEB-Based Technologies Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2.
XML Document Type Definitions and the Document object model.
Introduction to DTD A Document Type Definition (DTD) defines the legal building blocks of an XML document. It defines the document structure with a list.
XML DTD. XML Validation XML with correct syntax is "Well Formed" XML. XML validated against a DTD is "Valid" XML.
DTD Document Type Definition. Agenda Introduction to DTD DTD Building Blocks DTD Elements DTD Attributes DTD Entities DTD Exercises DTD Q&A.
Tutorial 9 Working with XHTML. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Describe the history and theory of XHTML.
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 Introduction to XML Extensible Markup Language.
Week-9 (Lecture-1) XML DTD (Data Type Document): An XML document with correct syntax is called "Well Formed". An XML document validated against a DTD is.
CITA 330 Section 2 DTD. Defining XML Dialects “Well-formedness” is the minimal requirement for an XML document; all XML parsers can check it Any useful.
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.
Tutorial 9 Working with XHTML
Session III Chapter 6 – Creating DTDs
Web Programming Maymester 2004
New Perspectives on XML
XML Outline 1 XML 2 DTD.
Session II Chapter 6 – Creating DTDs
Document Type Definition (DTD)
Presentation transcript:

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 insert a line which would look like where someDTDspec would specify what rules must be followed by a valid people element Although a doctype statement may directly contain an internal DTD, we will consider only the cases where a doctype statement refers to an external DTD, because these are the most useful

DOCTYPEs referring to external DTDs A doctype statement which refers to an external DTD has one of two formats: In the first format, the keyword SYSTEM says that the external DTD is on the local machine and fileNameAndPath says where to find it In the second format, the keyword PUBLIC says that the external DTD is publicly available on the Internet, the fpi (Formal Public Identifier) gives its formal name and the url says where it can be found

Example DOCTYPEs referring to external DTDs The doctype statement says that the external DTD is on the local machine, in a file called myFirstDTD.dtd The doctype statement says that the external DTD is publicly available on the Internet, gives it a formal name which should be used by everybody who wants to refer to it, and says where it can be found

Formal Public Identifiers We will be focussing on system DTDs but some of you may be wondering about the format of FPIs like -//UCC//DTD PEOPLE v1.0//EN This format is actually defined by an ISO standard and FPIs like this can be registered with organizations which are authorized by the ISO Council to act as FPI registrars The format is the - (which could also be a + ) indicates whether/not the organization name which follows is ISO-registered; UCC is not UCC is an OwnerID, the name of the organization which owns and maintains the document identified by the FPI DTD is a Public Text Class, a keyword identifying the type of doc PEOPLE v1.0 is a unique descriptive name for the document EN is the Public Text Language, in which the doc is written

Formal Public Identifiers (contd.) For example, this is the formal public identifier for one version of the HTML 4 specification: -//W3C//DTD HTML 4.01//EN the W3C is not an ISO-registered organization the HTML4 specification is a DTD HTML 4.01 is a unique descriptive name EN says that the specification is written in English

XML document which claims to be valid 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...

Another XML document claiming to be valid Ray Burke 1 Margaret Thatcher 75

Document Type Definitions A DTD defines the syntax rules for an application-specific type of XML-documents. A DTD describes the root element that may appear in a valid document and, in doing so, also describes the kinds of children elements that the root element may possess A DTD must contain element type declarations, statements which have the following general format: In addition, a DTD may contain a range of other types of statement, only one of which we will cover here, attribute declarations, statements which are used to define the attributes which elements may have.

Element Type Declarations An element type declaration is a statements which has the following general format: where contentModel describes the content (if any) that may or must exist between the start tag and the closing tag (if any) of the element whose name is elementName

Empty Elements Empty elements are declared using the keyword EMPTY inside the parentheses Example: which declares an element which only has a start tag and which, unless it has some attribute(s), must be written as

Elements with Character content Elements that contain character data are declared as follows: where #PCDATA stands for “parsed character data” Example: This element declaration would be satisfied by the following text in an XML file January

Elements with element content Elements that contain only children elements are declared as follows: or <!ELEMENT element-name (child-name1, child-name2,...)> Example which specifies that a country element contains exactly one child element, a position element:.....

Elements with element content (contd.) Example which specifies that a memorandum element contains a sender element, followed by a recipient element, followed by a message element When a sequence of children elements is declared, as above, the children must appear in exactly the same sequence in conforming XML documents: