Sie sind auf Seite 1von 23

Extensible Markup Language (XML)

BY: Chandra shekhar soni Roll.no.- (08esscs007) Branch - computer science

Outline of Presentation
Introduction Purpose of XML Comparison between XML and HTML XML Syntax XML Queries and Mediators XML Encryption Challenges

What is XML?
XML stands for Extensible Markup Language XML is a markup language for documents containing structured information XML is a language for describing other languages Documents have tags giving extra information about sections of the document eg-. <title>XML</title> <slide>introduction</slide>

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

Purpose of XML
XML was designed with some goals in mind.
Simple Enough for everyone to learn Broad enough to support Rich Media Should not have any HTML drawbacks Should allow the user to create his own tags should be able to interpret other languages

Comparisons
XML
Extensible set of tags Content orientated Standard Data infrastructure Allows multiple output forms

HTML
Fixed set of tags Presentation oriented No data validation capabilities Single presentation

Elements and Attributes


Elements
An XML element is made up of a start tag, an end tag, and data in between. The start and end tags describe the data in between, which is considered the value of the element. E.g. The following element is a element with the value Boston. <city>Boston</city>

Elements and Attributes


Attributes
An element can optionally contain one or more attributes. An attribute is a name-value pair separated by an equal sign (=) <CITY ZIP=02115>Boston</CITY>
In the above example, CITY ZIP is an attribute of the CITY element

XML Data Model


Example: <BOOKS> <book id=123 loc=library> <author>Hull</author> <title>California</title> <year> 1995 </year> </book> <article id=555 ref=123> <author>Su</author> <title> Purdue</title> </article> </BOOKS>
BOOKS
book loc=library 123 article

ref

555

author

year

author

title

title
1995 California Su Purdue

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

XML-QL Query: Example


Retrieve all authors of books published by verdhmann: where <book> <publisher><name> verdhmann </name> </publisher> <title> $T </title> <author> $A </author> </book> in www.a.b.c/bib.xml construct <result> $A </result>

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 view

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

phone

sid

title

bid

An XML document may have an optional DTD. DTD serves as grammar for the underlying XML document, and it is part of XML language. DTDs are somewhat unsatisfactory, but no consensus exists so far beyond the basic DTDs. DTD has the form: <!DOCTYPE name [markupdeclaration]>

Consider an XML document: <db><person><name>rahul</name> <age>42</age> <email>xyz@1111.net </email> </person> <person></person> . </db>

DTD for it might be: <!DOCTYPE db [ <!ELEMENT db (person*)> <!ELEMENT person (name, age, email)> <!ELEMENT name (#DATA)> <!ELEMENT age (#DATA)> <!ELEMENT email (#DATA)> ]>

Occurrence Indicator:
Indicator (no indicator) ? * + Required Optional Optional, repeatable Required, repeatable Occurrence One and only one None or one None, one, or more One or more

Encryption
Encryption: This ensures that your data was unable to be read or utilized by any party while in transit. Your message is encrypted into incomprehensible gibberish before it leaves your computer. It maintains it encrypted (gibberish) state during it's travel through the Internet. It is not de-crypt until the recipient receives it. Because of the public-key cryptography used (discussed later) only the recipient can decipher the received message, no one else can.

Valid XML
Uses only specific tags and rules as codified by one of:
A document type definition (DTD) A schema definition

Only the tags listed by the schema or DTD can be used Software can take a DTD or schema and verify that a document adheres to the rules Editing software can prevent an author from using anything except allowed tags

Well-Formed XML
Follows general tagging rules: All tags begin and end But can be minimized if empty: <br/> instead of <br></br> All tags are case sensitive All tags must be properly nested: <author> <firstname>Mark</firstname> <lastname>Twain</lastname> </author> All attribute values are quoted: <subject scheme=LCSH>Music</subject> Has identification & declaration tags Software can make sure a document follows these rules

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.

Integration of data sharing

Security

Das könnte Ihnen auch gefallen