XML – Basic Concepts (modified version from Dr. Praveen Madiraju)

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.
1 DTD (Document Type Definition) Imposing Structure on XML Documents (W3Schools on DTDs)W3Schools on DTDs.
1 XML Data Management 2. XML Syntax Werner Nutt. 2 HTML Designed for publishing hypertext on the Web Describes how a browser should arrange text, images,
1 Lecture 10 XML Wednesday, October 18, XML Outline XML (4.6, 4.7) –Syntax –Semistructured data –DTDs.
1 COS 425: Database and Information Management Systems XML and information exchange.
XML eXtensible Markup Language.
1 Lecture 08: XML and Semistructured Data. 2 Outline XML (Section 17) –XML syntax, semistructured data –Document Type Definitions (DTDs) XPath.
Introduction to XML This material is based heavily on the tutorial by the same name at
1 Advanced Topics XML and Databases. 2 XML u Overview u Structure of XML Data –XML Document Type Definition DTD –Namespaces –XML Schema u Query and Transformation.
4/20/2017.
XML – Extensible Markup Language Sivakumar Kuttuva & Janusz Zalewski.
Pemrograman Berbasis WEB XML part 2 -Aurelio Rahmadian- Sumber: w3cschools.com.
XML Anisha K J Jerrin Thomas. Outline  Introduction  Structure of an XML Page  Well-formed & Valid XML Documents  DTD – Elements, Attributes, Entities.
Lecture 6 of Advanced Databases XML Schema, Querying & Transformation Instructor: Mr.Ahmed Al Astal.
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.
CISC 3140 (CIS 20.2) Design & Implementation of Software Application II Instructor : M. Meyer Address: Course Page:
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.
 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.
XML TUTORIAL Portions from w3 schools By Dr. John Abraham.
Avoid using attributes? Some of the problems using attributes: Attributes cannot contain multiple values (child elements can) Attributes are not easily.
1 Chapter 10: XML What is XML What is XML Basic Components of XML Basic Components of XML XPath XPath XQuery XQuery.
XML - DTD Week 4 Anthony Borquez. What can XML do? provides an application independent way of sharing data. independent groups of people can agree to.
Waqas Anwar Next SlidePrevious Slide. Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language.
XML Instructor: Charles Moen CSCI/CINF XML  Extensible Markup Language  A set of rules that allow you to create your own markup language  Designed.
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.
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,
1 Indexing The syntax for creating a index is: CREATE [UNIQUE] INDEX index_name ON table_name (column1, column2,... column_n) [ COMPUTE STATISTICS ]; Why.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 1COMP9321, 15s2, Week.
+ 1 XML eXtensible Markup Language. + 2 XML Lecture Adapted from the work of Dr. Praveen Madiraju of Marquette University.
SEMI-STRUCTURED DATA (XML) 1. SEMI-STRUCTURED DATA ER, Relational, ODL data models are all based on schema Structure of data is rigid and known is advance.
XML – Basic Concepts (modified version from Dr. Praveen Madiraju) 2015, Fall Pusan National University Ki-Joune Li.
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 XML eXtensible Markup Language. 2 Introduction and Motivation Dr. Praveen Madiraju Modified from Dr.Sagiv’s slides.
XML eXtensible Markup 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.
COMP9321 Web Application Engineering Semester 1, 2017
XML University Of Benghazi IT Faculty Computer Networks and Communications Department Introduction to Internet Programming(CN281)
Unit 4 Representing Web Data: XML
Creating a Well-Formed Valid Document
XML QUESTIONS AND ANSWERS
2017, Fall Pusan National University Ki-Joune Li
By HITESHWAR KUMAR AZAD Ph.D Scholar
XML stands for Extensible Markup Language.
Chapter 7 Representing Web Data: XML
Introduction to XML.
XML Introduction By Hongming Yu Feb 6th, 2002.
7. מבוא למסמכי XML ו-DTD (מבוסס על שקפים של אלדר פישר)
eXtensible Markup Language (XML)
Semi-Structured data (XML Data MODEL)
Javascript & jQuery XML.
What is XML?.
Lecture 9: XML Monday, October 17, 2005.
CMP 051 XML Introduction Session IV Chapter 12 – XML Namespaces
DTD (Document Type Definition)
eXtensible Markup Language
CSE591: Data Mining by H. Liu
Allyson Falkner Spokane County ISD
Introduction to Database Systems CSE 444 Lecture 10 XML
CMP 051 XML Introduction Session IV Chapter 12 – XML Namespaces
Semi-Structured data (XML)
eXtensible Markup Language XML
XML: The new standard -Eric Taylor.
Presentation transcript:

XML – Basic Concepts (modified version from Dr. Praveen Madiraju) 2018, Fall Pusan National University Ki-Joune Li

W3SCHOOLS.COM a very nice material is found at http://www.w3schools.com/xml/xml_syntax.asp

XML vs. HTML HTML is a HyperText Markup language Designed for a specific application, namely, presenting and linking hypertext documents XML describes structure and content (“semantics”) The presentation is defined separately from the structure and the content

An Address Book as an XML document <addresses> <person> <name> Donald Duck</name> <tel> 414-222-1234 </tel> <email> donald@yahoo.com </email> </person> <name> Miki Mouse</name> <tel> 123-456-7890 </tel> <email>miki@yahoo.com</email> </addresses>

Main Features of XML No fixed set of tags New tags can be added for new applications An agreed upon set of tags can be used in many applications Namespaces facilitate uniform and coherent descriptions of data For example, a namespace for address books determines whether to use <tel> or <phone>

Main Features of XML (cont’d) XML has the concept of a schema DTD and the more expressive XML Schema XML is a data model Similar to the semistructured data model cf. DB Schema XML supports internationalization (Unicode) and platform independence (an XML file is just a character file)

XML is the Standard for Data Exchange Web services (e.g., ecommerce) require exchanging data between various applications that run on different platforms XML (augmented with namespaces) is the preferred syntax for data exchange on the Web

XML is not Alone XML Schemas strengthen the data-modeling capabilities of XML (in comparison to XML with only DTDs) XPath is a language for accessing parts of XML documents XLink and XPointer support cross-references XSLT is a language for transforming XML documents into other XML documents (including XHTML, for displaying XML files) Limited styling of XML can be done with CSS alone XQuery is a lanaguage for querying XML documents

The Two Facets of XML Some XML files are just text documents with tags that denote their structure and include some metadata (e.g., an attribute that gives the name of the person who did the proofreading) See an example on the next slide XML is a subset of SGML (Standard Generalized Markup Language) Other XML documents are similar to database files (e.g., an address book)

XML can Describe the Structure of a Document <book year="1994"> <title>TCP/IP Illustrated</title> <author> <last>Stevens</last> <first>W.</first> </author> <publisher>Addison-Wesley</publisher> <price>65.95</price> </book>

W3Schools Resources on XML Syntax

The Structure of XML XML consists of tags and text Tags come in pairs <date> ... </date> They must be properly nested good <date> ... <day> ... </day> ... </date> bad <date> ... <day> ... </date>... </day> (You can’t do <i> ... <b> ... </i> ...</b> in HTML)

A Useful Abbreviation Abbreviating elements with empty contents: <br/> for <br></br> <hr width=“10”/> for <hr width=“10”></hr> For example: <family> <person id = “lisa”> <name> Lisa Simpson </name> <mother idref = “marge”/> <father idref = “homer”/> </person> ... </family> Note that a tag may have a set of attributes, each consisting of a name and a value

XML Text XML has only one “basic” type – text It is bounded by tags, e.g., <title> The Big Sleep </title> <year> 1935 </ year> – 1935 is still text XML text is called PCDATA (for parsed character data)

XML Structure Nesting tags can be used to express various structures, e.g., a tuple (record): <person> <name> Lisa Simpson</name> <tel> 02-828-1234 </tel> <tel> 054-470-777 </tel> <email> lisa@cs.huji.ac.il </email> </person>

XML Structure (cont’d) We can represent a list by using the same tag repeatedly: <addresses> <person> … </person> … </addresses>

XML Structure (cont’d) <addresses> <person> <name> Donald Duck</name> <tel> 04-828-1345 </tel> <email> donald@cs.technion.ac.il </email> </person> <name> Miki Mouse</name> <tel> 03-426-1142 </tel> <email>miki@yahoo.com</email> </addresses>

Terminology The segment of an XML document between an opening and a corresponding closing tag is called an element element element, a sub-element of <person> <name> Bart Simpson </name> <tel> 02 – 444 7777 </tel> <tel> 051 – 011 022 </tel> <email> bart@tau.ac.il </email> </person>

An XML Document is a Tree person name tel tel email Bart Simpson 051 – 011 022 02 – 444 7777 bart@tau.ac.il Leaves are either empty or contain PCDATA

Mixed Content <airline> An element may contain a mixture of sub-elements and PCDATA <airline> <name> British Airways </name> <motto> World’s <dubious> favorite</dubious> airline </motto> </airline>

XML Attributes XML elements can have attributes, just like HTML: Attributes are designed to contain data related to a specific element. Must be quoted Example <person gender="female"> Attributes vs. Elements: Example <person>   <gender>female</gender> </person> To consider attributes cannot contain multiple values (elements can) attributes cannot contain tree structures (elements can) attributes are not easily expandable (for future changes)

XML Attributes as Metadata <messages>   <note id="501">     <to>Tove</to>     <from>Jani</from>     <heading>Reminder</heading>     <body>Don't forget me this weekend!</body>   </note>   <note id="502">     <to>Jani</to>     <from>Tove</from>     <heading>Re: Reminder</heading>     <body>I will not</body>   </note> </messages>

XML Namespaces Using a Prefix  leads to a conflict <table>   <tr>     <td>Apples</td>     <td>Bananas</td>   </tr> </table> <table>   <name>African Table </name>   <width>80</width>   <length>120</length> </table>  leads to a conflict Using a Prefix <root  xmlns:h="http://www.w3.org/TR/html4/" xmlns:f="http://www.w3schools.com/furniture"> <h:table>   <h:tr>     <h:td>Apples</h:td>     <h:td>Bananas</h:td>   </h:tr> </h:table> <f:table>   <f:name>African Coffee</f:name>   <f:width>80</f:width>   <f:length>120</f:length> </f:table> </root>

The Header Tag <?xml version="1.0" standalone="yes/no" encoding="UTF-8"?> Standalone=“no” means that there is an external DTD You can leave out the encoding attribute and the processor will use the UTF-8 default

Processing Instructions <?xml version="1.0"?> <?xml-stylesheet  href="doc.xsl" type="text/xsl"?> <!DOCTYPE doc SYSTEM "doc.dtd"> <doc>Hello, world!<!-- Comment 1 --></doc> <?pi-without-data?> <!-- Comment 2 --> <!-- Comment 3 -->

Well-Formed XML Documents An XML document (with or without a DTD) is well- formed if Tags are syntactically correct Every tag has an end tag Tags are properly nested There is a root tag A start tag does not have two occurrences of the same attribute An XML document must be well formed

Representing relational databases A relational database for school: student: course: enroll:

XML representation of relational DB <school> <student id=“001”> <name> Joe </name> <gpa> 3.0 </gpa> </student> <student id=“002”> <name> Mary </name> <gpa> 4.0 </gpa> <course cno=“331”> <title> DB </title> <credit> 3.0 </credit> </course> <course cno=“350”> <title> Web </title> <credit> 3.0 </credit> <enroll> <id> 001 </id> <cno> 331 </cno> </enroll> <id> 001 </id> <cno> 350 </cno> <id> 002 </id> <cno> 331 </cno> </school>