An Introduction to XML and Web Technologies XML Documents

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

Chungnam National University DataBase System Lab
1 eXtensible Markup Language. XML is based on SGML: Standard Generalized Markup Language HTML and XML are both based on SGML 2 SGML HTMLXML.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Introduction to XHTML Programming the World Wide Web Fourth edition.
1 Roger L. Costello 16 June 2010 XQuery
Copyright © 2003 Pearson Education, Inc. Slide 7-1 Created by Cheryl M. Hughes, Harvard University Extension School Cambridge, MA The Web Wizards Guide.
Copyright © 2003 Pearson Education, Inc. Slide 8-1 Created by Cheryl M. Hughes, Harvard University Extension School Cambridge, MA The Web Wizards Guide.
Copyright © 2003 Pearson Education, Inc. Slide 3-1 Created by Cheryl M. Hughes The Web Wizards Guide to XML by Cheryl M. Hughes.
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Copyright © 2003 Pearson Education, Inc. Slide 5-1 Created by Cheryl M. Hughes, Harvard University Extension School Cambridge, MA The Web Wizards Guide.
LIS650lecture 1 XHTML 1.0 strict Thomas Krichel
18 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Introduction to Web Services.
9 Copyright © 2005, Oracle. All rights reserved. Modularizing JavaServer Pages Development with Tags.
8 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: JavaServer Pages.
Transforming XML XMLNamespaces, XSLT. XML Namespaces Sometimes it is necessary to mix XML elements –Different types of content –Use of markup to convey.
Dr. Alexandra I. Cristea CS 253: Topics in Database Systems: XPath, NameSpaces.
Dr. Alexandra I. Cristea CS 253: Topics in Database Systems: C1.
Dr. Alexandra I. Cristea CS 253: Topics in Database Systems: C3.
4. Internet Programming ENG224 INFORMATION TECHNOLOGY – Part I
XML Schema Heewon Lee. Contents 1. Introduction 2. Concepts 3. Example 4. Conclusion.
XML and Databases Exercise Session 3 (courtesy of Ghislain Fourny/ETH)
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.
eXtensible Markup Language
XML: Extensible Markup Language
XML Craig Stewart Dr. Alexandra I. Cristea
Dr. Alexandra I. Cristea XHTML.
Dr. Alexandra I. Cristea XPath and Namespaces.
1 An inference engine for the semantic web Naudts Guido Student at the Open University Netherlands.
Chapter 2 Entity-Relationship Data Modeling: Tools and Techniques
PSSA Preparation.
Steffen Staab 1WeST Web Science & Technologies University of Koblenz ▪ Landau, Germany Structured Data on the Web Introduction to.
Introduction Peter Dolog dolog [at] cs [dot] aau [dot] dk Intelligent Web and Information Systems September 9, 2010.
17 Apr 2002 XML Namespaces Andy Clark. The Problem Documents use different vocabularies – Example 1: CD music collection – Example 2: online order transaction.
1 XSLT – eXtensible Stylesheet Language Transformations Modified Slides from Dr. Sagiv.
SPECIAL TOPIC XML. Introducing XML XML (eXtensible Markup Language) ◦A language used to create structured documents XML vs HTML ◦XML is designed to transport.
An Introduction to XML Based on the W3C XML Recommendations.
Introduction to XLink Transparency No. 1 XML Information Set W3C Recommendation 24 October 2001 (1stEdition) 4 February 2004 (2ndEdition) Cheng-Chia Chen.
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.
XML –Query Languages, Extracting from Relational Databases ADVANCED DATABASES Khawaja Mohiuddin Assistant Professor Department of Computer Sciences Bahria.
Tutorial 11 Creating XML Document
XML Primer. 2 History: SGML vs. HTML vs. XML SGML (1960) XML(1996) HTML(1990) XHTML(2000)
Topics The "bigger picture" –The "XML sales pitch" –XML/XHTML vs. SGML/HTML –XML in electronic publishing –XML and the future, web 2.0 XML basics: –Building.
4/20/2017.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 2 XML Documents (Based on Møller and Schwartzbach,
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 XML Taken from Chapter 7.
XML Anisha K J Jerrin Thomas. Outline  Introduction  Structure of an XML Page  Well-formed & Valid XML Documents  DTD – Elements, Attributes, Entities.
XML and XPath. Web Services: XML+XPath2 EXtensible Markup Language (XML) a W3C standard to complement HTML A markup language much like HTML origins: structured.
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.
Introduction to XML. What is XML? Extensible Markup Language XML Easier-to-use subset of SGML (Standard Generalized Markup Language) XML is a.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
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.
 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,
Processing of structured documents Spring 2002, Part 2 Helena Ahonen-Myka.
ITCS 6265 Information Retrieval & Web Mining Lecture 18-A Fall 2009.
1 XML eXtensible Markup Language. 2 XML vs. HTML HTML is a HyperText Markup language HTML is a HyperText Markup language Designed for a specific application,
XML Basics A brief introduction to XML in general 1XML Basics.
CS 157B: Database Management Systems II February 11 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron.
1 Indexing The syntax for creating a index is: CREATE [UNIQUE] INDEX index_name ON table_name (column1, column2,... column_n) [ COMPUTE STATISTICS ]; Why.
+ 1 XML eXtensible Markup Language. + 2 XML Lecture Adapted from the work of Dr. Praveen Madiraju of Marquette University.
XML CSC1310 Fall HTML (TIM BERNERS-LEE) HyperText Markup Language  HTML (HyperText Markup Language): December  Markup  Markup is a symbol.
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 – Basic Concepts (modified version from Dr. Praveen Madiraju) 2015, Fall Pusan National University Ki-Joune Li.
XML Extensible Markup Language
1 XML eXtensible Markup Language. 2 Introduction and Motivation Dr. Praveen Madiraju Modified from Dr.Sagiv’s slides.
XML: Extensible Markup Language
Unit 4 Representing Web Data: XML
Chapter 7 Representing Web Data: XML
Lecture 9: XML Monday, October 17, 2005.
Presentation transcript:

An Introduction to XML and Web Technologies XML Documents Søren Debois Based on slides by Anders Møller & Michael I. Schwartzbach

A few messages About examination: Do read the blog four-hour written examination grading is pass/fail date is not yet set Do read the blog Do comment on lectures and exercises on the blog, e-mail, on paper, etc An Introduction to XML and Web Technologies

You must provide feedback! (Many thanks to you who already did.)

Write a well-formed XML-document Use your laptop or a piece of paper. You have 90 seconds.

Today What is XML? XML Trees vs. XML documents Example applications Namespaces An Introduction to XML and Web Technologies

What is XML? An Introduction to XML and Web Technologies

What is XML? XML: Extensible Markup Language A framework for defining markup languages Each language is targeted at its own application domain with its own markup tags There is a common set of generic tools for processing XML documents XHTML: an XML variant of HTML Inherently internationalized and platform independent (Unicode) Developed by W3C, standardized in 1998 An Introduction to XML and Web Technologies

Recipes in XML Define our own “Recipe Markup Language” Choose markup tags that correspond to concepts in this application domain recipe, ingredient, amount, ... No canonical choices granularity of markup? structuring? elements or attributes? ... An Introduction to XML and Web Technologies

Example (1/2) <collection> <description>Recipes suggested by Jane Dow</description> <recipe id="r117"> <title>Rhubarb Cobbler</title> <date>Wed, 14 Jun 95</date> <ingredient name="diced rhubarb" amount="2.5" unit="cup"/> <ingredient name="sugar" amount="2" unit="tablespoon"/> <ingredient name="fairly ripe banana" amount="2"/> <ingredient name="cinnamon" amount="0.25" unit="teaspoon"/> <ingredient name="nutmeg" amount="1" unit="dash"/> <preparation> <step> Combine all and use as cobbler, pie, or crisp. </step> </preparation> An Introduction to XML and Web Technologies

Example (2/2) <comment> Rhubarb Cobbler made with bananas as the main sweetener. It was delicious. </comment> <nutrition calories="170" fat="28%" carbohydrates="58%" protein="14%"/> <related ref="42">Garden Quiche is also yummy</related> </recipe> </collection> An Introduction to XML and Web Technologies

Building on the XML Notation Defining the syntax of our recipe language DTD, XML Schema, ... Showing recipe documents in browsers XPath, XSLT Recipe collections as databases XQuery Building a Web-based recipe editor HTTP, Servlets, JSP, ... ... – the topics of the following weeks... An Introduction to XML and Web Technologies

XML trees vs. XML documents

XML Trees Conceptually, an XML document is a tree structure node, edge root, leaf child, parent sibling (ordered), ancestor, descendant An Introduction to XML and Web Technologies

An Analogy: File Systems An Introduction to XML and Web Technologies

Tree View of the XML Recipes An Introduction to XML and Web Technologies

Draw the tree corresponding to the following XML-document. Use your laptop or a piece of paper. You have 90 seconds.

Discuss: floors are elements, but wings are attributes? ... with anyone closer to you than 1.5 m You have 270 seconds.

Nodes in XML Trees Text nodes: carry the actual contents, leaf nodes Element nodes: define hierarchical logical groupings of contents, each have a name Attribute nodes: unordered, each associated with an element node, has a name and a value Comment nodes: ignorable meta-information Processing instructions: instructions to specific processors, each have a target and a value Root nodes: every XML tree has one root node that represents the entire tree An Introduction to XML and Web Technologies

Textual Representation Text nodes: written as the text they carry Element nodes: start-end tags <bla ...> ... </bla> short-hand notation for empty elements: <bla/> Attribute nodes: name=“value” in start tags Comment nodes: <!-- bla --> Processing instructions: <?target value?> Root nodes: implicit An Introduction to XML and Web Technologies

Construct an XML document containing every node type. You have 180 seconds.

Discuss: which node types, if any, could we do without? ... with anyone within 1.5 m. You have 180 seconds.

Browsing XML (without XSLT) An Introduction to XML and Web Technologies

More Constructs XML declaration Character references CDATA sections Document type declarations and entity references explained later... Whitespace? An Introduction to XML and Web Technologies

Example <?xml version="1.1" encoding="ISO-8859-1"?> <!DOCTYPE features SYSTEM "example.dtd"> <features a="b"> <?mytool here is some information specific to mytool?> El señor está bien, garçon! Copyright © 2005 <![CDATA[ <this is not a tag> ]]> <!-- always remember to specify the right character encoding --> </features> An Introduction to XML and Web Technologies

Well-formedness Every XML document must be well-formed start and end tags must match and nest properly <x><y></y></x>  </z><x><y></x></y> exactly one root element ... in other words, it defines a proper tree structure XML parser: given the textual XML document, constructs its tree representation An Introduction to XML and Web Technologies

Simpler Alternatives? S-expressions, 1958: (collection (recipe (title "Rhubarb Cobbler") (date "Wed, 14 Jun 95") ... ) XML is defined as a simplified subset of SGML XML could have been designed simpler... ... but it wasn’t [end of discussion] An Introduction to XML and Web Technologies

Applications

Applications Rough classification: Data-oriented languages Document-oriented languages Protocols and programming languages Hybrids An Introduction to XML and Web Technologies

Example: XHTML <?xml version="1.0" encoding="UTF-8"?> <html xmlns="http://www.w3.org/1999/xhtml"> <head><title>Hello world!</title></head> <body> <h1>This is a heading</h1> This is some text. </body> </html> An Introduction to XML and Web Technologies

Example: CML <molecule id="METHANOL"> <atomArray> <stringArray builtin="id">a1 a2 a3 a4 a5 a6</stringArray> <stringArray builtin="elementType">C O H H H H</stringArray> <floatArray builtin="x3" units="pm"> -0.748 0.558 ... </floatArray> <floatArray builtin="y3" units="pm"> -0.015 0.420 ... <floatArray builtin="z3" units="pm"> 0.024 -0.278 ... </atomArray> </molecule> An Introduction to XML and Web Technologies

Example: ebXML <MultiPartyCollaboration name="DropShip"> <BusinessPartnerRole name="Customer"> <Performs initiatingRole='//binaryCollaboration[@name="Firm Order"]/ InitiatingRole[@name="buyer"]' /> </BusinessPartnerRole> <BusinessPartnerRole name="Retailer"> <Performs respondingRole='//binaryCollaboration[@name="Firm Order"]/ RespondingRole[@name="seller"]' /> <Performs initiatingRole='//binaryCollaboration[...]/ <BusinessPartnerRole name="DropShip Vendor"> ... </MultiPartyCollaboration> An Introduction to XML and Web Technologies

Example: ThML <h3 class="s05" id="One.2.p0.2">Having a Humble Opinion of Self</h3> <p class="First" id="One.2.p0.3">EVERY man naturally desires knowledge <note place="foot" id="One.2.p0.4"> <p class="Footnote" id="One.2.p0.5"><added id="One.2.p0.6"> <name id="One.2.p0.7">Aristotle</name>, Metaphysics, i. 1. </added></p> </note>; but what good is knowledge without fear of God? Indeed a humble rustic who serves God is better than a proud intellectual who neglects his soul to study the course of the stars. <added id="One.2.p0.8"><note place="foot" id="One.2.p0.9"> <p class="Footnote" id="One.2.p0.10"> Augustine, Confessions V. 4. </p> </note></added> An Introduction to XML and Web Technologies

Make an XML language for DIY projects. Example: “hang picture on wall” Elements: title, description, tools, materials, steps. You have 270 seconds.

Namespaces

XML Namespaces <widget type="gadget"> <head size="medium"/> <big><subwidget ref="gizmo"/></big> <info> <head> <title>Description of gadget</title> </head> <body> <h1>Gadget</h1> A gadget contains a big gizmo </body> </info> </widget> When combining languages, element names may become ambiguous! Common problems call for common solutions An Introduction to XML and Web Technologies

The Idea Assign a URI to every (sub-)language e.g. http://www.w3.org/1999/xhtml for XHTML 1.0 Qualify element names with URIs: {http://www.w3.org/1999/xhtml}head An Introduction to XML and Web Technologies

The Actual Solution Namespace declarations bind URIs to prefixes <... xmlns:foo="http://www.w3.org/TR/xhtml1"> ... <foo:head>...</foo:head> ... </...> Lexical scope Default namespace (no prefix) declared with xmlns="...“ Attribute names can also be prefixed An Introduction to XML and Web Technologies

Widgets with Namespaces <widget type="gadget" xmlns="http://www.widget.inc"> <head size="medium"/> <big><subwidget ref="gizmo"/></big> <info xmlns:xhtml="http://www.w3.org/TR/xhtml1"> <xhtml:head> <xhtml:title>Description of gadget</xhtml:title> </xhtml:head> <xhtml:body> <xhtml:h1>Gadget</xhtml:h1> A gadget contains a big gizmo </xhtml:body> </info> </widget> Namespace map: for each element, maps prefixes to URIs An Introduction to XML and Web Technologies

Loudly criticise the following collection of recipes and DIY-projects Go!

Summary XML: a notation for hierarchically structured text Conceptual tree model vs. concrete textual representation Well-formedness Namespaces An Introduction to XML and Web Technologies

Essential Online Resources http://www.w3.org/TR/xml11/ http://www.w3.org/TR/xml-names11 http://www.unicode.org/ An Introduction to XML and Web Technologies