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)

Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)
 
XSLT
XSLTXSLT
XSLT
 
Presentation on HTML
Presentation on HTMLPresentation on HTML
Presentation on HTML
 
Intro Html
Intro HtmlIntro Html
Intro Html
 
Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xml
 
Html Slide Part-1
Html Slide Part-1Html Slide Part-1
Html Slide Part-1
 
XML
XMLXML
XML
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
Learn html Basics
Learn html BasicsLearn html Basics
Learn html Basics
 
Html
HtmlHtml
Html
 
Html Ppt
Html PptHtml Ppt
Html Ppt
 
HTML (Web) basics for a beginner
HTML (Web) basics for a beginnerHTML (Web) basics for a beginner
HTML (Web) basics for a beginner
 
Html introduction
Html introductionHtml introduction
Html introduction
 
Html ppt
Html pptHtml ppt
Html ppt
 
HTML
HTMLHTML
HTML
 
introduction to web technology
introduction to web technologyintroduction to web technology
introduction to web technology
 
CSS
CSSCSS
CSS
 
Basic html structure
Basic html structureBasic html structure
Basic html structure
 
Tags in html
Tags in htmlTags in html
Tags in html
 
An Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptAn Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java Script
 

Destacado (20)

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 ppt
Xml pptXml ppt
Xml ppt
 
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
 
Ajax Part II
Ajax Part IIAjax Part II
Ajax Part II
 

Similar a XML (20)

XML
XMLXML
XML
 
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
 

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

Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
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
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEaurabinda banchhor
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxRosabel UA
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
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
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 

Último (20)

Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
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
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSE
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
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
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
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.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 

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