0% found this document useful (0 votes)
30 views28 pages

X M L (XML) : E Tensible Arkup Anguage

The document discusses Extensible Markup Language (XML). It begins with an introduction to XML and outlines topics that will be covered, including a comparison of XML and HTML, XML syntax, XML queries and mediators, challenges of XML, and a summary. The bulk of the document then provides details on XML, including its definition, origins, advantages over HTML, authoring XML elements and documents, using document type definitions, and XML query languages.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views28 pages

X M L (XML) : E Tensible Arkup Anguage

The document discusses Extensible Markup Language (XML). It begins with an introduction to XML and outlines topics that will be covered, including a comparison of XML and HTML, XML syntax, XML queries and mediators, challenges of XML, and a summary. The bulk of the document then provides details on XML, including its definition, origins, advantages over HTML, authoring XML elements and documents, using document type definitions, and XML query languages.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 28

EXTENSIBLE MARKUP LANGUAGE (XML)

By:
• ADITHYA R HANDE(R15CS012)
• AJITH SHENOY (R15CS019)
• AMITH SINGH.S(R15CS035)
• ANUPAMA Y(R15CS049)
• ANUSHA D KULAKARNI(R15CS051)

• Submitted To : Prof. Satish GC(School of C&IT)


2/7/2018
REVA UNIVERSITY(SCHOOL OF C&IT)
OUTLINE OF PRESENTATION

• Introduction
• Comparison between XML and HTML
• XML Syntax
• XML Queries and Mediators
• Challenges
• Summary
REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018
WHAT IS XML?

• eXtensible Markup Language


• Markup language for documents containing
structured information
• Defined by four specifications:
• XML, the Extensible Markup Language
• XLL, the Extensible Linking Language
• XSL, the Extensible Style Language
• XUA, the XML User Agent
REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018
XML….

• Based on Standard Generalized Markup Language


(SGML)
• Version 1.0 introduced by World Wide Web
Consortium (W3C) in 1998
• Bridge for data exchange on
the Web

REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018


COMPARISONS

XML HTML
• Extensible set of tags
• Content orientated • Fixed set of tags
• Standard Data • Presentation oriented
infrastructure • No data validation
• Allows multiple output capabilities
forms • Single presentation
REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018
AUTHORING XML ELEMENTS

• An XML element is made up of a start tag, an end tag, and


data in between.
• Example:
<director> Matthew Dunn </director>
• Example of another element with the same value:
<actor> Matthew Dunn </actor>
• XML tags are case-sensitive:
<CITY> <City> <city>
• XML can abbreviate empty elements, for example:
<married> </married> can be abbreviated to
<married/>
REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018
AUTHORING XML ELEMENTS (CONT’D)

• An attribute is a name-value pair separated by an


equal sign (=).
• Example:
<City ZIP=“94608”> Emeryville </City>
• Attributes are used to attach additional,
secondary information to an element.

REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018


AUTHORING XML DOCUMENTS

• A basic XML document is an XML element that can,


but might not, include nested XML elements.
• Example:
<books>
<book isbn=“123”>
<title> Second Chance </title>
<author> Matthew Dunn </author>
</book>
</books>
REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018
XML DATA MODEL: EXAMPLE
<BOOKS>
<book id=“123”
loc=“library”>
BOOKS
<author>Hull</author> book
<title>California</title> loc=“library” article
<year> 1995 </year> ref
123 555
</book>
<article id=“555” ref=“123”>
<author>Su</author> author year author title
<title> Purdue</title>
title
</article>
</BOOKS>
Hull 1995 Su Purdue
California

2/7/2018 REVA UNIVERSITY(SCHOOL OF C&IT)


AUTHORING XML DOCUMENTS
(CONT’D)

• Authoring guidelines:
• All elements must have an end tag.
• All elements must be cleanly nested (overlapping elements are not allowed).
• All attribute values must be enclosed in quotation marks.
• Each document must have a unique first element, the root node.

REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018


AUTHORING XML DATA ISLANDS

• A data island is an XML document that exists


within an HTML page.

• The <XML> element marks the beginning of the


data island, and its ID attribute provides a name
that you can use to reference the data island.

REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018


AUTHORING XML DATA ISLANDS (CONT’D)

• Example:
<XML ID=“XMLID”>
<customer>
<name> Mark Hanson </name>
<custID> 29085 </custID>
</customer>
</XML>
REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018
DOCUMENT TYPE DEFINITIONS (DTD)

• A Document Type Definition (DTD) allows the developer to create a set of


rules to specify legal content and place restrictions on an XML file

• If the XML document does not follow the rules contained within the DTD, a
parser generates an error

• An XML document that conforms to the rules within a DTD is said to be valid

REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018


WHY USE DTD ?

• A single DTD ensures a common format for


each XML document that references it
• An application can use a standard DTD to verify
that data that it receives from the outside
world is valid
• A description of legal, valid data further
contributes to the interoperability and
efficiency of using XML

REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018


CAUTIONS WHILE USING DTD

• All element declarations begin with <!ELEMENT and end with


>
• The ELEMENT declaration is case sensitive
• The programmer must declare all elements within an XML file
• Elements declared with the #PCDATA content model can not
have children
• When describing sequences, the XML document must contain
exactly those elements in exactly that order.

REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018


AN INTERNAL
• <?xml DTD DECLARATION
version="1.0"?>
<!DOCTYPE note [
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018
<body>Don't forget me this weekend</body>
</note>
DTD INTERPRETATION
• !DOCTYPE note defines that the root element of this document is note
• !ELEMENT note defines that the note element must contain four
elements: "to,from,heading,body"
• !ELEMENT to defines the to element to be of type "#PCDATA"
• !ELEMENT from defines the from element to be of type "#PCDATA"
• !ELEMENT heading defines the heading element to be of type
"#PCDATA"
• !ELEMENT body defines the body element to be of type "#PCDATA"

REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018


AN EXTERNAL DTD REFERENCE

• <?xml version="1.0"?>
<!DOCTYPE note SYSTEM "note.dtd">
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018
NOTE.DTD

• <!ELEMENT note (to,from,heading,body)>


<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>

REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018


XML QUERY LANGUAGES

• The first XML query languages


• LOREL (Stanford)
• XQL
• Several other query languages have been developed
(e.g. UNQL, XPath)
• XML-QL considered by W3C for standardization
• Currently W3C is considering and working on a new
query language: XQuery
REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018
A QUERY LANGUAGE FOR
XML: XML-QL
• Developed at AT&T labs
• To extract data from the input XML data
• Has variables to which data is bound and
templates which show how the output XML data
is to be constructed
• Uses the XML syntax
• Based on a where/construct syntax
• Where combines from and where parts of SQL
• Construct corresponds to SQL’s select

REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018


XML-QL QUERY: EXAMPLE 1
• Retrieve all authors of books published by Morgan
Kaufmann:
where <book>
<publisher><name>
Morgan Kaufmann
</name> </publisher>
<title> $T </title>
<author> $A </author>
</book> in “www.a.b.c/bib.xml”
construct <result> $A </result>

REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018


XML-QL QUERY: EXAMPLE 2

• XML-QL query asking for all bookstores that sell The


Java Programming Language for under $25:
where <store>
<name> $N </name>
<book>
<title> The Java Programming Language </title>
<price> $P </price>
</book>
</store> in “www.store/bib.xml”
$P < 25
construct <result> $N </result>

REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018


SEMISTRUCTURED DATA AND MEDIATORS

• Semistructured data is often encountered in data exchange and


integration
• At the sources the data may be structured (e.g. from relational
databases)
• We model the data as semistructured to facilitate exchange and
integration
• Users see an integrated semistructured view that they can query
• Queries are eventually reformulated into queries over the
structured resources (e.g. SQL)
• Only results need to be materialized

REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018


WHAT IS A MEDIATOR ?

• A complex software component that integrates


and transforms data from one or several sources
using a declarative specification

• Two main contexts:


• Data conversion: converts data between two different models

• e.g. by translating data from a relational


database into XML
• Data integration: integrates data from different sources into a common
REVA UNIVERSITY(SCHOOL OF C&IT)
view
2/7/2018
CONVERTING RELATIONAL DATABASE TO XML
Example: Export the following data into XML and group books by
store
• Relational Database:
Store (sid, name, phone)
Book (bid, title, authors)
StoreBook (sid , bid, price, stock)

price stock

name Store StoreBook Book authors

REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018

phone sid title bid


CONVERTING RELATIONAL DATABASE TO XML
(CONT’D)
• XML:
<store> <name> … </name>
<phone> … </phone>
<book> <title>… </title>
<authors> … </authors>
<price> … </price>
</book>
<book>…</book>

</store>

REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018


CHALLENGES FACING XML

• Integration of data sharing

• Security

REVA UNIVERSITY(SCHOOL OF C&IT) 2/7/2018

You might also like