eXtensible Markup Language

Slides:



Advertisements
Similar presentations
XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.
Advertisements

An Introduction to XML Based on the W3C XML Recommendations.
3 November 2008CIS 340 # 1 Topics To define XML as a technology To place XML in the context of system architectures.
XML(EXtensible Markup Language). XML XML stands for EXtensible Markup Language. XML is a markup language much like HTML. XML was designed to describe.
Tutorial 11 Creating XML Document
Copyright © 2003 Pearson Education, Inc. Slide 2-1 Created by Cheryl M. Hughes, Harvard University Extension School — Cambridge, MA The Web Wizard’s Guide.
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.
Why XML ? Problems with HTML HTML design - HTML is intended for presentation of information as Web pages. - HTML contains a fixed set of markup tags. This.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Schemas Ellen Pearlman Eileen Mullin Programming the Web Using XML.
XML CPSC 315 – Programming Studio Fall 2008 Project 3, Lecture 1.
An Introduction to XML Presented by Scott Nemec at the UniForum Chicago meeting on 7/25/2006.
1 herbert van de sompel CS 502 Computing Methods for Digital Libraries Cornell University – Computer Science Herbert Van de Sompel
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.
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.
XML Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language.
 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,
Avoid using attributes? Some of the problems using attributes: Attributes cannot contain multiple values (child elements can) Attributes are not easily.
How do I use HTML and XML to present information?.
1 Chapter 10: XML What is XML What is XML Basic Components of XML Basic Components of XML XPath XPath XQuery XQuery.
Of 33 lecture 3: xml and xml schema. of 33 XML, RDF, RDF Schema overview XML – simple introduction and XML Schema RDF – basics, language RDF Schema –
XML 2nd EDITION Tutorial 1 Creating An Xml Document.
XML Documents Chao-Hsien Chu, Ph.D. School of Information Sciences and Technology The Pennsylvania State University Elements Attributes Comments PI Document.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 27 XML: Extensible Markup Language.
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
Web Technologies COMP6115 Session 4: Adding a Database to a Web Site Dr. Paul Walcott Department of Computer Science, Mathematics and Physics University.
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.
Jeff Ullman: Introduction to XML 1 XML Semistructured Data Extensible Markup Language Document Type Definitions.
An Introduction to XML Sandeep Bhattaram
XML Introduction. What is XML? XML stands for eXtensible Markup Language XML stands for eXtensible Markup Language XML is a markup language much like.
The eXtensible Markup Language (XML). Presentation Outline Part 1: The basics of creating an XML document Part 2: Developing constraints for a well formed.
1 Tutorial 11 Creating an XML Document Developing a Document for a Cooking Web Site.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2.
225 City Avenue, Suite 106 Bala Cynwyd, PA , phone , fax presents… XML Syntax v2.0.
Structured Documents - XML and FrameMaker 7 Asit Pant.
Representing data with XML SE-2030 Dr. Mark L. Hornick 1.
Introduction to DTD A Document Type Definition (DTD) defines the legal building blocks of an XML document. It defines the document structure with a list.
XML DTD. XML Validation XML with correct syntax is "Well Formed" XML. XML validated against a DTD is "Valid" XML.
XML CORE CSC1310 Fall XML DOCUMENT XML document XML document is a convenient way for parsers to archive data. In other words, it is a way to describe.
Introduction to XML Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
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.
Web Services: Principles & Technology Slide 3.1 Chapter 3 Brief Overview of XML COMP 4302/6302.
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.
Unit 4 Representing Web Data: XML
G52IWS: Extensible Markup Language (XML)
Extensible Markup Language XML
XML QUESTIONS AND ANSWERS
Well-formed and Valid XML Documents
Extensible Markup Language XML
The XML Language.
Chapter 7 Representing Web Data: XML
Creating an XML Document
Introduction to XML: Part I
Web Programming Maymester 2004
Introduction to XML Extensible Markup Language
XML Data Introduction, Well-formed XML.
XML Data DTDs, IDs & IDREFs.
What is XML?.
Extensible Markup Language
Lecture 9: XML Monday, October 17, 2005.
Lecture 8: XML Data Wednesday, October
XML Schema Primer Seong Jong Choi Multimedia Lab.
CSE591: Data Mining by H. Liu
CH 20 XML Schema.
Allyson Falkner Spokane County ISD
Review of XML IST 421 Spring 2004 Lecture 5.
XML IST 421.
Presentation transcript:

eXtensible Markup Language XML eXtensible Markup Language

Extensible Markup Language XML is another format (similar to JSON) that is meant to convey semi-structured data. HTML (used in webpages) is a subset of XML. Heavily used in web services and inter-database communications. Often used for text document formatting Microsoft Office OpenOffice.org / LibreOffice Apple's iWork Also often used in configuration files.

XML Tags and Elements Tags come in 3 types: start-tags (e.g. <section>) end-tags (e.g. </section>) empty-element tags (e.g. <section />) An element consist of a start-tag, optional content (which may be text or other elements), and a matching end-tag. Or, an element is just a empty-element tag. Example elements: <head></head> <h> Hi <p /></h> <h />

XML Attributes Attributes are name/value pairs within a start-tag or empty-element tag. There can be only one value in each pair, so multiple values are combined (often as a space-delimited string). Example attributes: <person name="josh"></person> <work loc="BPS Engineering" />

Well-Formed XML The document contains only properly encoded legal Unicode characters None of the special syntax characters such as < and & appear except when performing their markup-delineation roles The begin, end, and empty-element tags that delimit the elements are correctly nested, with none missing and none overlapping The element tags are case- sensitive; the beginning and end tags must match exactly. Tag names cannot contain any of the characters !"#$%&'()*+,/;<=>?@[\]^`{| }~, nor a space character, and cannot start with -,., or a numeric digit. A single "root" element contains all the other elements.

XML Internal Representation What data structures would you use to represent an XML document: Graph Tree Hash table List

DTD - Document Type Definition A DTD defines what is "valid" XML data for a particular purpose. It defines what are allowable tags and the grammar for how they can be used. Details can be found here: http://www.w3schools.com/xml/ xml_dtd_intro.asp Special DTD components: (#PCDATA) - Parsed character data - Text content that has special characters(<&) escaped. CDATA - Unparsed character data EMPTY - empty-element tag, no content allowed.

Document Type Definition <!ELEMENT bookstore (name,topic+)> Valid XML <bookstore> <name>Josh's Store</name> <topic> <name>XML</name> <book isbn="123-456-789"> <title>Josh's Guide To DTD's and XML Schemas</title> <author>Josh</author> </book> </topic> </bookstore> Document Type Definition <!ELEMENT bookstore (name,topic+)> <!ELEMENT topic (name,book*)> <!ELEMENT name (#PCDATA)> <!ELEMENT book (title,author)> <!ELEMENT title (#PCDATA)> <!ELEMENT author (#PCDATA)> <!ATTLIST book isbn CDATA #REQUIRED>

XML Schemas Schemas are a much more powerful way to describe an XML documents structure and limitations. They are written in XML and can even have DTDs and XML schemas of their own. They provide a basic set of types that are more descriptive than PCDATA / CDATA. Detail can be found here: http://www.w3schools.com/xml/xml_sch ema.asp Basic types (integer, byte, string, floating-point number) can be combined into complex types that are used to define an element. Let's build an XML schema to match our previous bookstore example.

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> Valid XML <bookstore> <name>Josh's Store</name> <topic> <name>XML</name> <book isbn="123-456-789"> <title>Josh's Guide To DTD's and XML Schemas</title> <author>Josh</author> </book> </topic> </bookstore> XML Schema <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:annotation> <xsd:documentation xlm:lang="en"> XML Schema for a Bookstore as an example. </xsd:documentation> </xsd:annotation>

<xsd:element name="bookstore" type="bookstoreType"/> Valid XML <bookstore> <name>Josh's Store</name> <topic> <name>XML</name> <book isbn="123-456-789"> <title>Josh's Guide To DTD's and XML Schemas</title> <author>Josh</author> </book> </topic> </bookstore> XML Schema ... <xsd:element name="bookstore" type="bookstoreType"/> <xsd:complexType name="bookstoreType"> <xsd:sequence> <xsd:element name="name" type="xsd:string"/> <xsd:element name="topic" type="topicType" minOccurs="1"/> </xsd:sequence> </xsd:complexType>

<xsd:complexType name="topicType"> <xsd:element name="name" Valid XML <bookstore> <name>Josh's Store</name> <topic> <name>XML</name> <book isbn="123-456-789"> <title>Josh's Guide To DTD's and XML Schemas</title> <author>Josh</author> </book> </topic> </bookstore> XML Schema ... <xsd:complexType name="topicType"> <xsd:element name="name" type="xsd:string"/> <xsd:element name="book" type="bookType" minOccurs="0"/> </xsd:complexType>

<xsd:complexType name="bookType"> <xsd:element name="title" Valid XML <bookstore> <name>Josh's Store</name> <topic> <name>XML</name> <book isbn="123-456-789"> <title>Josh's Guide To DTD's and XML Schemas</title> <author>Josh</author> </book> </topic> </bookstore> XML Schema ... <xsd:complexType name="bookType"> <xsd:element name="title" type="xsd:string"/> <xsd:element name="author" <xsd:attribute name="isbn" type="isbnType"/> </xsd:complexType> <xsd:simpleType name="isbnType"> <xsd:restriction base="xsd:string"> <xsd:pattern value="[0-9]{3}[-][0-9]{3}[-][0-9]{3}"/> </xsd:restriction> </xsd:simpleType>

Schema versus DTD When should you use an XML Schema instead of an XML DTD? Data Typing Validation Speed Occurrence Contraints Always