SlideShare uma empresa 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>

Mais conteúdo relacionado

Mais procurados (20)

Html basics
Html basicsHtml basics
Html basics
 
CSS
CSSCSS
CSS
 
Html ppt
Html pptHtml ppt
Html ppt
 
Basic HTML
Basic HTMLBasic HTML
Basic HTML
 
Introduction to XHTML
Introduction to XHTMLIntroduction to XHTML
Introduction to XHTML
 
HTML (Web) basics for a beginner
HTML (Web) basics for a beginnerHTML (Web) basics for a beginner
HTML (Web) basics for a beginner
 
Html
HtmlHtml
Html
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
Html frames
Html framesHtml frames
Html frames
 
CSS
CSSCSS
CSS
 
Xml ppt
Xml pptXml ppt
Xml ppt
 
Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)
 
Role of html in web development
Role of html in web developmentRole of html in web development
Role of html in web development
 
Http request and http response
Http request and http responseHttp request and http response
Http request and http response
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
HTML
HTMLHTML
HTML
 
Js ppt
Js pptJs ppt
Js ppt
 
Xml namespace
Xml namespaceXml namespace
Xml namespace
 
XSLT
XSLTXSLT
XSLT
 
XSLT presentation
XSLT presentationXSLT presentation
XSLT presentation
 

Destaque (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
 
Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to 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
 

Semelhante 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
 

Mais 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
 

Mais 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

ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
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
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
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
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxPoojaSen20
 

Último (20)

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
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
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 ...
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
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
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.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