SlideShare a Scribd company logo
2
Most read
3
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

What's hot (20)

PPTX
Array Introduction One-dimensional array Multidimensional array
imtiazalijoono
 
PPTX
Html forms
Himanshu Pathak
 
PPTX
classes and objects in C++
HalaiHansaika
 
PDF
Introduction to html
eShikshak
 
PPT
Structure in c
Prabhu Govind
 
PPTX
CSS
Akila Iroshan
 
PPTX
Html5 tutorial for beginners
Singsys Pte Ltd
 
PPTX
Xml presentation
Miguel Angel Teheran Garcia
 
PPTX
CBSE - Class 12 - Ch -5 -File Handling , access mode,CSV , Binary file
ShivaniJayaprakash1
 
PPT
CSS Basics
WordPress Memphis
 
PDF
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
PDF
Xml schema
Prabhakaran V M
 
PDF
javascript objects
Vijay Kalyan
 
PPT
Css
Manav Prasad
 
PPTX
Web html table tags
Kainat Ilyas
 
PPT
standard template library(STL) in C++
•sreejith •sree
 
PPTX
Cascading style sheets (CSS)
Harshita Yadav
 
PPTX
Introduction to CSS
Folasade Adedeji
 
Array Introduction One-dimensional array Multidimensional array
imtiazalijoono
 
Html forms
Himanshu Pathak
 
classes and objects in C++
HalaiHansaika
 
Introduction to html
eShikshak
 
Structure in c
Prabhu Govind
 
Html5 tutorial for beginners
Singsys Pte Ltd
 
Xml presentation
Miguel Angel Teheran Garcia
 
CBSE - Class 12 - Ch -5 -File Handling , access mode,CSV , Binary file
ShivaniJayaprakash1
 
CSS Basics
WordPress Memphis
 
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
Xml schema
Prabhakaran V M
 
javascript objects
Vijay Kalyan
 
Web html table tags
Kainat Ilyas
 
standard template library(STL) in C++
•sreejith •sree
 
Cascading style sheets (CSS)
Harshita Yadav
 
Introduction to CSS
Folasade Adedeji
 

Similar to Introduction to XML (20)

PPTX
Xml unit1
sathyasudha
 
PPT
Introduction to XML.ppt
Varsha Uchagaonkar
 
PPT
Introduction to XML.ppt
Varsha Uchagaonkar
 
PPTX
Internet_Technology_UNIT V- Introduction to XML.pptx
shilpar780389
 
PPTX
Introduction to XML
Maung Nyunt
 
PPTX
Extensible Markup Language (XML)
AakankshaR
 
PPT
msc_xml1.ppt
ADVAITHRRAJESH224720
 
PPT
msc_xml1.ppt
ADVAITHRRAJESH224720
 
PPT
msc_xml1.ppt
ADVAITHRRAJESH224720
 
PPT
cis110-xml-xhtml engineering computer science
ash0014as
 
PPT
web program-Extended MARKUP Language XML.ppt
mcjaya2024
 
PDF
IT6801-Service Oriented Architecture- UNIT-I notes
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
PPTX
XML-Extensible Markup Language
Ann Joseph
 
PDF
WT UNIT-2 XML.pdf
Ranjeet Reddy
 
PPT
Xml
Sudharsan S
 
PPTX
Web Technology Part 4
Thapar Institute
 
PPT
1 xml fundamentals
Dr.Saranya K.G
 
PPTX
BITM3730 10-31.pptx
MattMarino13
 
Xml unit1
sathyasudha
 
Introduction to XML.ppt
Varsha Uchagaonkar
 
Introduction to XML.ppt
Varsha Uchagaonkar
 
Internet_Technology_UNIT V- Introduction to XML.pptx
shilpar780389
 
Introduction to XML
Maung Nyunt
 
Extensible Markup Language (XML)
AakankshaR
 
msc_xml1.ppt
ADVAITHRRAJESH224720
 
msc_xml1.ppt
ADVAITHRRAJESH224720
 
msc_xml1.ppt
ADVAITHRRAJESH224720
 
cis110-xml-xhtml engineering computer science
ash0014as
 
web program-Extended MARKUP Language XML.ppt
mcjaya2024
 
IT6801-Service Oriented Architecture- UNIT-I notes
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
XML-Extensible Markup Language
Ann Joseph
 
WT UNIT-2 XML.pdf
Ranjeet Reddy
 
Web Technology Part 4
Thapar Institute
 
1 xml fundamentals
Dr.Saranya K.G
 
BITM3730 10-31.pptx
MattMarino13
 
Ad

Recently uploaded (20)

PDF
DevOps Design for different deployment options
henrymails
 
PPTX
英国假毕业证诺森比亚大学成绩单GPA修改UNN学生卡网上可查学历成绩单
Taqyea
 
PPTX
Cost_of_Quality_Presentation_Software_Engineering.pptx
farispalayi
 
PPT
Computer Securityyyyyyyy - Chapter 2.ppt
SolomonSB
 
PDF
AI_MOD_1.pdf artificial intelligence notes
shreyarrce
 
PPTX
L1A Season 1 Guide made by A hegy Eng Grammar fixed
toszolder91
 
PDF
The-Hidden-Dangers-of-Skipping-Penetration-Testing.pdf.pdf
naksh4thra
 
PPTX
Optimization_Techniques_ML_Presentation.pptx
farispalayi
 
PPTX
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
PPTX
PM200.pptxghjgfhjghjghjghjghjghjghjghjghjghj
breadpaan921
 
PDF
Azure_DevOps introduction for CI/CD and Agile
henrymails
 
PPTX
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
PPTX
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
PPTX
internet básico presentacion es una red global
70965857
 
PDF
Build Fast, Scale Faster: Milvus vs. Zilliz Cloud for Production-Ready AI
Zilliz
 
PPTX
INTEGRATION OF ICT IN LEARNING AND INCORPORATIING TECHNOLOGY
kvshardwork1235
 
PPTX
sajflsajfljsdfljslfjslfsdfas;fdsfksadfjlsdflkjslgfs;lfjlsajfl;sajfasfd.pptx
theknightme
 
PDF
𝐁𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓
hokimamad0
 
PPTX
本科硕士学历佛罗里达大学毕业证(UF毕业证书)24小时在线办理
Taqyea
 
PPTX
一比一原版(SUNY-Albany毕业证)纽约州立大学奥尔巴尼分校毕业证如何办理
Taqyea
 
DevOps Design for different deployment options
henrymails
 
英国假毕业证诺森比亚大学成绩单GPA修改UNN学生卡网上可查学历成绩单
Taqyea
 
Cost_of_Quality_Presentation_Software_Engineering.pptx
farispalayi
 
Computer Securityyyyyyyy - Chapter 2.ppt
SolomonSB
 
AI_MOD_1.pdf artificial intelligence notes
shreyarrce
 
L1A Season 1 Guide made by A hegy Eng Grammar fixed
toszolder91
 
The-Hidden-Dangers-of-Skipping-Penetration-Testing.pdf.pdf
naksh4thra
 
Optimization_Techniques_ML_Presentation.pptx
farispalayi
 
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
PM200.pptxghjgfhjghjghjghjghjghjghjghjghjghj
breadpaan921
 
Azure_DevOps introduction for CI/CD and Agile
henrymails
 
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
internet básico presentacion es una red global
70965857
 
Build Fast, Scale Faster: Milvus vs. Zilliz Cloud for Production-Ready AI
Zilliz
 
INTEGRATION OF ICT IN LEARNING AND INCORPORATIING TECHNOLOGY
kvshardwork1235
 
sajflsajfljsdfljslfjslfsdfas;fdsfksadfjlsdflkjslgfs;lfjlsajfl;sajfasfd.pptx
theknightme
 
𝐁𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓
hokimamad0
 
本科硕士学历佛罗里达大学毕业证(UF毕业证书)24小时在线办理
Taqyea
 
一比一原版(SUNY-Albany毕业证)纽约州立大学奥尔巴尼分校毕业证如何办理
Taqyea
 
Ad

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>[email protected]</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>[email protected]</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 [email protected] 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>[email protected]</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 [email protected] 123-45-6789 1983-7-15