SlideShare una empresa de Scribd logo
1 de 57
XML Mukesh N Tekwani tekwani@email.com www.myexamnotes.com
Disadvantages of HTML – Need for XML ,[object Object]
HTML lacks structure
HTML is not suitable for data interchange
HTML is not context aware – HTML does not allow us to describe the information content or the semantics of the document
HTML is not object-oriented
HTML is not re-usable
HTML is not extensible,[object Object]
Extensible – capable of being extended
Markup – it is a way of adding information to the text indicating the logical components of a document
How is it different from HTML?
HTML was designed to display data
XML was designed to store, describe and transport data
XML is also a markup language like HTML
XML tags are not predefined – we must design our own tags.,[object Object]
Advantages (Features) of XML - 1 XML simplifies data sharing Since XML data is stored in plain text format, data can be easily shared among different hardware and software platforms. XML separates data from HTML To display dynamic data in HTML, the code must be rewritten each time the data changes. With XML, data can be stored in separate files so that whenever the data changes it is automatically displayed correctly. We have to design the HTML for layout only once.
Advantages (Features) of XML - 2 ,[object Object]
With XML, data can be easily exchanged between different platforms.
XML makes data more available
Since XML is independent of hardware, software and application, XML can make your data more available and useful.
Different applications can access your data in HTML pages
XML provides a means to package almost any type of information (binary, text, voice, video) for delivery to a receiving end.,[object Object]
Applications of XML File Converters Many applications have been written to convert existing documents into the XML standard. An example is a PDF to XML converter.  Cell Phones - XML data is sent to some cell phones. This data is then formatted to display text or images, and even to play sounds! VoiceXML - Converts XML documents into an audio format so that you can listen to an XML document.
XML Document – Example 1 <?xml version="1.0" encoding="ISO-8859-1"?> <class_list> <student> <name>Anamika</name> <grade>A+</grade> </student> <student> <name>Veena</name> <grade>B+</grade> </student> </class_list>
XML Document–Example 1 - Explained ,[object Object]
<?xml version="1.0" encoding="ISO-8859-1"?>
It defines the XML version (1.0)
It gives the encoding used (ISO-8859-1 = Latin-1/West European character set)
The XML declaration is actually a processing instruction (PI) an it is identified by the ? At its start and end
The next line describes the root element of the document (like saying: "this document is a class_list“)
The next 2 lines describe 2 child elements of the root (student, name, and grade)
And finally the last line defines the end of the root element: </class_list>,[object Object]
Tree structure ,[object Object]
XML documents must contain a root element. This element is "the parent" of all other elements.
The elements in an XML document form a document tree. The tree starts at the root and branches to the lowest level of the tree.
All elements can have sub elements (child elements)
<root>	<child>		<subchild>.....</subchild>	</child></root,[object Object]
XML – Example 2 <bookstore> 	<book category = "COOKING">	<title lang = "en">Everyday Italian</title>	<author>Giada De Laurentiis</author>	<year>2005</year>	<price>30.00</price></book> 	<book category = "CHILDREN">	<title lang = "en">Harry Potter</title>	<author>J K. Rowling</author>	<year>2005</year>	<price>29.99</price></book> 	<book category = "WEB">	<title lang = "en">Learning XML</title>	<author>Erik T. Ray</author>	<year>2003</year>	<price>39.95</price></book> </bookstore>
Important Definitions XML Element An element is a start tag, content, and an end tag. E.g.,  <greeting>”Hello World</greeting>  XML Attribute An attribute provides additional information about elements E.g., <note priority = “high”>
Important Definitions Child elements – XML elements may have child elements <employee id = “100”> 	<name> 		<first>Anita</first> 		<initial>D</initial> 		<last>Singh</last>		 	</name> </employee> Parent Element Name Children of parent element
XML Element An XML element is everything from the element's start tag to the element's end tag. An element can contain other elements, simple text or a mixture of both.  Elements can also have attributes.
XML Syntax Rules All XML elements must have a closing tag XML tags are case sensitive.  The tag <Book> is different from the tag <book> Opening and closing tags must be written with the same case 	<Message>This is incorrect</message><message>This is correct</message>
XML Syntax Rules ,[object Object]
HTML permits this:<B><I>This text is bold and italic</B></I> 	But in XML this is invalid. All elements must be properly nested within one another. <B><I>This text is bold and italic</I></B> ,[object Object],<root> 	<child>	<subchild>.....</subchild></child> </root>
XML Syntax Rules XML Entity References Some characters have a special meaning in XML. E.g., If you place a character like "<" inside an XML element, it will generate an error because the parser interprets it as the start of a new element. <message>if salary < 1000 then </message> To avoid this error, replace the "<" character with an entity reference: <message>if salary &lt; 1000 then</message>
XML Syntax Rules XML Entity References There are 5 predefined entity references in XML:
XML Syntax Rules ,[object Object],	<!-- This is a comment -->  ,[object Object]
XML Naming Rules
Names can contain letters, numbers, and other characters
Names cannot start with a number or punctuation character
Names cannot start with the letters xml (or XML, or Xml, etc)
Names cannot contain spaces
Any name can be used, no words are reserved.,[object Object]
Different Types of XML Markups 5 Types of Markup in XML Elements Entities Comments Processing Instructions Ignored Sections
Element Markup Element Markup It is composed of 3 parts: start tag, the content, and the end tag. Example:  <name>Neetu</name> The start tag and the end tag can be treated as wrappers The element name that appears in the start tag must be exactly the same as the name that appears in the end tag. Example:  <Name>Neetu</name>
Different Types of XML Markups Attribute Markup Attributes are used to attach information to the information contained in an element. General syntax for attributes is: <elementname property = ‘value’> 			Or <elementname property = “value”> Attribute value must be enclosed within quotation marks Use either single quotes or double quotes but don’t mix them.
Attribute Markup If we specify the attributes for the same element more than once, the specifications are merged. <?xml version = “1.0”?> <myparas> <para num = “first”>This is Para 1 </para> <para num = ‘second’ color = “red”>This is Para 2</para> <myparas>

Más contenido relacionado

La actualidad más candente (20)

Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xml
 
Xml
XmlXml
Xml
 
Xml ppt
Xml pptXml ppt
Xml ppt
 
Introduction to JavaScript Basics.
Introduction to JavaScript Basics.Introduction to JavaScript Basics.
Introduction to JavaScript Basics.
 
XML Schema
XML SchemaXML Schema
XML Schema
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)
 
Images and Tables in HTML
Images and Tables in HTMLImages and Tables in HTML
Images and Tables in HTML
 
CSS
CSSCSS
CSS
 
Html presentation
Html presentationHtml presentation
Html presentation
 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt
 
Learning HTML
Learning HTMLLearning HTML
Learning HTML
 
Html notes
Html notesHtml notes
Html notes
 
Html ppt
Html pptHtml ppt
Html ppt
 
XML-Extensible Markup Language
XML-Extensible Markup Language XML-Extensible Markup Language
XML-Extensible Markup Language
 
Xml
XmlXml
Xml
 
Dynamic HTML (DHTML)
Dynamic HTML (DHTML)Dynamic HTML (DHTML)
Dynamic HTML (DHTML)
 
Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) help
 
DTD
DTDDTD
DTD
 

Destacado (20)

Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
XML, DTD & XSD Overview
XML, DTD & XSD OverviewXML, DTD & XSD Overview
XML, DTD & XSD Overview
 
Xml
XmlXml
Xml
 
Xml
XmlXml
Xml
 
Xml
XmlXml
Xml
 
Lecture #2 xml
Lecture #2 xmlLecture #2 xml
Lecture #2 xml
 
XML | Computer Science
XML | Computer ScienceXML | Computer Science
XML | Computer Science
 
XML.ppt
XML.pptXML.ppt
XML.ppt
 
Java API for XML Web Services (JAX-WS)
Java API for XML Web Services (JAX-WS)Java API for XML Web Services (JAX-WS)
Java API for XML Web Services (JAX-WS)
 
10. XML in DBMS
10. XML in DBMS10. XML in DBMS
10. XML in DBMS
 
Intro xml
Intro xmlIntro xml
Intro xml
 
Xml Publisher And Reporting To Excel
Xml Publisher And Reporting To ExcelXml Publisher And Reporting To Excel
Xml Publisher And Reporting To Excel
 
Webservices Overview : XML RPC, SOAP and REST
Webservices Overview : XML RPC, SOAP and RESTWebservices Overview : XML RPC, SOAP and REST
Webservices Overview : XML RPC, SOAP and REST
 
Xml Session No 1
Xml Session No 1Xml Session No 1
Xml Session No 1
 
XML - EXtensible Markup Language
XML - EXtensible Markup LanguageXML - EXtensible Markup Language
XML - EXtensible Markup Language
 
XML
XMLXML
XML
 
Dtd
DtdDtd
Dtd
 
Basic xml syntax
Basic xml syntaxBasic xml syntax
Basic xml syntax
 
Session 1
Session 1Session 1
Session 1
 

Similar a XML (20)

Xmlphp
XmlphpXmlphp
Xmlphp
 
Week1 xml
Week1 xmlWeek1 xml
Week1 xml
 
Xml 1
Xml 1Xml 1
Xml 1
 
About XML
About XMLAbout XML
About XML
 
Xml tutorial
Xml tutorialXml tutorial
Xml tutorial
 
Xml
XmlXml
Xml
 
Xml
Xml Xml
Xml
 
Web 130 XML Podcast
Web 130 XML PodcastWeb 130 XML Podcast
Web 130 XML Podcast
 
Xml description
Xml descriptionXml description
Xml description
 
Xml intro1
Xml intro1Xml intro1
Xml intro1
 
Xml 150323102007-conversion-gate01
Xml 150323102007-conversion-gate01Xml 150323102007-conversion-gate01
Xml 150323102007-conversion-gate01
 
Xml material
Xml materialXml material
Xml material
 
Xml material
Xml materialXml material
Xml material
 
Xml material
Xml materialXml material
Xml material
 
Xml
XmlXml
Xml
 
XML DTD Validate
XML DTD ValidateXML DTD Validate
XML DTD Validate
 
PHP XML
PHP XMLPHP XML
PHP XML
 
Lotusphere 2006 AD212 Introduction to DXL
Lotusphere 2006 AD212 Introduction to DXLLotusphere 2006 AD212 Introduction to DXL
Lotusphere 2006 AD212 Introduction to DXL
 
Xml
XmlXml
Xml
 
Xml
XmlXml
Xml
 

Más de Mukesh Tekwani

ISCE-Class 12-Question Bank - Electrostatics - Physics
ISCE-Class 12-Question Bank - Electrostatics  -  PhysicsISCE-Class 12-Question Bank - Electrostatics  -  Physics
ISCE-Class 12-Question Bank - Electrostatics - PhysicsMukesh Tekwani
 
Hexadecimal to binary conversion
Hexadecimal to binary conversion Hexadecimal to binary conversion
Hexadecimal to binary conversion Mukesh Tekwani
 
Hexadecimal to decimal conversion
Hexadecimal to decimal conversion Hexadecimal to decimal conversion
Hexadecimal to decimal conversion Mukesh Tekwani
 
Hexadecimal to octal conversion
Hexadecimal to octal conversionHexadecimal to octal conversion
Hexadecimal to octal conversionMukesh Tekwani
 
Gray code to binary conversion
Gray code to binary conversion Gray code to binary conversion
Gray code to binary conversion Mukesh Tekwani
 
Decimal to Binary conversion
Decimal to Binary conversionDecimal to Binary conversion
Decimal to Binary conversionMukesh Tekwani
 
Video Lectures for IGCSE Physics 2020-21
Video Lectures for IGCSE Physics 2020-21Video Lectures for IGCSE Physics 2020-21
Video Lectures for IGCSE Physics 2020-21Mukesh Tekwani
 
Refraction and dispersion of light through a prism
Refraction and dispersion of light through a prismRefraction and dispersion of light through a prism
Refraction and dispersion of light through a prismMukesh Tekwani
 
Refraction of light at a plane surface
Refraction of light at a plane surfaceRefraction of light at a plane surface
Refraction of light at a plane surfaceMukesh Tekwani
 
Atom, origin of spectra Bohr's theory of hydrogen atom
Atom, origin of spectra Bohr's theory of hydrogen atomAtom, origin of spectra Bohr's theory of hydrogen atom
Atom, origin of spectra Bohr's theory of hydrogen atomMukesh Tekwani
 
Refraction of light at spherical surfaces of lenses
Refraction of light at spherical surfaces of lensesRefraction of light at spherical surfaces of lenses
Refraction of light at spherical surfaces of lensesMukesh Tekwani
 
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGE
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGEISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGE
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGEMukesh Tekwani
 
TCP-IP Reference Model
TCP-IP Reference ModelTCP-IP Reference Model
TCP-IP Reference ModelMukesh Tekwani
 

Más de Mukesh Tekwani (20)

Circular motion
Circular motionCircular motion
Circular motion
 
Gravitation
GravitationGravitation
Gravitation
 
ISCE-Class 12-Question Bank - Electrostatics - Physics
ISCE-Class 12-Question Bank - Electrostatics  -  PhysicsISCE-Class 12-Question Bank - Electrostatics  -  Physics
ISCE-Class 12-Question Bank - Electrostatics - Physics
 
Hexadecimal to binary conversion
Hexadecimal to binary conversion Hexadecimal to binary conversion
Hexadecimal to binary conversion
 
Hexadecimal to decimal conversion
Hexadecimal to decimal conversion Hexadecimal to decimal conversion
Hexadecimal to decimal conversion
 
Hexadecimal to octal conversion
Hexadecimal to octal conversionHexadecimal to octal conversion
Hexadecimal to octal conversion
 
Gray code to binary conversion
Gray code to binary conversion Gray code to binary conversion
Gray code to binary conversion
 
What is Gray Code?
What is Gray Code? What is Gray Code?
What is Gray Code?
 
Decimal to Binary conversion
Decimal to Binary conversionDecimal to Binary conversion
Decimal to Binary conversion
 
Video Lectures for IGCSE Physics 2020-21
Video Lectures for IGCSE Physics 2020-21Video Lectures for IGCSE Physics 2020-21
Video Lectures for IGCSE Physics 2020-21
 
Refraction and dispersion of light through a prism
Refraction and dispersion of light through a prismRefraction and dispersion of light through a prism
Refraction and dispersion of light through a prism
 
Refraction of light at a plane surface
Refraction of light at a plane surfaceRefraction of light at a plane surface
Refraction of light at a plane surface
 
Spherical mirrors
Spherical mirrorsSpherical mirrors
Spherical mirrors
 
Atom, origin of spectra Bohr's theory of hydrogen atom
Atom, origin of spectra Bohr's theory of hydrogen atomAtom, origin of spectra Bohr's theory of hydrogen atom
Atom, origin of spectra Bohr's theory of hydrogen atom
 
Refraction of light at spherical surfaces of lenses
Refraction of light at spherical surfaces of lensesRefraction of light at spherical surfaces of lenses
Refraction of light at spherical surfaces of lenses
 
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGE
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGEISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGE
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGE
 
Cyber Laws
Cyber LawsCyber Laws
Cyber Laws
 
XML
XMLXML
XML
 
Social media
Social mediaSocial media
Social media
 
TCP-IP Reference Model
TCP-IP Reference ModelTCP-IP Reference Model
TCP-IP Reference Model
 

Último

Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1GloryAnnCastre1
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvRicaMaeCastro1
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptxJonalynLegaspi2
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptxmary850239
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsPooky Knightsmith
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 

Último (20)

Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptx
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young minds
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 

XML

  • 1. XML Mukesh N Tekwani tekwani@email.com www.myexamnotes.com
  • 2.
  • 4. HTML is not suitable for data interchange
  • 5. HTML is not context aware – HTML does not allow us to describe the information content or the semantics of the document
  • 6. HTML is not object-oriented
  • 7. HTML is not re-usable
  • 8.
  • 9. Extensible – capable of being extended
  • 10. Markup – it is a way of adding information to the text indicating the logical components of a document
  • 11. How is it different from HTML?
  • 12. HTML was designed to display data
  • 13. XML was designed to store, describe and transport data
  • 14. XML is also a markup language like HTML
  • 15.
  • 16. Advantages (Features) of XML - 1 XML simplifies data sharing Since XML data is stored in plain text format, data can be easily shared among different hardware and software platforms. XML separates data from HTML To display dynamic data in HTML, the code must be rewritten each time the data changes. With XML, data can be stored in separate files so that whenever the data changes it is automatically displayed correctly. We have to design the HTML for layout only once.
  • 17.
  • 18. With XML, data can be easily exchanged between different platforms.
  • 19. XML makes data more available
  • 20. Since XML is independent of hardware, software and application, XML can make your data more available and useful.
  • 21. Different applications can access your data in HTML pages
  • 22.
  • 23. Applications of XML File Converters Many applications have been written to convert existing documents into the XML standard. An example is a PDF to XML converter. Cell Phones - XML data is sent to some cell phones. This data is then formatted to display text or images, and even to play sounds! VoiceXML - Converts XML documents into an audio format so that you can listen to an XML document.
  • 24. XML Document – Example 1 <?xml version="1.0" encoding="ISO-8859-1"?> <class_list> <student> <name>Anamika</name> <grade>A+</grade> </student> <student> <name>Veena</name> <grade>B+</grade> </student> </class_list>
  • 25.
  • 27. It defines the XML version (1.0)
  • 28. It gives the encoding used (ISO-8859-1 = Latin-1/West European character set)
  • 29. The XML declaration is actually a processing instruction (PI) an it is identified by the ? At its start and end
  • 30. The next line describes the root element of the document (like saying: "this document is a class_list“)
  • 31. The next 2 lines describe 2 child elements of the root (student, name, and grade)
  • 32.
  • 33.
  • 34. XML documents must contain a root element. This element is "the parent" of all other elements.
  • 35. The elements in an XML document form a document tree. The tree starts at the root and branches to the lowest level of the tree.
  • 36. All elements can have sub elements (child elements)
  • 37.
  • 38. XML – Example 2 <bookstore> <book category = "COOKING"> <title lang = "en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price></book> <book category = "CHILDREN"> <title lang = "en">Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price></book> <book category = "WEB"> <title lang = "en">Learning XML</title> <author>Erik T. Ray</author> <year>2003</year> <price>39.95</price></book> </bookstore>
  • 39. Important Definitions XML Element An element is a start tag, content, and an end tag. E.g., <greeting>”Hello World</greeting> XML Attribute An attribute provides additional information about elements E.g., <note priority = “high”>
  • 40. Important Definitions Child elements – XML elements may have child elements <employee id = “100”> <name> <first>Anita</first> <initial>D</initial> <last>Singh</last> </name> </employee> Parent Element Name Children of parent element
  • 41. XML Element An XML element is everything from the element's start tag to the element's end tag. An element can contain other elements, simple text or a mixture of both. Elements can also have attributes.
  • 42. XML Syntax Rules All XML elements must have a closing tag XML tags are case sensitive. The tag <Book> is different from the tag <book> Opening and closing tags must be written with the same case <Message>This is incorrect</message><message>This is correct</message>
  • 43.
  • 44.
  • 45. XML Syntax Rules XML Entity References Some characters have a special meaning in XML. E.g., If you place a character like "<" inside an XML element, it will generate an error because the parser interprets it as the start of a new element. <message>if salary < 1000 then </message> To avoid this error, replace the "<" character with an entity reference: <message>if salary &lt; 1000 then</message>
  • 46. XML Syntax Rules XML Entity References There are 5 predefined entity references in XML:
  • 47.
  • 49. Names can contain letters, numbers, and other characters
  • 50. Names cannot start with a number or punctuation character
  • 51. Names cannot start with the letters xml (or XML, or Xml, etc)
  • 53.
  • 54. Different Types of XML Markups 5 Types of Markup in XML Elements Entities Comments Processing Instructions Ignored Sections
  • 55. Element Markup Element Markup It is composed of 3 parts: start tag, the content, and the end tag. Example: <name>Neetu</name> The start tag and the end tag can be treated as wrappers The element name that appears in the start tag must be exactly the same as the name that appears in the end tag. Example: <Name>Neetu</name>
  • 56. Different Types of XML Markups Attribute Markup Attributes are used to attach information to the information contained in an element. General syntax for attributes is: <elementname property = ‘value’> Or <elementname property = “value”> Attribute value must be enclosed within quotation marks Use either single quotes or double quotes but don’t mix them.
  • 57. Attribute Markup If we specify the attributes for the same element more than once, the specifications are merged. <?xml version = “1.0”?> <myparas> <para num = “first”>This is Para 1 </para> <para num = ‘second’ color = “red”>This is Para 2</para> <myparas>
  • 58. Attribute Markup When the XML processor encounters line 3, it will record the fact that para element has the num attribute When it encounters the 4th line it will record the fact that para element has the color attribute
  • 59. Reserved Attribute The xml:lang attribute is reserved to identify the human language in which the element was written The value of attribute is one of the following: en English fr French de German
  • 60.
  • 61. Similar to attributes in HTML e.g., <IMG SRC=“sky.jpg”> In this SRC is the attribute
  • 62. XML Attribute values must be quoted
  • 63. XML elements can have attributes in name/value pairs just like in HTML.
  • 64. In XML the attribute value must always be quoted.<note date = 01/01/2010> <---------- This is invalid<to>Priya</to><from>Deeali</from> </note> <note date = “01/01/2010”> --------- Now OK since enclosed in double quotes <note date = ‘01/01/2010’> --------- This is also OK since enclosed in single quotes
  • 65. XML Attributes and Elements Consider the following example: <person gender = "female"> <firstname>Geeta</firstname> <lastname>Shah</lastname></person> Gender is an attribute Gender is an element <person> <gender>female</gender> <firstname>Geeta</firstname> <lastname>Shah</lastname></person>
  • 66.
  • 67. Attributes cannot contain tree structures
  • 68. Attributes are not easily expandable (for future changes)
  • 69. Attributes are difficult to read and maintain
  • 71.
  • 72.
  • 73. Metadata – data about data – should be stored as attributes
  • 74. The ID can then be used to identify the XML element <messages><note id="501"> <to>Tina</to> <from>Yasmin</from> <heading>Reminder</heading> <body>Happy Birthday!</body></note><note id="502"> <to>Yasmin</to> <from>Tina</from> <heading>Re: Reminder</heading> <body>Thank you, my dear</body></note></messages>
  • 75.
  • 76. What does Extensible mean in XML? Now suppose the author of the XML document added some extra information to it: <note><date>2008-01-10</date><to>Anita</to><from>Veena</from><heading>Reminder</heading><body>You have an exam tomorrow</body> </note>
  • 77. What does Extensible mean in XML? This application will not crash because it will still find the <to>, <from> and <body> elements in the XML document and produce the same output.
  • 78. XML Validation What is a “well formed” XML document? XML with correct syntax is "Well Formed" XML. A "Well Formed" XML document has correct XML syntax. XML documents must have a root element XML elements must have a closing tag XML tags are case sensitive XML elements must be properly nested XML attribute values must be quoted
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84. These examples are invalid since they are both examples forgetting the semi-colon following the character entity. Bad Examples… <h1>Jack &amp Jill</h1> <equation>5 &lt 2</equation>
  • 85. Good Examples… <h1>Jack &amp; Jill</h1> <equation>5 &lt; 2</equation>
  • 86.
  • 87. Element names may contain letters, numbers, hyphens, periods and underscores inclusively.BAD EXAMPLES <bad*characters> <illegal space> <99number-start> GOOD EXAMPLES <example-one> <_example2> <Example.Three>
  • 88.
  • 89.
  • 90.
  • 91. Viewing XML Files - 2 The XML document will be displayed with color-coded root and child elements. A plus (+) or minus sign (-) to the left of the elements can be clicked to expand or collapse the element structure.  To view the raw XML source (without the + and - signs), select "View Page Source" or "View Source" from the browser menu.
  • 92. Viewing XML Files - 3 Why XML documents display like this? XML documents do not carry information about how to display the data. Since XML tags are created by the user of the XML document, browsers do not know if a tag like <table> describes an HTML table or a dining table. Without any information about how to display the data, most browsers will just display the XML document as it is.
  • 93. Using CSS to display XML Files CSS (Cascading Style Sheets) can be used to format a XML document. Consider this XML document:
  • 94. Displaying Formatted XML document-1 <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type = "text/css" href = "birthdate.css"?> <birthdate> <person> <name> <first>Anokhi</first> <last>Parikh</last> </name> <date> <month>01</month> <day>21</day> <year>1992</year> </date> </person> </birthdate>
  • 95. Displaying Formatted XML document-2 Stylesheet – birthdate.css birthdate { background-color: #ffffff; width: 100%; } person { margin-left: 0; } name { color: #FF0000; font-size: 20pt; } month, day, year { display:block; color: #000000; margin-left: 20pt; }
  • 97.
  • 98. An XSL style sheet is a file that describes how to display an XML document
  • 99. XSL contains a transformation language for XML documents: XSLT. XSLT is used for generating HTML web pages from XML data.
  • 101. XSLT is used to transform an XML document into an HTML document
  • 102. XSLT is the recommended style sheet language for XML