SlideShare a Scribd company logo
Introduction to xml
 eXtensible Markup Language, is a
  specification for creating custom
  markup languages
 W3C Recommendation
 Primary purpose is to help computers to
  share data
 XML is meta-language. This means that
  you use it for creating languages.
 XML is an extensive concept.
 Every XML-document is text-based
 => sharing data between different
  computers!
 => sharing data in Internet!
 => platform independence!
   Problems with Binary format
    › Platform depence
    › Firewalls
    › Hard to debug
    › Inspecting the file can be hard
 Since XML is text-based, it does not have
  the problems mentioned above.
 What are the disadvantages in text
  format?
   XML is meta language, which you can use
    to create your own markup languages.
   There are several XML Markup Languages
    made for different purposes
   All the languages have common xml-rules
   Languages: XHTML, OOXML, Open
    Document, RSS, SVG, SOAP, SMIL, MathML...
   List:
    › http://en.wikipedia.org/wiki/List_of_XML_markup_languag
      es
<?xml version="1.0"?>
<!DOCTYPE html
   PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>Minimal XHTML 1.0 Document</title>
 </head>
 <body>
  <p>This is a minimal <a href="http://www.w3.org/TR/xhtml1/">XHTML 1.0</a>
  document.</p>
 </body>
</html>
<?xml version="1.0"?>
<!DOCTYPE svg
   PUBLIC "-//W3C//DTD SVG 1.1//EN"
   "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" version="1.1"
xmlns="http://www.w3.org/2000/svg">

<circle cx="100" cy="50" r="40" stroke="black"
stroke-width="2" fill="red"/>

</svg>
<?xml version="1.0"?>
<!DOCTYPE math:math PUBLIC "-//OpenOffice.org//DTD Modified W3C MathML
    1.01//EN" "math.dtd">
<math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
<math:semantics>
 <math:mrow>
  <math:mi>x</math:mi>
  <math:mo math:stretchy="false">=</math:mo>
  <math:mfrac>
  <math:mrow>
     ...
  </math:mrow>
 <math:annotation math:encoding="StarMath 5.0">x = {-b +-sqrt{b^{2}-4{ac}} } over {2
    {a}} </math:annotation>
</math:semantics>
</math:math>
<?xml version="1.0"?>
<rss version="2.0">
<channel>
 <title>W3Schools Home Page</title>
 <link>http://www.w3schools.com</link>
 <description>Free web building tutorials</description>
 <item>
   <title>RSS Tutorial</title>
   <link>http://www.w3schools.com/rss</link>
   <description>New RSS tutorial on W3Schools</description>
 </item>
 <item>
   <title>XML Tutorial</title>
   <link>http://www.w3schools.com/xml</link>
   <description>New XML tutorial on W3Schools</description>
 </item>
</channel>
</rss>
 XML Spy
 EditiX
 Microsoft XML Notepad
 Visual XML
 XML Viewer
 Xeena
 XML Styler, Morphon, XML Writer…
Rules that Apply to Every
XML-Document
   There are two levels of correctness of an
    XML document:
    1. Well-formed. A well-formed document
       conforms to all of XML's syntax rules.
    2. Valid. A valid document additionally
       conforms to some semantic rules.
   Let's first look at the XML's syntax rules (1).
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<presentation>
  <slide number="1">
    <name>Introduction to XML</name>
    <contents>XML is ...</contents>
  </slide>
</presentation>
   XML-declaration is optional in XML 1.0,
    mandatory in 1.1.
    › Recommendation: use it.
   Version: 1.0 or 1.1
   Encoding: character encoding, default utf-8
   Standalone:
    › is the xml-document linked to external markup
      declaration
    › yes: no external markup declarations
    › no: can have external markup declaration (open
      issue..)
    › default: "no"
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<presentation>
  <slide>
    <name>Introduction to XML</name>
    <contents>XML is ...</contents>
  </slide>
</presentation>
                                       Same Declaration
<?xml version="1.0"?>
<presentation>
  <slide>
    <name>Introduction to XML</name>
    <contents>XML is ...</contents>
  </slide>
</presentation>
   Element consists of start tag, optional content
    and an end tag:
    › <name>Introduction to XML</name>
   Start tag
    › <name>
   Content
    › Introduction to XML
   End tag
    › </name>
   Start tag may have attribute
    › <slide number="1">
 Only one root - element
 Every element contains starting tag and an ending
  tag
 Content is optional: Empty element
   › <x></x> <!-- same as -->
   › <x/>
 Tag – names are case-sensitive:
   › <X></x> <!-- Error -->
 Elements must be ended with the end tag in
  correct order:
   › <p><i>problem here</p></i> <!– Error 
 XML   elements can have attributes
  in the start tag.
 Attributes must be quoted:
  › <person sex="female">
  › <person sex='female'>
  › <gangster name='George "Shotgun" Ziegler'>
  › <gangster name="George
   &quot;Shotgun&quot; Ziegler">
 Names can contain letters, numbers,
  and other characters
 Names must not start with a number or
  punctuation character
 Names must not start with the letters xml
  (or XML, or Xml, etc)
 Names cannot contain spaces
 XML document is well-formed if it follows
  the syntax rules.
 XML document must be well-formed!
    › it's not an xml-document, if it does not follow
     the rules..
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>Minimal XHTML 1.0 Document</title>
 </head>
 <body>
  <p>This is a minimal <a href="http://www.w3.org/TR/xhtml1/">XHTML 1.0</a>
  document.</p>
 </body>
</html>
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>Minimal XHTML 1.0 Document</title>
 </head>
 <body>
  <jorma>This is a minimal <a href="http://www.w3.org/TR/xhtml1/">XHTML 1.0</a>
  document.</jorma>
 </body>
</html>
Defining the Structure for XML
documents
   XML document is valid if
    › 1) It is well formed AND
    › 2) It follows some semantic rules
   XML document is usually linked to an
    external file, that has semantic rules for the
    document.
    › The file can be dtd (.dtd) or schema (.xsd)
   Semantic rules?
    › Name of tags, order of elements
 Because of HTML heritage, browsers try
  to understand invalid XHTML-pages
 This is not the case in other XML-
  languages.
 In general, if XML-document is
  invalid, the processing of the document
  is cancelled.
 XML has strict rules for WF and Valid
 If application tries to manipulate xml-
  document it does not have to try to
  understand the possible errors in the
  document
 This means that handling xml-files via
  programming language is much easier
    › If the document is correctly formed,
      manipulate it
    › If it isn't display error
   For More Like Our Pages:
   https://www.facebook.com/allgtubooks
   https://www.facebook.com/gtumaterials
   https://www.facebook.com/GTU.Projects.Jobs

More Related Content

PPTX
PPTX
Xml ppt
PPT
Introduction to XML
PPT
XML Schema
PDF
Introduction to Javascript
PPTX
PPTX
Css selectors
Xml ppt
Introduction to XML
XML Schema
Introduction to Javascript
Css selectors

What's hot (20)

PPT
Javascript
PPT
02 xml schema
PPTX
(Fast) Introduction to HTML & CSS
PPT
JavaScript: Events Handling
PPTX
Java script errors &amp; exceptions handling
PPT
PHP - Introduction to PHP Forms
PPTX
Introduction to CSS
PPTX
Html5 semantics
PPTX
Html n CSS
PPTX
Web html table tags
PPTX
Ajax
PPTX
HTML, CSS and Java Scripts Basics
PPT
Introduction to Javascript
PPTX
Xml presentation
PPTX
HTML Semantic Elements
PPTX
1 03 - CSS Introduction
PPTX
PPTX
Advance Java Topics (J2EE)
PPT
JavaScript & Dom Manipulation
Javascript
02 xml schema
(Fast) Introduction to HTML & CSS
JavaScript: Events Handling
Java script errors &amp; exceptions handling
PHP - Introduction to PHP Forms
Introduction to CSS
Html5 semantics
Html n CSS
Web html table tags
Ajax
HTML, CSS and Java Scripts Basics
Introduction to Javascript
Xml presentation
HTML Semantic Elements
1 03 - CSS Introduction
Advance Java Topics (J2EE)
JavaScript & Dom Manipulation
Ad

Viewers also liked (7)

PPT
C O R B A Unit 4
PPT
Introduction to XML
PPTX
PPT
PPTX
Corba concepts & corba architecture
PPT
Spatial filtering using image processing
C O R B A Unit 4
Introduction to XML
Corba concepts & corba architecture
Spatial filtering using image processing
Ad

Similar to Introduction to xml (20)

PDF
M.FLORENCE DAYANA WEB DESIGN -Unit 5 XML
PPT
EXtensible Markup Language
PPTX
Web Development Course - XML by RSOLUTIONS
PDF
light_xml
PPT
Xml Presentation-3
PPT
Xml1111
PPTX
Unit 5 xml (1)
PDF
XMLin Web development and Applications.pdf
PDF
XML for Web Development Information tech.pdf
PDF
Web engineering UNIT IV as per RGPV syllabus
PPTX
Intro xml
PDF
xml introduction in web technologies subject
PDF
XML
PDF
Web engineering notes unit 4
PPTX
Unit3wt
PPTX
Unit3wt
PPT
Introduction to xml
PPTX
Extensible Markup Language(XML)_lecture.pptx
M.FLORENCE DAYANA WEB DESIGN -Unit 5 XML
EXtensible Markup Language
Web Development Course - XML by RSOLUTIONS
light_xml
Xml Presentation-3
Xml1111
Unit 5 xml (1)
XMLin Web development and Applications.pdf
XML for Web Development Information tech.pdf
Web engineering UNIT IV as per RGPV syllabus
Intro xml
xml introduction in web technologies subject
XML
Web engineering notes unit 4
Unit3wt
Unit3wt
Introduction to xml
Extensible Markup Language(XML)_lecture.pptx

Recently uploaded (20)

PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
PDF
SOIL: Factor, Horizon, Process, Classification, Degradation, Conservation
PDF
RMMM.pdf make it easy to upload and study
PPTX
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
A systematic review of self-coping strategies used by university students to ...
PPTX
UNIT III MENTAL HEALTH NURSING ASSESSMENT
PPTX
Lesson notes of climatology university.
PDF
advance database management system book.pdf
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
Indian roads congress 037 - 2012 Flexible pavement
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PPTX
Digestion and Absorption of Carbohydrates, Proteina and Fats
Final Presentation General Medicine 03-08-2024.pptx
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
SOIL: Factor, Horizon, Process, Classification, Degradation, Conservation
RMMM.pdf make it easy to upload and study
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Complications of Minimal Access Surgery at WLH
A systematic review of self-coping strategies used by university students to ...
UNIT III MENTAL HEALTH NURSING ASSESSMENT
Lesson notes of climatology university.
advance database management system book.pdf
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Final Presentation General Medicine 03-08-2024.pptx
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Indian roads congress 037 - 2012 Flexible pavement
A powerpoint presentation on the Revised K-10 Science Shaping Paper
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
Digestion and Absorption of Carbohydrates, Proteina and Fats

Introduction to xml

  • 2.  eXtensible Markup Language, is a specification for creating custom markup languages  W3C Recommendation  Primary purpose is to help computers to share data  XML is meta-language. This means that you use it for creating languages.  XML is an extensive concept.
  • 3.  Every XML-document is text-based  => sharing data between different computers!  => sharing data in Internet!  => platform independence!
  • 4. Problems with Binary format › Platform depence › Firewalls › Hard to debug › Inspecting the file can be hard  Since XML is text-based, it does not have the problems mentioned above.  What are the disadvantages in text format?
  • 5. XML is meta language, which you can use to create your own markup languages.  There are several XML Markup Languages made for different purposes  All the languages have common xml-rules  Languages: XHTML, OOXML, Open Document, RSS, SVG, SOAP, SMIL, MathML...  List: › http://en.wikipedia.org/wiki/List_of_XML_markup_languag es
  • 6. <?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Minimal XHTML 1.0 Document</title> </head> <body> <p>This is a minimal <a href="http://www.w3.org/TR/xhtml1/">XHTML 1.0</a> document.</p> </body> </html>
  • 7. <?xml version="1.0"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red"/> </svg>
  • 8. <?xml version="1.0"?> <!DOCTYPE math:math PUBLIC "-//OpenOffice.org//DTD Modified W3C MathML 1.01//EN" "math.dtd"> <math:math xmlns:math="http://www.w3.org/1998/Math/MathML"> <math:semantics> <math:mrow> <math:mi>x</math:mi> <math:mo math:stretchy="false">=</math:mo> <math:mfrac> <math:mrow> ... </math:mrow> <math:annotation math:encoding="StarMath 5.0">x = {-b +-sqrt{b^{2}-4{ac}} } over {2 {a}} </math:annotation> </math:semantics> </math:math>
  • 9. <?xml version="1.0"?> <rss version="2.0"> <channel> <title>W3Schools Home Page</title> <link>http://www.w3schools.com</link> <description>Free web building tutorials</description> <item> <title>RSS Tutorial</title> <link>http://www.w3schools.com/rss</link> <description>New RSS tutorial on W3Schools</description> </item> <item> <title>XML Tutorial</title> <link>http://www.w3schools.com/xml</link> <description>New XML tutorial on W3Schools</description> </item> </channel> </rss>
  • 10.  XML Spy  EditiX  Microsoft XML Notepad  Visual XML  XML Viewer  Xeena  XML Styler, Morphon, XML Writer…
  • 11. Rules that Apply to Every XML-Document
  • 12. There are two levels of correctness of an XML document: 1. Well-formed. A well-formed document conforms to all of XML's syntax rules. 2. Valid. A valid document additionally conforms to some semantic rules.  Let's first look at the XML's syntax rules (1).
  • 13. <?xml version="1.0" encoding="utf-8" standalone="yes"?> <presentation> <slide number="1"> <name>Introduction to XML</name> <contents>XML is ...</contents> </slide> </presentation>
  • 14. XML-declaration is optional in XML 1.0, mandatory in 1.1. › Recommendation: use it.  Version: 1.0 or 1.1  Encoding: character encoding, default utf-8  Standalone: › is the xml-document linked to external markup declaration › yes: no external markup declarations › no: can have external markup declaration (open issue..) › default: "no"
  • 15. <?xml version="1.0" encoding="utf-8" standalone="no"?> <presentation> <slide> <name>Introduction to XML</name> <contents>XML is ...</contents> </slide> </presentation> Same Declaration <?xml version="1.0"?> <presentation> <slide> <name>Introduction to XML</name> <contents>XML is ...</contents> </slide> </presentation>
  • 16. Element consists of start tag, optional content and an end tag: › <name>Introduction to XML</name>  Start tag › <name>  Content › Introduction to XML  End tag › </name>  Start tag may have attribute › <slide number="1">
  • 17.  Only one root - element  Every element contains starting tag and an ending tag  Content is optional: Empty element › <x></x> <!-- same as --> › <x/>  Tag – names are case-sensitive: › <X></x> <!-- Error -->  Elements must be ended with the end tag in correct order: › <p><i>problem here</p></i> <!– Error 
  • 18.  XML elements can have attributes in the start tag.  Attributes must be quoted: › <person sex="female"> › <person sex='female'> › <gangster name='George "Shotgun" Ziegler'> › <gangster name="George &quot;Shotgun&quot; Ziegler">
  • 19.  Names can contain letters, numbers, and other characters  Names must not start with a number or punctuation character  Names must not start with the letters xml (or XML, or Xml, etc)  Names cannot contain spaces
  • 20.  XML document is well-formed if it follows the syntax rules.  XML document must be well-formed! › it's not an xml-document, if it does not follow the rules..
  • 21. <?xml version="1.0"?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Minimal XHTML 1.0 Document</title> </head> <body> <p>This is a minimal <a href="http://www.w3.org/TR/xhtml1/">XHTML 1.0</a> document.</p> </body> </html>
  • 22. <?xml version="1.0"?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Minimal XHTML 1.0 Document</title> </head> <body> <jorma>This is a minimal <a href="http://www.w3.org/TR/xhtml1/">XHTML 1.0</a> document.</jorma> </body> </html>
  • 23. Defining the Structure for XML documents
  • 24. XML document is valid if › 1) It is well formed AND › 2) It follows some semantic rules  XML document is usually linked to an external file, that has semantic rules for the document. › The file can be dtd (.dtd) or schema (.xsd)  Semantic rules? › Name of tags, order of elements
  • 25.  Because of HTML heritage, browsers try to understand invalid XHTML-pages  This is not the case in other XML- languages.  In general, if XML-document is invalid, the processing of the document is cancelled.
  • 26.  XML has strict rules for WF and Valid  If application tries to manipulate xml- document it does not have to try to understand the possible errors in the document  This means that handling xml-files via programming language is much easier › If the document is correctly formed, manipulate it › If it isn't display error
  • 27. For More Like Our Pages:  https://www.facebook.com/allgtubooks  https://www.facebook.com/gtumaterials  https://www.facebook.com/GTU.Projects.Jobs