1 Tutorial 11 Creating an XML Document Developing a Document for a Cooking Web Site.

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

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.
Website Design.
History Leading to XHTML
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
CS 898N – Advanced World Wide Web Technologies Lecture 21: XML Chin-Chih Chang
Tutorial 1 Developing a Basic Web Page
Tutorial 9 Working with XHTML. XP Objectives Describe the history and theory of XHTML Understand the rules for creating valid XHTML documents Apply a.
Creating a Well-Formed Valid Document. 2 Objectives Introducing XHTML Creating a Well-Formed Document Creating a Valid Document Creating an XHTML Document.
Tutorial 11 Creating XML Document
XML Primer. 2 History: SGML vs. HTML vs. XML SGML (1960) XML(1996) HTML(1990) XHTML(2000)
Introduction to XML: Yong Choi CSU Bakersfield.
Developing a Basic Web Page with 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.
Introducing HTML & XHTML:. Goals  Understand hyperlinking  Understand how tags are formed and used.  Understand HTML as a markup language  Understand.
Chapter 12 Creating and Using XML Documents HTML5 AND CSS Seventh Edition.
XML introduction to Ahmed I. Deeb Dr. Anwar Mousa  presenter  instructor University Of Palestine-2009.
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.
Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.
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.
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.
Tutorial 1: XML Creating an XML Document. 2 Introducing XML XML stands for Extensible Markup Language. A markup language specifies the structure and content.
XML TUTORIAL Portions from w3 schools By Dr. John Abraham.
1 Tutorial 13 Validating Documents with DTDs Working with Document Type Definitions.
Introduction to HTML Tutorial 1 eXtensible Markup Language (XML)
XP Tutorial 9 1 Working with XHTML. XP SGML 2 Standard Generalized Markup Language (SGML) A standard for specifying markup languages. Large, complex standard.
E0262 – MIS – Multimedia Storage Techniques XML (Extensible Markup Language  XML is a markup language for creating documents containing structured information.
XML 2nd EDITION Tutorial 1 Creating An Xml Document.
XP 2 HTML Tutorial 1: Developing a Basic Web Page.
Windows Presentation Foundation (WPF) Chapter 16 Dr. Abraham.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation An Introduction to XML.
XML Documents Chao-Hsien Chu, Ph.D. School of Information Sciences and Technology The Pennsylvania State University Elements Attributes Comments PI Document.
1 Introduction  Extensible Markup Language (XML) –Uses tags to describe the structure of a document –Simplifies the process of sharing information –Extensible.
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.
XP 1 Creating an XML Document Developing an XML Document for the Jazz Warehouse XML Tutorial.
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.
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.
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.
1 Tutorial 12 Working with Namespaces Combining XML Vocabularies in a Compound Document.
1 herbert van de sompel CS 502 Computing Methods for Digital Libraries Cornell University – Computer Science Herbert Van de Sompel
©SoftMoore ConsultingSlide 1 Introduction to HTML: Basic Document Structure.
XP Tutorial 9New Perspectives on HTML and XHTML, Comprehensive 1 Working with XHTML Creating a Well-Formed Valid Document Tutorial 9.
Objective: To describe the evolution of the Internet and the Web. Explain the need for web standards. Describe universal design. Identify benefits of accessible.
Chapter 1 Introduction to JavaScript JavaScript, Third Edition.
Tutorial 9 Working with XHTML. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Describe the history and theory of XHTML.
XP 2 HTML Tutorial 1: Developing a Basic Web Page.
XP 1 HTML Tutorial 1: Developing a Basic Web Page.
Introduction to XML Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
XP 1 New Perspectives on XML Tutorial 1 – Creating an XML Document Jason C. H. Chen, Ph.D. Professor of MIS School of Business Administration Gonzaga University.
Tutorial 9 Working with XHTML. XP Objectives Describe the history and theory of XHTML Understand the rules for creating valid XHTML documents Apply a.
XP 1Creating Web Pages with XML Tutorial 1 New Perspectives on XML Tutorial 1 – Creating an XML Document.
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.
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 1 Using HTML to Create Web Pages.
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.
Creating a Well-Formed Valid Document
Tutorial 9 Working with XHTML
Tutorial 9 Working with XHTML
HTML5 – Heading, Paragraph
Creating an XML Document
Introducing HTML & XHTML:
Tutorial 9 Working with XHTML
Presentation transcript:

1 Tutorial 11 Creating an XML Document Developing a Document for a Cooking Web Site

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Introducing XML XML stands for Extensible Markup Language. A markup language specifies the structure and content of a document. Because it is extensible, XML can be used to create a wide variety of document types.

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 3 Introducing XML XML is a subset of the Standard Generalized Markup Language (SGML) which was introduced in the 1980s. SGML is very complex and can be costly. These reasons led to the creation of Hypertext Markup Language (HTML), a more easily used markup language. XML can be seen as sitting between SGML and HTML – easier to learn than SGML, but more robust than HTML.

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 4 The Limits of HTML HTML was designed for formatting text on a Web page. It was not designed for dealing with the content of a Web page. HTML is limited to a set of predefined elements. HTML can be inconsistently applied.

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 5 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 must be easy to write programs that process XML documents

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 6 XML Design Goals 5.XML documents should be clear and easily understood by nonprogrammers 6.The design of XML must be exact and concise 7.XML documents must be easy to create 8.Terseness in XML markup is of minimal importance

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 7 XML Vocabularies

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 8 Well-Formed and Valid XML Documents An XML document is well-formed if it contains no syntax errors and fulfills all of the specifications for XML code as defined by the W3C. An XML document is valid if it is well-formed and also satisfies the rules laid out in the DTD or schema attached to the document.

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 9 The Structure of an XML Document XML documents consist of three parts –The prolog –The document body –The epilog The prolog is optional and provides information about the document itself

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 10 The Structure of an XML Document The document body contains the document’s content in a hierarchical tree structure. The epilog is also optional and contains any final comments or processing instructions.

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 11 The XML Declaration The XML declaration is always the first line of code in an XML document. It tells the processor what follows is written using XML. It can also provide any information about how the parser should interpret the code. The complete syntax is: A sample declaration might look like this:

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 12 Inserting Comments Comments or miscellaneous statements go after the declaration. Comments may appear anywhere after the declaration. The syntax for comments is: This is the same syntax for HTML comments

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 13 Working with Elements Elements are the basic building blocks of XML files. Elements contain an opening tag and a closing tag –Content is stored between tags

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 14 Working with Elements A closed element, has the following syntax: Content Example: Miles Davis

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 15 Working with Elements Element names are case sensitive An open or empty element is an element that contains no content. Elements can be nested, as follows: 1/2 cup soy sauce 1/2 cup plum sauce 1/2 cup pineapple juice

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 16 Working with Elements Nested elements are called child elements. Elements must be nested correctly. Child elements must be enclosed within their parent elements.

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 17 The Element Hierarchy All elements must be nested within a single document or root element. There can be only one root element.

The Element Hierarchy New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 18

Writing the Document Body New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 19

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 20 Working with Attributes An attribute is a feature or characteristic of an element. Attributes are text strings and must be placed in single or double quotes. The syntax is: …

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 21 Using Character and Entity References Special characters, such as the symbol for the British pound, can be inserted into your XML document by using a character reference. The syntax is: &#nnn;

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 22 Using Character and Entity References Character is a character reference number or name from the ISO/IEC character set. Character references in XML are the same as in HTML. XML also supports entity references, which are named references to special symbols or extra content found in external files or extended text strings.

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 23 Using Character and Entity References

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 24 Using Character and Entity References

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 25 Parsed Character Data Parsed character data, or pcdata consists of all those characters that XML treats as parts of the code of XML document –The XML declaration –The opening and closing tags of an element –Empty element tags –Character or entity references –Comments –Processing instructions

Character Data and Whitespace Character data is not processed, but instead is treated as pure data content. Whitespace refers to nonprintable characters such as spaces (created by pressing the Spacebar), new line characters (created by pressing the Enter key), or tab characters (created by pressing the Tab key). New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 26

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 27 CDATA Sections A CDATA section is a large block of text the XML processor will interpret only as text and not attempt to parse. The syntax to create a CDATA section is: <! [CDATA [ character data ] ]>

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 28 CDATA Sections This example shows an element named htmlcode that contains a CDATA section, which is used to store several HTML taks for the thehelpfulcook.com Web site <![CDATA[ thehelpfulcook.com An online source of recipes and cooking tips ]]>

CDATA Sections New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 29

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 30 Parsing an XML Document

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 31 Parsing an XML Document XML documents can be opened in Internet Explorer or in Netscape Navigator. If there are no syntax errors, IE will display the document’s contents in an expandable/collapsible outline format including all markup tags. Starting with version 6.0, the Netscape browser included a built-in XML parser. Opera versions 8.0 and above include an XML parser, as do all versions of Mozilla Firefox and Apple Safari.

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 32 Parsing an XML Document

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 33 Formatting XML Data with CSS Link the XML document to a style sheet to format the document. The XML processor will combine the style sheet with the XML document and apply any formatting codes defined in the style sheet to display a formatted document. –Cascading Style Sheets (CSS)

Formatting XML Data with CSS New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 34

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 35 Formatting XML Data with CSS To apply a style sheet to a document, use the following syntax: selector {attribute1:value1; attribute2:value2; …} selector is an element (or set of elements) from the XML document. attribute and value are the style attributes and attribute values to be applied to the document.

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 36 Formatting XML Data with CSS For example: author {color:red; font-weight:bold} will display the text of the artist element in a red boldface type.

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 37 Inserting a Processing Instruction The link from the XML document to a style sheet is created using a processing instruction. A processing instruction is a command that gives instructions to the XML parser.

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 38 Inserting a Processing Instruction For example: Style is the type of style sheet to access and sheet is the name and location of the style sheet.

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 39 The dp.css Style Sheet

Linking to the dp.css Style Sheet New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 40

New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 41 The recipes Document Formatted with the dp.css Style Sheet