XML Introduction Bill Jerome.

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.
DOCUMENT TYPES. Digital Documents Converting documents to an electronic format will preserve those documents, but how would such a process be organized?
XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.
History Leading to XHTML
Chapter 10 © 2001 by Addison Wesley Longman, Inc. 1 Chapter 10 Sebesta: Programming the World Wide Web.
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.
Upgrading to XHTML DECO 3001 Tutorial 1 – Part 1 Presented by Ji Soo Yoon 19 February 2004 Slides adopted from
Introducing XHTML: Module B: HTML to XHTML. Goals Understand how XHTML evolved as a language for Web delivery Understand the importance of DTDs Understand.
Copyright © 2003 Pearson Education, Inc. Slide 1-1 Created by Cheryl M. Hughes, Harvard University Extension School — Cambridge, MA The Web Wizard’s Guide.
Introducing HTML & XHTML:. Goals  Understand hyperlinking  Understand how tags are formed and used.  Understand HTML as a markup language  Understand.
XML – Extensible Markup Language Sivakumar Kuttuva & Janusz Zalewski.
Creating a Simple Page: HTML Overview
August Chapter 1 - Introduction Learning XML by Erik T. Ray Slides were developed by Jack Davis College of Information Science and Technology Radford.
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.
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.
Introduction to XML Eugenia Fernandez IUPUI. What is XML? From the World Wide Web Consortium (W3C) The Extensible Markup Language (XML) is the universal.
1 © Netskills Quality Internet Training, University of Newcastle Introducing XML © Netskills, Quality Internet Training University.
Learning Web Design: Chapter 4. HTML  Hypertext Markup Language (HTML)  Uses tags to tell the browser the start and end of a certain kind of formatting.
 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,
XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML.
XML A web enabled data description language 4/22/2001 By Mark Lawson & Edward Ryan L’Herault.
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
XML 2nd EDITION Tutorial 1 Creating An Xml Document.
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.
XP 1 Creating an XML Document Developing an XML Document for the Jazz Warehouse XML Tutorial.
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.
1 Tutorial 11 Creating an XML Document Developing a Document for a Cooking Web Site.
Jennifer Widom XML Data Introduction, Well-formed XML.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 1COMP9321, 15s2, Week.
SCHOOL OF LIBRARY, ARCHIVE AND INFORMATION STUDIES Andy Dawson LIS1510 Library and Archives Automation Issues XML and extensible systems Andy Dawson School.
 XSL – Extensible Style Sheet Language  XSLT – XSL Transformations › Used to transform XML documents to other formats,like HTML or other XML documents.
XP Tutorial 9New Perspectives on HTML and XHTML, Comprehensive 1 Working with XHTML Creating a Well-Formed Valid Document Tutorial 9.
Tutorial 9 Working with XHTML. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Describe the history and theory of XHTML.
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.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
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.
XSLT, XML Schema, and XPath Matt McClelland. Introduction XML Schema ▫Defines the content and structure of XML data. XSLT ▫Used to transform XML documents.
1 XSLT XSLT (extensible stylesheet language – transforms ) is another language to process XML documents. Originally intended as a presentation language:
Extensible Markup Language (XML) Pat Morin COMP 2405.
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.
What is XHTML? XHTML stands for Extensible Hypertext Markup Language
XSLT: The XML transformation language
Web Basics: HTML/CSS/JavaScript What are they?
XML: Extensible Markup Language
Unit 4 Representing Web Data: XML
CIS 228 The Internet 9/20/11 XHTML 1.0.
Creating a Well-Formed Valid Document
Tutorial 9 Working with XHTML
The Object-Oriented Thought Process Chapter 11
Displaying XML Data with XSLT
Introduction to XHTML.
Chapter 7 Representing Web Data: XML
XHTML
Roy Tennant California Digital Library
Creating an XML Document
Introducing HTML & XHTML:
Tutorial 9 Working with XHTML
XML Data Introduction, Well-formed XML.
More Sample XML By Sadia Anjum.
IEEM 5352 E-Enterprise Integration
XHTML 7-May-19.
Attributes, Empty-Element Tags, and XSL
XSL XSLT and XPath.
XHTML 29-May-19.
HTML5 and CSS3 Illustrated Unit B: Getting Started with HTML
Unit 6 - XML Transformations
Presentation transcript:

XML Introduction Bill Jerome

Motivation “Extensible Markup Language (XML) is a simple, very flexible text format derived from SGML (ISO 8879). Originally designed to meet the challenges of large-scale electronic publishing” – World Wide Web Consortium

Motivation This is not meant to be a universal data encoding. (See SGML) Intent is to encode publishable data with XML so that it can be presented to others through transformation which adheres to guidelines Thus, a text author need only write in XML and send to book publishers who would simply have to transform the XML into a book that meats their publication guidelines

Motivation for the web Page authors could learn to write XML rather than HTML and then transform their pages for display on the web. That same XML could be transformed into printed text, etc., without altering the XML at all. Choosing stylesheets would allow a total change in appearance (similar to CSS) without altering content

Motivation for web From a technical standpoint, the goal is to separate data for publication from its presentation To do it in a way that generates a more real separation that Cascading Style Sheets do it

Realities In fact, transformations can be much more powerful. Table of contents, indices, repositories for other sources (ex: search) can all be transformed out of the XML documents XML is of limited use by itself and requires design of guidelines (DTDs or schemas) Simple to learn to do, not so simple to do right

XML syntax If you know HTML, XML is already familiar More formalized All tags have end tags Certain document structure to identify XML doc (like <HTML></HTML>) Maximum one root node per document <tag>Marked up text</tag> <tag2 attribute=“setting”>More text</tag2>

XML not direct parent of HTML What in html is not really XML? Images <img src=“foo.jpg”> No end Line breaks <br> Empty (untagged content) <html><head></head><body>Here is untagged text</body></html>

XHTML A “cleaned up” form of HTML that is XML compliant Exists in the form of the XHTML DTD Is not rendered right in most browsers in many cases <img src=“foo.jpg”/> just treated as error <br/> sometimes isn’t and won’t work

XML doesn’t look helpful At first glance we have gained very little by switching to XML. Benefit will come from structure of XML tags, described by DTDs or Schemas We will focus on DTDs which are not as rich as Schemas but are older and more widely used

Document Type Descriptors DTDs provide promises about XML documents. They outline exactly what tags are allowed, how the are allowed to relate (do the nest, are they required like <body>, etc.) Provide for some more complicated formations (‘A textbook must have at least one author, may or may not have an editor, but must one and only one copyright’)

More on DTDs Are not a complete language. Cannot specify “three authors with at least one who is also an editor” with a DTD XML documents then reference a DTD that they claim to adhere to within the header of the document XML Parsers should always enforce DTDs and not assume the XML document is correct

Well-formedness vs. validity An XML document is well-formed if it can be interpreted as an XML document. Thus it has matched start/end tags in an XML formatted document An XML document is valid if it adheres to the DTD it references

XML Stylesheet So now that we have a promise of how content must be arranged and content to go with it, how do we publish? Via XML Stylesheet Transformation (XSLT) XSL files explain to the transformer how to interpret all elements of a particular DTD XSLT engine then applies those rules to the XML file

XSLT XSL files are ugly. The syntax (like DTDs as well) is itself XML. Is not intended for easy readability Is extremely powerful. XSL allows ‘callbacks’ to its engine within XSL. These are the parts you swap out to get different outputs

Map We have introduced three new file types. Here is a rough map of how they fit: .xsl .html XSLT Engine .dtd Informs .xml

Map Different XSLs book.xsl .ps web.xsl .html XSLT Engine .dtd Informs .xml

Map Different content book.xsl .ps .ps .ps .ps web.xsl .html .html XSLT Engine .dtd .html Informs .html .xml .xml .xml .xml

Example XML <?xml version="1.0"?> <recipe name=“Cookies”> <author>Carol Schmidt</author> <ingredients> <item unit=“C” measurement=“2/3”> butter</item> <item unit=“C” measurement=“2”> brown sugar</item> </ingredients> </recipe>

Example DTD <?xml version="1.0" encoding="UTF-8"?> <!ELEMENT recipe (author, ingredients)> <!ATTLIST recipe name CDATA #REQUIRED > <!ELEMENT ingredients (item+)> <!ELEMENT item (#PCDATA|sub_item)*> <!ATTLIST item measurement CDATA #REQUIRED unit CDATA #REQUIRED > <!ELEMENT author (#PCDATA)> …

Example XSL <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="recipe"> <html> <head/> <body> <p/> <b>Recipe Name:</b> <xsl:value-of select="@name"/> <br/> </body> </html> <xsl:template match="ingredients"> <xsl:for-each select="item"> <xsl:value-of select="@measurement"/> <xsl:value-of select="@unit"/> <xsl:value-of select="."/> </xsl:for-each> <xsl:template match="author"> <i> </i> </xsl:stylesheet>

XSL Output Recipe Name:Cookies Carol Schmidt 2/3Cbutter 2C brown sugar

Resources http://www.w3.org/XML/ http://www.w3.org/Style/XSL/ http://hotwired.lycos.com/webmonkey/98/41/index1a.html http://www.xml.com/