Unit 4 Representing Web Data: XML

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

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.
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.
1 CP3024 Lecture 9 XML revisited, XSL, XSLT, XPath, XSL Formatting Objects.
Chapter 10 © 2001 by Addison Wesley Longman, Inc. 1 Chapter 10 Sebesta: Programming the World Wide Web.
Creating a Well-Formed Valid Document. 2 Objectives Introducing XHTML Creating a Well-Formed Document Creating a Valid Document Creating an XHTML Document.
26-Jun-15 XML. 2 HTML and XML, I XML stands for eXtensible Markup Language HTML is used to mark up text so it can be displayed to users XML is used to.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
Tutorial 11 Creating XML Document
COS 381 Day 14. Agenda Questions?? Resources Source Code Available for examples in Text Book in Blackboard
COS 381 Day 16. Agenda Assignment 4 posted Due April 1 There was no resubmits of Assignment Capstone Progress report Due March 24 Today we will discuss.
Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Fundamentals of Web DevelopmentRandy.
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.
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.
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.
XML Anisha K J Jerrin Thomas. Outline  Introduction  Structure of an XML Page  Well-formed & Valid XML Documents  DTD – Elements, Attributes, Entities.
Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.
XML eXtensible Markup Language by Darrell Payne. Experience Logicon / Sterling Federal C, C++, JavaScript/Jscript, Shell Script, Perl XML Training XML.
XML CPSC 315 – Programming Studio Fall 2008 Project 3, Lecture 1.
Representing Web Data: XML CSI 3140 WWW Structures, Techniques and Standards.
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.
XML What is XML? XML v.s. HTML XML Components Well-formed and Valid Document Type Definition (DTD) Extensible Style Language (XSL) SAX and DOM.
1 © Netskills Quality Internet Training, University of Newcastle Introducing XML © Netskills, Quality Internet Training University.
XML 1 Enterprise Applications CE00465-M XML. 2 Enterprise Applications CE00465-M XML Overview Extensible Mark-up Language (XML) is a meta-language that.
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.
Representing Web Data: XML CSI 3140 WWW Structures, Techniques and Standards.
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.
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 Dr Alexiei Dingli XML Technologies XML Advanced.
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter X IXXXXXXXXXX XXXXXX.
Softsmith Infotech XML. Softsmith Infotech XML EXtensible Markup Language XML is a markup language much like HTML Designed to carry data, not to display.
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.
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.
17 Apr 2002 XML Syntax: Documents Andy Clark. Basic Document Structure Element tags – Elements have associated attributes Text content Miscellaneous –
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.
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 Basics A brief introduction to XML in general 1XML Basics.
1 Tutorial 11 Creating an XML Document Developing a Document for a Cooking Web Site.
1 herbert van de sompel CS 502 Computing Methods for Digital Libraries Cornell University – Computer Science Herbert Van de Sompel
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 1COMP9321, 15s2, Week.
Web Technologies Lecture 4 XML and XHTML. XML Extensible Markup Language Set of rules for encoding a document in a format readable – By humans, and –
When we create.rtf document apart from saving the actual info the tool saves additional info like start of a paragraph, bold, size of the font.. Etc. This.
C Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Introduction to XML Standards.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
CHAPTER NINE Accessing Data Using XML. McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Introduction The eXtensible.
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.
1 Extensible Stylesheet Language (XSL) Extensible Stylesheet Language (XSL)
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
XML in Web Technologies
Database Processing with XML
Introduction to XML Mr. Majed Bouchahma
The XML Language.
XML Technologies and Related Applications
Chapter 7 Representing Web Data: XML
Roy Tennant California Digital Library
Chapter X IXXXXXXXXXXXXXXXX.
Tutorial 9 Working with XHTML
Introduction to XML Mr. Majed Bouchahma
Allyson Falkner Spokane County ISD
Review of XML IST 421 Spring 2004 Lecture 5.
Extensible Markup Language (XML)
Presentation transcript:

Unit 4 Representing Web Data: XML

XML Example XML document: An XML document is one that follows certain syntax rules (most of which we followed for XHTML)

XML Syntax An XML document consists of Markup Tags, which begin with < and end with > References, which begin with & and end with ; Character, e.g. Entity, e.g. < The entities lt, gt, amp, apos, and quot are recognized in every XML document. Other XHTML entities, such as nbsp, are only recognized in other XML documents if they are defined in the DTD Character data: everything not markup

XML Syntax Comments CDATA section Begin with <!-- End --> Must not contain – CDATA section Special element the entire content of which is interpreted as character data, even if it appears to be markup Begins with <![CDATA[ Ends with ]]> (illegal except when ending CDATA)

XML Syntax The CDATA section is equivalent to the markup

XML Syntax < and & must be represented by references except When beginning markup Within comments Within CDATA sections

XML Syntax Element tags and elements Three types Start, e.g. <message> End, e.g. </message> Empty element, e.g. <br /> Start and end tags must properly nest Corresponding pair of start and end element tags plus everything in between them defines an element Character data may only appear within an element

XML Syntax Start and empty-element tags may contain attribute specifications separated by white space Syntax: name = quoted value quoted value must not contain <, can contain & only if used as start of reference quoted value must begin and end with matching quote characters (‘ or “)

XML Syntax Element and attribute names are case sensitive XML white space characters are space, carriage return, line feed, and tab

XML Documents A well-formed XML document follows the XML syntax rules and has a single root element Well-formed documents have a tree structure Many XML parsers (software for reading/writing XML documents) use tree representation internally

XML Documents An XML document is written according to an XML vocabulary that defines Recognized element and attribute names Allowable element content Semantics of elements and attributes XHTML is one widely-used XML vocabulary Another example: RSS (rich site summary)

XML Documents

XML Documents

XML Documents Valid names and content for an XML vocabulary can be specified using Natural language XML DTDs (Chapter 2) XML Schema (Chapter 9) If DTD is used, then XML document can include a document type declaration:

XML Documents Two types of XML parsers: Validating Non-validating Requires document type declaration Generates error if document does not Conform with DTD and Meet XML validity constraints Example: every attribute value of type ID must be unique within the document Non-validating Checks for well-formedness Can ignore external DTD

XML Documents Good practice to begin XML documents with an XML declaration Minimal example: If included, < must be very first character of the document To override default UTF-8/UTF-16 character encoding, include encoding declaration following version:

XML Namespaces XML Namespace: Collection of element and attribute names associated with an XML vocabulary Namespace Name: Absolute URI that is the name of the namespace Ex: http://www.w3.org/1999/xhtml is the namespace name of XHTML 1.0 Default namespace for elements of a document is specified using a form of the xmlns attribute:

XML Namespaces Another form of xmlns attribute known as a namespace declaration can be used to associate a namespace prefix with a namespace name: Namespace prefix Namespace declaration

XML Namespaces Example use of namespace prefix:

XML Namespaces In a namespace-aware XML application, all element and attribute names are considered qualified names A qualified name has an associated expanded name that consists of a namespace name and a local name Ex: item is a qualified name with expanded name <null, item> Ex: xhtml:a is a qualified name with expanded name <http://www.w3.org/1999/xhtml, a>

XML Namespaces Other namespace usage: A namespace can be declared and used on the same element

XML Namespaces Other namespace usage: A namespace prefix can be redefined for an element and its content These elements belong to http://www.example.org/namespace

JavaScript and XML JavaScript DOM can be used to process XML documents JavaScript XML Dom processing is often used with XMLHttpRequest Host object that is a constructor for other host objects Sends an HTTP request to server, receives back an XML document

JavaScript and XML Example use: Previous visit count servlet: must reload document to see updated count Visit count with XMLHttpRequest: browser will automatically update the visit count periodically without reloading the entire page

JavaScript and XML Ajax: Asynchronous JavaScript and XML Combination of (X)HTML XML CSS JavaScript JavaScript DOM (HTML and XML) XMLHttpRequest in ansynchronous mode

Java-based DOM Java DOM API defined by org.w3c.dom package Semantically similar to JavaScript DOM API, but many small syntactic differences Nodes of DOM tree belong to classes such as Node, Document, Element, Text Non-method properties accessed via methods Ex: parentNode accessed by calling getParentNode()

Java-based DOM Methods such as getElementsByTagName() return instance of NodeList getLength() method returns # of items item() method returns an item

Java-based DOM Default parser is non-validating and non-namespace-aware.

XSL The Extensible Stylesheet Language (XSL) is an XML vocabulary typically used to transform XML documents from one form to another form XSL document Input XML document XSLT Processor Output XML document

XSL Components of XSL: XSL Transformations (XSLT): defines XSL namespace elements and attributes XML Path Language (XPath): used in many XSL attribute values (ex: child::message) XSL Formatting Objects (XSL-FO): XML vocabulary for defining document style (print-oriented)

XML and Browsers An XML document can contain a processing instruction telling a browser to: Apply XSLT to create an XHTML document:

XML and Browsers An XML document can contain a processing instruction telling a browser to: Apply CSS to style the XML document: