SlideShare a Scribd company logo
EXTENSIBLE
MARKUP
LANGUAGE
(XML)
1
WHAT IS XML?
 eXtensible Markup Language
 markup language for documents containing
structured information much like HTML
 XML was designed to carry data, not to display
data
 XML tags are not predefined. You must define
your own tags
 Based on Standard Generalized Markup
Language (SGML)
 Version 1.0 introduced by World Wide Web
Consortium (W3C) in 1998
 Bridge for data exchange on the Web 2
WHAT IS XML?
 a method for putting structured data into a text file;
these files are:
 Easy to read
 Unambiguous
 Extensible
 software- and hardware-independent tool for
carrying information.
 self-descriptive
3
WHAT IS XML?
 XML is Not a Replacement for HTML
 In most web applications, XML is used to transport data, while
HTML is used to format and display the data.
4
HOW CAN XML BE USED?
 XML Separates Data from HTML
 XML Simplifies Data Sharing
 XML Simplifies Data Transport
 XML Simplifies Platform Changes
 XML Makes Your Data More Available
 XML is Used to Create New Internet Languages
 XHTML
 WSDL for describing available web services
 WAP and WML as markup languages for handheld devices
 RSS languages for news feeds
5
If Developers Have Sense
If they DO have sense, future applications will
exchange their data in XML.
6
COMPARISONS
 Extensible set of tags
 Content orientated
 Allows multiple output
forms
 Fixed set of tags
 Presentation oriented
 Single presentation
XML HTML
7
AUTHORING XML ELEMENTS
 An XML element is made up of a start tag, an end tag,
and data in between.
 Example:
<director> Matthew Dunn </director>
 Example of another element with the same value:
<actor> Matthew Dunn </actor>
 XML tags are case-sensitive:
<CITY> <City> <city>
 XML can abbreviate empty elements, for example:
<married> </married> can be abbreviated to
<married/> 8
AUTHORING XML DOCUMENTS
 A basic XML document is an XML element that
can, but might not, include nested XML
elements.
 Example:
<books>
<book isbn=“123”>
<title> Second Chance </title>
<author> Matthew Dunn </author>
</book>
</books>
9
XML DATA MODEL: EXAMPLE
<BOOKS>
<book id=“123” loc=“library”>
<author>Hull</author>
<title>California</title>
<year> 1995 </year>
</book>
<article id=“555” ref=“123”>
<author>Su</author>
<title> Purdue</title>
</article>
</BOOKS>
Hull Purdue
BOOKS
123 555
California
Su
titleauthor
title
author
article
book
year
1995
ref
loc=“library”
10
XML EXAMPLE
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
11
XML SYNTAX RULES
 All XML Elements Must Have a Closing Tag
In HTML, some elements do not have to have a
closing tag:
 <p>This is a paragraph
<p>This is another paragraph In XML, it is illegal to omit
the closing tag. All elements must have a closing tag:
 <p>This is a paragraph</p>
<p>This is another paragraph</p>
12
XML SYNTAX RULES
 XML Tags are Case Sensitive
XML tags are case sensitive. The tag <Letter> is
different from the tag <letter>.
 Opening and closing tags must be written with the
same case:
<Message>This is incorrect</message>
<message>This is correct</message>
13
XML SYNTAX RULES
 XML Elements Must be Properly Nested
In HTML, you might see improperly nested
elements:
<b><i>This text is bold and italic</b></i> In XML, all
elements must be properly nested within each
other:
<b><i>This text is bold and italic</i></b>
14
XML SYNTAX RULES
 XML Documents Must Have a Root Element
XML documents must contain one element that is
the parent of all other elements. This element is
called the root element.
<root>
<child>
<subchild>.....</subchild>
</child>
</root>
15
XML SYNTAX RULES
 XML Attribute Values Must be Quoted
 XML elements can have attributes in name/value pairs
just like in HTML.
 In XML, the attribute values must always be quoted.
 Incorrect:
<note date=12/11/2007>
<to>Tove</to>
<from>Jani</from>
</note>
 Correct:
<note date="12/11/2007">
<to>Tove</to>
<from>Jani</from>
</note>
16
XML SYNTAX RULES : ENTITY REFERENCES
 special meaning of Some characters in XML.
 Error in XML:
 <message>if salary < 1000 then</message>
 To avoid this error, replace the "<" character with an entity
reference:
 <message>if salary &lt; 1000 then</message>
 There are 5 predefined entity references in XML:
 &lt; < less than
 &gt; > greater than
 &amp; & ampersand
 &apos; ' apostrophe
 &quot; " quotation mark
 Note: Only the characters "<" and "&" are strictly illegal in
XML. The greater than character is legal, but it is a good habit
to replace it.
17
 Comments in XML
 The syntax for writing comments in XML is similar to that
of HTML.
<!-- This is a comment -->
XML Syntax Rules
18
 White-space is Preserved in XML
 HTML truncates multiple white-space characters to one
single white-space:
 HTML: Hello Tove Output: Hello Tove
 XML: the white-space in a document is not truncated.
 Hello Tove Output: Hello Tove
XML Syntax Rules
19
 XML Stores New Line as LF
 Windows applications : a new line -> carriage return (CR)
and line feed (LF).
 Unix applications : a new line -> LF character
 Macintosh applications : a new line -> LF character
 XML stores a new line as LF.
XML Syntax Rules
20
A
Well Formed
XML
document
21
XML DECLARATION
 The XML declaration looks like this:
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>
 The XML declaration is not required by browsers, but is required
by most XML processors (so include it!)
 If present, the XML declaration must be first--not even
whitespace should precede it
 Note that the brackets are <? and ?>
 version="1.0" is required (this is the only version so far)
 encoding can be "UTF-8" (ASCII) or "UTF-16" (Unicode), or
something else, or it can be omitted
 standalone tells whether there is a separate DTD 22
 An element can contain:
 other elements
 text
 attributes
 or a mix of all of the above...
XML Elements
23
<bookstore>
<book category="CHILDREN">
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="WEB">
<title>Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>
XML Elements
24
 XML elements must follow these 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
XML Elements Naming
Rules
25
 <person sex="female">
<firstname>Anna</firstname>
<lastname>Smith</lastname>
</person>
<person>
<sex>female</sex>
<firstname>Anna</firstname>
<lastname>Smith</lastname>
</person>
XML Elements vs.
Attributes
26
1) <note date="10/01/2008">
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
XML Elements vs.
Attributes
27
2) <note>
<date>10/01/2008</date>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
XML Elements vs.
Attributes
28
3) <note>
<date>
<day>10</day>
<month>01</month>
<year>2008</year>
</date>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
XML Elements vs.
Attributes
29
 Some of the problems with using attributes are:
 attributes cannot contain multiple values (elements can)
 attributes cannot contain tree structures (elements can)
 attributes are not easily expandable (for future changes)
 Attributes are difficult to read and maintain. Use
elements for data. Use attributes for information that
is not relevant to the data.
Avoid XML
Attributes?
30
XML Validation
31
 XML with correct syntax is "Well Formed" XML.
 XML validated against a DTD or XMLSchema is "Valid"
XML.
XML Validation
32
33
34

More Related Content

PPT
Xml 215-presentation
PPT
JavaScript: Events Handling
PPTX
Javascript event handler
PPT
Xml Presentation-3
PPTX
html5.ppt
Xml 215-presentation
JavaScript: Events Handling
Javascript event handler
Xml Presentation-3
html5.ppt

What's hot (20)

PPTX
Xml ppt
PPTX
Xml presentation
PPT
Basic html
PPT
Introduction to XML
PDF
E2E Data Pipeline - Apache Spark/Airflow/Livy
PDF
Introduction to SOAP
PPTX
XML Introduction
PDF
Otbi and bicc_psr_technote_v3_final_document
PPT
Presentation on HTML
PPTX
Back to the Basics - 1 - Introduction to Web Development
PPTX
Soap vs rest
PPTX
HTML Semantic Tags
PPTX
Html Frames
PPT
Html ppt
PDF
Web Services (SOAP, WSDL, UDDI)
PDF
JavaScript - Chapter 5 - Operators
PPT
Introduction to jQuery
Xml ppt
Xml presentation
Basic html
Introduction to XML
E2E Data Pipeline - Apache Spark/Airflow/Livy
Introduction to SOAP
XML Introduction
Otbi and bicc_psr_technote_v3_final_document
Presentation on HTML
Back to the Basics - 1 - Introduction to Web Development
Soap vs rest
HTML Semantic Tags
Html Frames
Html ppt
Web Services (SOAP, WSDL, UDDI)
JavaScript - Chapter 5 - Operators
Introduction to jQuery
Ad

Similar to Xml (20)

PPS
XML - The Extensible Markup Language
PPT
Introduction to xml
PPT
uptu web technology unit 2 Xml2
DOCX
DOCX
Xml material
DOCX
Xml material
DOCX
Xml material
PPT
eXtensible Markup Language (By Dr.Hatem Mohamed)
PPTX
xml.pptx
DOCX
Introduction to xml
PPT
XML Presentation-2
PPT
Xml description
DOCX
XML DTD Validate
PDF
xml2cdvcx vnbm,azsdfghjkml;sxdfcgmndxfcgvhb nmfctgvbhjnm ,cfgvb nm,xc vb.pdf
PPTX
Web Development Course - XML by RSOLUTIONS
PPTX
Web programming xml
PPT
Xml 215-presentation
PPT
working with internet technologies using XML
XML - The Extensible Markup Language
Introduction to xml
uptu web technology unit 2 Xml2
Xml material
Xml material
Xml material
eXtensible Markup Language (By Dr.Hatem Mohamed)
xml.pptx
Introduction to xml
XML Presentation-2
Xml description
XML DTD Validate
xml2cdvcx vnbm,azsdfghjkml;sxdfcgmndxfcgvhb nmfctgvbhjnm ,cfgvb nm,xc vb.pdf
Web Development Course - XML by RSOLUTIONS
Web programming xml
Xml 215-presentation
working with internet technologies using XML
Ad

More from Shailendra Gohil (6)

PPT
Combinational circuit
PPTX
Features Of Office 2007
PPTX
Cng as alternate to gasoline
PPTX
Computer virus
PPTX
Document authentication system with graphical security and sound
PPTX
History of orkut
Combinational circuit
Features Of Office 2007
Cng as alternate to gasoline
Computer virus
Document authentication system with graphical security and sound
History of orkut

Recently uploaded (20)

PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
What if we spent less time fighting change, and more time building what’s rig...
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PPTX
UNIT III MENTAL HEALTH NURSING ASSESSMENT
PPTX
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
Hazard Identification & Risk Assessment .pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
1_English_Language_Set_2.pdf probationary
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PDF
Indian roads congress 037 - 2012 Flexible pavement
PDF
Empowerment Technology for Senior High School Guide
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
Trump Administration's workforce development strategy
PDF
RMMM.pdf make it easy to upload and study
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
Computing-Curriculum for Schools in Ghana
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
Supply Chain Operations Speaking Notes -ICLT Program
What if we spent less time fighting change, and more time building what’s rig...
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
UNIT III MENTAL HEALTH NURSING ASSESSMENT
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
History, Philosophy and sociology of education (1).pptx
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Hazard Identification & Risk Assessment .pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
1_English_Language_Set_2.pdf probationary
LDMMIA Reiki Yoga Finals Review Spring Summer
Indian roads congress 037 - 2012 Flexible pavement
Empowerment Technology for Senior High School Guide
A systematic review of self-coping strategies used by university students to ...
Trump Administration's workforce development strategy
RMMM.pdf make it easy to upload and study
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
Computing-Curriculum for Schools in Ghana

Xml

  • 2. WHAT IS XML?  eXtensible Markup Language  markup language for documents containing structured information much like HTML  XML was designed to carry data, not to display data  XML tags are not predefined. You must define your own tags  Based on Standard Generalized Markup Language (SGML)  Version 1.0 introduced by World Wide Web Consortium (W3C) in 1998  Bridge for data exchange on the Web 2
  • 3. WHAT IS XML?  a method for putting structured data into a text file; these files are:  Easy to read  Unambiguous  Extensible  software- and hardware-independent tool for carrying information.  self-descriptive 3
  • 4. WHAT IS XML?  XML is Not a Replacement for HTML  In most web applications, XML is used to transport data, while HTML is used to format and display the data. 4
  • 5. HOW CAN XML BE USED?  XML Separates Data from HTML  XML Simplifies Data Sharing  XML Simplifies Data Transport  XML Simplifies Platform Changes  XML Makes Your Data More Available  XML is Used to Create New Internet Languages  XHTML  WSDL for describing available web services  WAP and WML as markup languages for handheld devices  RSS languages for news feeds 5
  • 6. If Developers Have Sense If they DO have sense, future applications will exchange their data in XML. 6
  • 7. COMPARISONS  Extensible set of tags  Content orientated  Allows multiple output forms  Fixed set of tags  Presentation oriented  Single presentation XML HTML 7
  • 8. AUTHORING XML ELEMENTS  An XML element is made up of a start tag, an end tag, and data in between.  Example: <director> Matthew Dunn </director>  Example of another element with the same value: <actor> Matthew Dunn </actor>  XML tags are case-sensitive: <CITY> <City> <city>  XML can abbreviate empty elements, for example: <married> </married> can be abbreviated to <married/> 8
  • 9. AUTHORING XML DOCUMENTS  A basic XML document is an XML element that can, but might not, include nested XML elements.  Example: <books> <book isbn=“123”> <title> Second Chance </title> <author> Matthew Dunn </author> </book> </books> 9
  • 10. XML DATA MODEL: EXAMPLE <BOOKS> <book id=“123” loc=“library”> <author>Hull</author> <title>California</title> <year> 1995 </year> </book> <article id=“555” ref=“123”> <author>Su</author> <title> Purdue</title> </article> </BOOKS> Hull Purdue BOOKS 123 555 California Su titleauthor title author article book year 1995 ref loc=“library” 10
  • 11. XML EXAMPLE <?xml version="1.0" encoding="ISO-8859-1"?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> 11
  • 12. XML SYNTAX RULES  All XML Elements Must Have a Closing Tag In HTML, some elements do not have to have a closing tag:  <p>This is a paragraph <p>This is another paragraph In XML, it is illegal to omit the closing tag. All elements must have a closing tag:  <p>This is a paragraph</p> <p>This is another paragraph</p> 12
  • 13. XML SYNTAX RULES  XML Tags are Case Sensitive XML tags are case sensitive. The tag <Letter> is different from the tag <letter>.  Opening and closing tags must be written with the same case: <Message>This is incorrect</message> <message>This is correct</message> 13
  • 14. XML SYNTAX RULES  XML Elements Must be Properly Nested In HTML, you might see improperly nested elements: <b><i>This text is bold and italic</b></i> In XML, all elements must be properly nested within each other: <b><i>This text is bold and italic</i></b> 14
  • 15. XML SYNTAX RULES  XML Documents Must Have a Root Element XML documents must contain one element that is the parent of all other elements. This element is called the root element. <root> <child> <subchild>.....</subchild> </child> </root> 15
  • 16. XML SYNTAX RULES  XML Attribute Values Must be Quoted  XML elements can have attributes in name/value pairs just like in HTML.  In XML, the attribute values must always be quoted.  Incorrect: <note date=12/11/2007> <to>Tove</to> <from>Jani</from> </note>  Correct: <note date="12/11/2007"> <to>Tove</to> <from>Jani</from> </note> 16
  • 17. XML SYNTAX RULES : ENTITY REFERENCES  special meaning of Some characters in XML.  Error in XML:  <message>if salary < 1000 then</message>  To avoid this error, replace the "<" character with an entity reference:  <message>if salary &lt; 1000 then</message>  There are 5 predefined entity references in XML:  &lt; < less than  &gt; > greater than  &amp; & ampersand  &apos; ' apostrophe  &quot; " quotation mark  Note: Only the characters "<" and "&" are strictly illegal in XML. The greater than character is legal, but it is a good habit to replace it. 17
  • 18.  Comments in XML  The syntax for writing comments in XML is similar to that of HTML. <!-- This is a comment --> XML Syntax Rules 18
  • 19.  White-space is Preserved in XML  HTML truncates multiple white-space characters to one single white-space:  HTML: Hello Tove Output: Hello Tove  XML: the white-space in a document is not truncated.  Hello Tove Output: Hello Tove XML Syntax Rules 19
  • 20.  XML Stores New Line as LF  Windows applications : a new line -> carriage return (CR) and line feed (LF).  Unix applications : a new line -> LF character  Macintosh applications : a new line -> LF character  XML stores a new line as LF. XML Syntax Rules 20
  • 22. XML DECLARATION  The XML declaration looks like this: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>  The XML declaration is not required by browsers, but is required by most XML processors (so include it!)  If present, the XML declaration must be first--not even whitespace should precede it  Note that the brackets are <? and ?>  version="1.0" is required (this is the only version so far)  encoding can be "UTF-8" (ASCII) or "UTF-16" (Unicode), or something else, or it can be omitted  standalone tells whether there is a separate DTD 22
  • 23.  An element can contain:  other elements  text  attributes  or a mix of all of the above... XML Elements 23
  • 24. <bookstore> <book category="CHILDREN"> <title>Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book> <book category="WEB"> <title>Learning XML</title> <author>Erik T. Ray</author> <year>2003</year> <price>39.95</price> </book> </bookstore> XML Elements 24
  • 25.  XML elements must follow these 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 XML Elements Naming Rules 25
  • 27. 1) <note date="10/01/2008"> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> XML Elements vs. Attributes 27
  • 30.  Some of the problems with using attributes are:  attributes cannot contain multiple values (elements can)  attributes cannot contain tree structures (elements can)  attributes are not easily expandable (for future changes)  Attributes are difficult to read and maintain. Use elements for data. Use attributes for information that is not relevant to the data. Avoid XML Attributes? 30
  • 32.  XML with correct syntax is "Well Formed" XML.  XML validated against a DTD or XMLSchema is "Valid" XML. XML Validation 32
  • 33. 33
  • 34. 34