Chapter 13 XML Yingcai Xiao.

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

XML: Extensible Markup Language
XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.
XML & Data Structures for the Internet Yingcai Xiao.
SPECIAL TOPIC XML. Introducing XML XML (eXtensible Markup Language) ◦A language used to create structured documents XML vs HTML ◦XML is designed to transport.
Chapter 13 XML Yingcai Xiao. What is XML? What is it for? Examples How to write? How to validate? How to read? How to display? How to format? How to translate?
1 CP3024 Lecture 9 XML revisited, XSL, XSLT, XPath, XSL Formatting Objects.
CS 898N – Advanced World Wide Web Technologies Lecture 21: XML Chin-Chih Chang
©Silberschatz, Korth and Sudarshan10.1Database System Concepts W3C Activities HTML: is the lingua franca for publishing on the Web XHTML: an XML application.
XSL Unit 6 November 2. XSL –eXtensible Stylesheet Language –Basically a stylesheet for XML documents XSL has three parts: –XSLT –XPath –XSL-FO.
XML(EXtensible Markup Language). XML XML stands for EXtensible Markup Language. XML is a markup language much like HTML. XML was designed to describe.
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.
September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof.
Manohar – Why XML is Required Problem: We want to save the data and retrieve it further or to transfer over the network. This.
ECA 228 Internet/Intranet Design I Intro to XSL. ECA 228 Internet/Intranet Design I XSL basics W3C standards for stylesheets – CSS – XSL: Extensible Markup.
Chapter 12 Creating and Using XML Documents HTML5 AND CSS Seventh Edition.
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 XML eXtensible – add to language. Markup – delimit info using tags. Language – a way to express info.
1 XML at a neighborhood university near you Innovation 2005 September 16, 2005 Kwok-Bun Yue University of Houston-Clear Lake.
CREATED BY ChanoknanChinnanon PanissaraUsanachote
Ertan Deniz Instructor.  XML Schema  Document Navigation (Xpath)  Document Transformation (XSLT)
XML eXtensible Markup Language w3c standard Why? Store and transport data Easy data exchange Create more languages WSDL (Web Service Description Language)
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 A Single Entity. xml a single entity Objectives Objectives :  understand the data model  describe the XML Document  describe the XML Schema  describe.
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.
XHTML,XML M.Abdullah Mrian. What is the XHTML Why XHTML ?
These Questions are copied from
Advanced Java Session 9 New York University School of Continuing and Professional Studies.
 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,
Intro. to XML & XML DB Bun Yue Professor, CS/CIS UHCL.
Session IV Chapter 9 – XML Schemas
XML TUTORIAL Portions from w3 schools By Dr. John Abraham.
Lecture 11 XSL Transformations (part 1: Introduction)
Softsmith Infotech XML. Softsmith Infotech XML EXtensible Markup Language XML is a markup language much like HTML Designed to carry data, not to display.
Windows Presentation Foundation (WPF) Chapter 16 Dr. Abraham.
Waqas Anwar Next SlidePrevious Slide. Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language.
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.
Accessing Data Using XML CHAPTER NINE Matakuliah: T0063 – Pemrograman Visual Tahun: 2009.
Jennifer Widom XML Data Introduction, Well-formed XML.
CS 157B: Database Management Systems II February 11 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 1COMP9321, 15s2, Week.
XML A Language Presentation. Outline 1. Introduction 2. XML 2.1 Background 2.2 Structure 2.3 Advantages 3. Related Technologies 3.1 DTD 3.2 Schemas and.
Dom and XSLT Dom – document object model DOM – collection of nodes in a tree.
What is XML? eXtensible Markup Language eXtensible Markup Language A subset of SGML (Standard Generalized Markup Language) A subset of SGML (Standard Generalized.
 XSL – Extensible Style Sheet Language  XSLT – XSL Transformations › Used to transform XML documents to other formats,like HTML or other XML documents.
XSLT: How Do We Use It? Nancy Hallberg Nikki Massaro Kauffman.
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 Notes taken from w3schools. What is XML? XML stands for EXtensible Markup Language. XML was designed to store and transport data. XML was designed.
Beyond HTML: Extensible Markup Language (XML)
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.
.
eXtensible Markup Language
XML: Extensible Markup Language
Unit 4 Representing Web Data: XML
XML Related Technologies
XML QUESTIONS AND ANSWERS
Database Processing with XML
Prepared for Md. Zakir Hossain Lecturer, CSE, DUET Prepared by Miton Chandra Datta
Chapter 7 Representing Web Data: XML
Chapter X IXXXXXXXXXXXXXXXX.
Introduction to XML Extensible Markup Language
XML Data Introduction, Well-formed XML.
More Sample XML By Sadia Anjum.
Extensible Markup Language
Unit 6 - XML Transformations
Presentation transcript:

Chapter 13 XML Yingcai Xiao

What is XML. What is it for. Examples How to write. How to validate What is XML? What is it for? Examples How to write? How to validate? How to read? How to display? How to format? How to translate?

XML Extensible Markup Language. De facto data language. http://www.w3.org/TR/REC-XML. HTML expresses appearance; XML describes data and its structure. Text based (platform-independent). Object-oriented data representation. Has no predefined tags. Provides rules to format data. Many XML parsers already available. Strong XML support in the FCL. .

XML Example (Guitars.xml) <?xml version="1.0"?> <Guitars> <Guitar> <Make>Gibson</Make> <Model>SG</Model> <Year>1977</Year> <Color>Tobacco Sunburst</Color> <Neck>Rosewood</Neck> </Guitar> <Make>Fender</Make> <Model>Stratocaster</Model> <Year></Year> <Color>Black</Color> <Neck>Maple</Neck> </Guitars>

XML Example (Guitars.xml) Document element (root): Guitars. Guitar elements are children of Guitars. Make contain data. Empty element: <Year></Year> Nested elements. The content of an XML document can be viewed as a tree. Attributes <Guitar Year="1977">

XML Description XML Elements: text-based object-oriented data (object) Error checking? Text-based object-oriented type (class) definition? Early days: document type definitions (DTDs). Today: XML Schema Definitions (XSDs). http://www.w3.org/TR/xmlschema-1 http://www.w3.org/TR/xmlschema-2. Schema: a collection of meta data. Meta data: data that describes data. XSD is an XML-based language for describing XML documents and the types that they contain.

Example: Guitars.xsd <?xml version="1.0"?> <xsd:schema id="Guitars" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="Guitars"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> <xsd:element name="Guitar"> <xsd:sequence> <xsd:element name="Make" type="xsd:string" /> <xsd:element name="Model" type="xsd:string" /> <xsd:element name="Year" type="xsd:Year“ minOccurs="0" /> <xsd:element name="Color" type="xsd:string“ minOccurs="0" /> <xsd:element name="Neck" type="xsd:string“ minOccurs="0" /> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:choice> </xsd:schema>

Example: Guitars.xsd Examples\c13\Validate\ Typo => xsd:Year should be xsd:string run.bat Validate Guitars.xml Guitars.xsd run-bad-xml.bat Validate Guitars-Missing-Make.xml Guitars.xsd

XML Parsers Most XML parsers implement one of two popular APIs: DOM or SAX. DOM: Document Object Model http://www.w3.org/TR/DOM-Level-2-Core. SAX: Simple API for XML, unofficial, http://www.saxproject.org. FCL XmlDocument, managed DOM implementation Examples of using XmlDocument: Validate ReadXml XmlView Transform Quotes ExpressAnalyzer

ReadXml.cs (also see XmlView) using System; using System.Xml; class MyApp { static void Main () XmlDocument doc = new XmlDocument (); doc.Load ("Guitars.xml"); XmlNodeList nodes = doc.GetElementsByTagName ("Guitar"); foreach (XmlNode node in nodes) { Console.WriteLine(“Maker {0}; Model {1}", node["Make"].InnerText, node["Model"].InnerText); }

XPath XML Path Language For addressing parts of an XML document. “/Guitars/Guitar” is an XPath expression. http://www.w3.org/TR/xpath.

XSL XSL is a language for expressing style sheets. Adopted from CSS, a file that describes how to display an XML document of a given type. Styling requires a source XML documents, containing the information that the style sheet will display and the style sheet itself which describes how to display a document of a given type. It supports: Formatting Objects. It also adds a transformation language for XML documents: XSLT. Examples\c13\Quotes\Quotes.xsl http://winserv1.cs.uakron.edu/Examples/C13/Quotes/quotes.aspx

XSL Transformations (XSLT) Extensible Stylesheet Language Transformations. Converting XML documents into HTML documents. Converting HTML documents into other XML documents. Examples\c13\Transform\Transform.cs http://winserv1.cs.uakron.edu/Examples/C13/Transform/Quotes.html