SlideShare a Scribd company logo
12
Most read
13
Most read
18
Most read
Introduction to XML
Extensible Markup Language
What is XML
β€’ XML stands for eXtensible Markup Language.
β€’ A markup language is used to provide
information about a document.
β€’ Tags are added to the document to provide the
extra information.
β€’ HTML tags tell a browser how to display the
document.
β€’ XML tags give a reader some idea what some of
the data means.
What is XML Used For?
β€’ XML documents are used to transfer data from one
place to another often over the Internet.
β€’ XML subsets are designed for particular applications.
β€’ One is RSS (Rich Site Summary or Really Simple
Syndication ). It is used to send breaking news bulletins
from one web site to another.
β€’ A number of fields have their own subsets. These
include chemistry, mathematics, and books publishing.
β€’ Most of these subsets are registered with the
W3Consortium and are available for anyone’s use.
Advantages of XML
β€’ XML is text (Unicode) based.
– Takes up less space.
– Can be transmitted efficiently.
β€’ One XML document can be displayed differently
in different media.
– Html, video, CD, DVD,
– You only have to change the XML document in order
to change all the rest.
β€’ XML documents can be modularized. Parts can
be reused.
Example of an HTML Document
<html>
<head><title>Example</title></head.
<body>
<h1>This is an example of a page.</h1>
<h2>Some information goes here.</h2>
</body>
</html>
Example of an XML Document
<?xml version=β€œ1.0”?>
<address>
<name>Alice Lee</name>
<email>alee@aol.com</email>
<phone>212-346-1234</phone>
<birthday>1985-03-22</birthday>
</address>
Difference Between HTML and XML
β€’ HTML tags have a fixed meaning and
browsers know what it is.
β€’ XML tags are different for different
applications, and users know what they
mean.
β€’ HTML tags are used for display.
β€’ XML tags are used to describe documents
and data.
XML Rules
β€’ Tags are enclosed in angle brackets.
β€’ Tags come in pairs with start-tags and
end-tags.
β€’ Tags must be properly nested.
– <name><email>…</name></email> is not allowed.
– <name><email>…</email><name> is.
β€’ Tags that do not have end-tags must be
terminated by a β€˜/’.
– <br /> is an html example.
More XML Rules
β€’ Tags are case sensitive.
– <address> is not the same as <Address>
β€’ XML in any combination of cases is not allowed
as part of a tag.
β€’ Tags may not contain β€˜<β€˜ or β€˜&’.
β€’ Tags follow Java naming conventions, except
that a single colon and other characters are
allowed. They must begin with a letter and may
not contain white space.
β€’ Documents must have a single root tag that
begins the document.
XML Example Revisited
<?xml version=β€œ1.0”/>
<address>
<name>Alice Lee</name>
<email>alee@aol.com</email>
<phone>212-346-1234</phone>
<birthday>1985-03-22</birthday>
</address>
β€’ Markup for the data aids understanding of its purpose.
β€’ A flat text file is not nearly so clear.
Alice Lee
alee@aol.com
212-346-1234
1985-03-22
β€’ The last line looks like a date, but what is it for?
Expanded Example
<?xml version="1.0" encoding="UTF-8"?>
<address>
<name>
<first>Alice</first>
<last>Lee</last>
</name>
<email>alee@aol.com</email>
<phone>123-45-6789</phone>
<birthday>
<year>1983</year>
<month>07</month>
<day>15</day>
</birthday>
</address>
XML Files are Trees
address
name email phone birthday
first last year month day
XML Trees
β€’ An XML document has a single root node.
β€’ The tree is a general ordered tree.
– A parent node may have any number of
children.
– Child nodes are ordered, and may have
siblings.
β€’ Preorder traversals are usually used for
getting information out of the tree.
Document Type Definitions
β€’ A DTD describes the tree structure of a
document and something about its data.
β€’ There are two data types, PCDATA and
CDATA.
– PCDATA is parsed character data.
– CDATA is character data, not usually parsed.
β€’ A DTD determines how many times a
node may appear, and how child nodes
are ordered.
DTD for address Example
<!ELEMENT address (name, email, phone, birthday)>
<!ELEMENT name (first, last)>
<!ELEMENT first (#PCDATA)>
<!ELEMENT last (#PCDATA)>
<!ELEMENT email (#PCDATA)>
<!ELEMENT phone (#PCDATA)>
<!ELEMENT birthday (year, month, day)>
<!ELEMENT year (#PCDATA)>
<!ELEMENT month (#PCDATA)>
<!ELEMENT day (#PCDATA)>
Schemas
β€’ Schemas are themselves XML documents.
β€’ They were standardized after DTDs and provide
more information about the document.
β€’ They have a number of data types including
string, decimal, integer, boolean, date, and time.
β€’ They divide elements into simple and complex
types.
β€’ They also determine the tree structure and how
many children a node may have.
XSLT
Extensible Stylesheet Language Transformations
β€’ XSLT is used to transform one xml document
into another, often an html document.
β€’ The Transform classes are now part of Java 1.4.
β€’ A program is used that takes as input one xml
document and produces as output another.
β€’ If the resulting document is in html, it can be
viewed by a web browser.
β€’ This is a good way to display xml data.
A Style Sheet to Transform address.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="address">
<html><head><title>Address Book</title></head>
<body>
<xsl:value-of select="name"/>
<br/><xsl:value-of select="email"/>
<br/><xsl:value-of select="phone"/>
<br/><xsl:value-of select="birthday"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
The Result of the Transformation
Alice Lee
alee@aol.com
123-45-6789
1983-7-15

More Related Content

PPT
PPTX
PDF
Xml schema
PPTX
Html5 tutorial for beginners
PPT
Introduction to XML
PPTX
HTTP request and response
PPTX
Extensible Markup Language (XML)
Xml schema
Html5 tutorial for beginners
Introduction to XML
HTTP request and response
Extensible Markup Language (XML)

What's hot (20)

PPTX
PPTX
Xml presentation
PPT
Unit 3 chapter 1-file management
PDF
1. web technology basics
PPTX
Popup boxes
PPT
File organization 1
PPSX
PPTX
Introduction to php
PPTX
Basic html tags
PPT
PHP - Introduction to PHP Date and Time Functions
PDF
UDP - User Datagram Protocol
ODP
Introduction of Html/css/js
PPT
Databases: Normalisation
PPT
Web design basics
PDF
XML and XML Applications - Lecture 04 - Web Information Systems (WE-DINF-11912)
PPT
javaScript.ppt
PPTX
File system Os
PPTX
css.ppt
PPTX
Advanced mechanisms for dynamic content delivery
PPTX
Sgml
Xml presentation
Unit 3 chapter 1-file management
1. web technology basics
Popup boxes
File organization 1
Introduction to php
Basic html tags
PHP - Introduction to PHP Date and Time Functions
UDP - User Datagram Protocol
Introduction of Html/css/js
Databases: Normalisation
Web design basics
XML and XML Applications - Lecture 04 - Web Information Systems (WE-DINF-11912)
javaScript.ppt
File system Os
css.ppt
Advanced mechanisms for dynamic content delivery
Sgml
Ad

Similar to Introduction to XML (20)

PPTX
Xml unit1
PPT
PPT
Introduction to XML.ppt
PPT
Introduction to XML.ppt
PPTX
Internet_Technology_UNIT V- Introduction to XML.pptx
PPTX
web design technology- mark up languages
PDF
xml introduction in web technologies subject
PPTX
Web Technology Part 4
DOCX
PPT
web program-Extended MARKUP Language XML.ppt
PDF
xml2cdvcx vnbm,azsdfghjkml;sxdfcgmndxfcgvhb nmfctgvbhjnm ,cfgvb nm,xc vb.pdf
PPTX
DOCX
Xml 150323102007-conversion-gate01
PPTX
xml.pptx
DOCX
Xml material
DOCX
Xml material
DOCX
Xml material
PPT
Xml (2)
PDF
Xml unit1
Introduction to XML.ppt
Introduction to XML.ppt
Internet_Technology_UNIT V- Introduction to XML.pptx
web design technology- mark up languages
xml introduction in web technologies subject
Web Technology Part 4
web program-Extended MARKUP Language XML.ppt
xml2cdvcx vnbm,azsdfghjkml;sxdfcgmndxfcgvhb nmfctgvbhjnm ,cfgvb nm,xc vb.pdf
Xml 150323102007-conversion-gate01
xml.pptx
Xml material
Xml material
Xml material
Xml (2)
Ad

Recently uploaded (20)

PDF
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
DOCX
Unit-3 cyber security network security of internet system
PPTX
SAP Ariba Sourcing PPT for learning material
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
PDF
Testing WebRTC applications at scale.pdf
PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
PPTX
Introduction to Information and Communication Technology
PPTX
artificial intelligence overview of it and more
PDF
The Internet -By the Numbers, Sri Lanka Edition
Β 
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PDF
Paper PDF World Game (s) Great Redesign.pdf
PPTX
Digital Literacy And Online Safety on internet
PDF
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 
PDF
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Β 
PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
PPTX
Introuction about WHO-FIC in ICD-10.pptx
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
Unit-3 cyber security network security of internet system
SAP Ariba Sourcing PPT for learning material
SASE Traffic Flow - ZTNA Connector-1.pdf
Testing WebRTC applications at scale.pdf
522797556-Unit-2-Temperature-measurement-1-1.pptx
Introduction to Information and Communication Technology
artificial intelligence overview of it and more
The Internet -By the Numbers, Sri Lanka Edition
Β 
Unit-1 introduction to cyber security discuss about how to secure a system
Paper PDF World Game (s) Great Redesign.pdf
Digital Literacy And Online Safety on internet
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Β 
INTERNET------BASICS-------UPDATED PPT PRESENTATION
Introuction about WHO-FIC in ICD-10.pptx
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
The New Creative Director: How AI Tools for Social Media Content Creation Are...

Introduction to XML

  • 2. What is XML β€’ XML stands for eXtensible Markup Language. β€’ A markup language is used to provide information about a document. β€’ Tags are added to the document to provide the extra information. β€’ HTML tags tell a browser how to display the document. β€’ XML tags give a reader some idea what some of the data means.
  • 3. What is XML Used For? β€’ XML documents are used to transfer data from one place to another often over the Internet. β€’ XML subsets are designed for particular applications. β€’ One is RSS (Rich Site Summary or Really Simple Syndication ). It is used to send breaking news bulletins from one web site to another. β€’ A number of fields have their own subsets. These include chemistry, mathematics, and books publishing. β€’ Most of these subsets are registered with the W3Consortium and are available for anyone’s use.
  • 4. Advantages of XML β€’ XML is text (Unicode) based. – Takes up less space. – Can be transmitted efficiently. β€’ One XML document can be displayed differently in different media. – Html, video, CD, DVD, – You only have to change the XML document in order to change all the rest. β€’ XML documents can be modularized. Parts can be reused.
  • 5. Example of an HTML Document <html> <head><title>Example</title></head. <body> <h1>This is an example of a page.</h1> <h2>Some information goes here.</h2> </body> </html>
  • 6. Example of an XML Document <?xml version=β€œ1.0”?> <address> <name>Alice Lee</name> <email>alee@aol.com</email> <phone>212-346-1234</phone> <birthday>1985-03-22</birthday> </address>
  • 7. Difference Between HTML and XML β€’ HTML tags have a fixed meaning and browsers know what it is. β€’ XML tags are different for different applications, and users know what they mean. β€’ HTML tags are used for display. β€’ XML tags are used to describe documents and data.
  • 8. XML Rules β€’ Tags are enclosed in angle brackets. β€’ Tags come in pairs with start-tags and end-tags. β€’ Tags must be properly nested. – <name><email>…</name></email> is not allowed. – <name><email>…</email><name> is. β€’ Tags that do not have end-tags must be terminated by a β€˜/’. – <br /> is an html example.
  • 9. More XML Rules β€’ Tags are case sensitive. – <address> is not the same as <Address> β€’ XML in any combination of cases is not allowed as part of a tag. β€’ Tags may not contain β€˜<β€˜ or β€˜&’. β€’ Tags follow Java naming conventions, except that a single colon and other characters are allowed. They must begin with a letter and may not contain white space. β€’ Documents must have a single root tag that begins the document.
  • 10. XML Example Revisited <?xml version=β€œ1.0”/> <address> <name>Alice Lee</name> <email>alee@aol.com</email> <phone>212-346-1234</phone> <birthday>1985-03-22</birthday> </address> β€’ Markup for the data aids understanding of its purpose. β€’ A flat text file is not nearly so clear. Alice Lee alee@aol.com 212-346-1234 1985-03-22 β€’ The last line looks like a date, but what is it for?
  • 11. Expanded Example <?xml version="1.0" encoding="UTF-8"?> <address> <name> <first>Alice</first> <last>Lee</last> </name> <email>alee@aol.com</email> <phone>123-45-6789</phone> <birthday> <year>1983</year> <month>07</month> <day>15</day> </birthday> </address>
  • 12. XML Files are Trees address name email phone birthday first last year month day
  • 13. XML Trees β€’ An XML document has a single root node. β€’ The tree is a general ordered tree. – A parent node may have any number of children. – Child nodes are ordered, and may have siblings. β€’ Preorder traversals are usually used for getting information out of the tree.
  • 14. Document Type Definitions β€’ A DTD describes the tree structure of a document and something about its data. β€’ There are two data types, PCDATA and CDATA. – PCDATA is parsed character data. – CDATA is character data, not usually parsed. β€’ A DTD determines how many times a node may appear, and how child nodes are ordered.
  • 15. DTD for address Example <!ELEMENT address (name, email, phone, birthday)> <!ELEMENT name (first, last)> <!ELEMENT first (#PCDATA)> <!ELEMENT last (#PCDATA)> <!ELEMENT email (#PCDATA)> <!ELEMENT phone (#PCDATA)> <!ELEMENT birthday (year, month, day)> <!ELEMENT year (#PCDATA)> <!ELEMENT month (#PCDATA)> <!ELEMENT day (#PCDATA)>
  • 16. Schemas β€’ Schemas are themselves XML documents. β€’ They were standardized after DTDs and provide more information about the document. β€’ They have a number of data types including string, decimal, integer, boolean, date, and time. β€’ They divide elements into simple and complex types. β€’ They also determine the tree structure and how many children a node may have.
  • 17. XSLT Extensible Stylesheet Language Transformations β€’ XSLT is used to transform one xml document into another, often an html document. β€’ The Transform classes are now part of Java 1.4. β€’ A program is used that takes as input one xml document and produces as output another. β€’ If the resulting document is in html, it can be viewed by a web browser. β€’ This is a good way to display xml data.
  • 18. A Style Sheet to Transform address.xml <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="address"> <html><head><title>Address Book</title></head> <body> <xsl:value-of select="name"/> <br/><xsl:value-of select="email"/> <br/><xsl:value-of select="phone"/> <br/><xsl:value-of select="birthday"/> </body> </html> </xsl:template> </xsl:stylesheet>
  • 19. The Result of the Transformation Alice Lee alee@aol.com 123-45-6789 1983-7-15